From bc41abd5a0d7640778aa19b6cca75bc96e9e6092 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Thu, 28 Jun 2018 21:26:10 +0000 Subject: [PATCH 1/2] Generated from 414f3b0aa9e434782dc37b0fbe8f71f567975b7e Using plural for operation group name consistently --- .../application_insights_management_client.py | 18 +- .../applicationinsights/models/__init__.py | 12 +- .../models/application_insights_component.py | 4 +- ...cation_insights_management_client_enums.py | 4 +- .../models/component_purge_status_response.py | 2 +- .../models/components_resource.py | 54 +++ .../applicationinsights/models/web_test.py | 4 +- .../{resource.py => webtests_resource.py} | 4 +- .../applicationinsights/models/workbook.py | 7 +- .../{workbooks.py => workbook_paged.py} | 19 +- .../models/workbook_resource.py | 53 +++ .../operations/__init__.py | 8 +- ...tions.py => analytics_items_operations.py} | 4 +- .../operations/components_operations.py | 134 ++++---- .../operations/favorite_operations.py | 323 ------------------ .../operations/favorites_operations.py | 285 ++++++++++++++++ .../operations/workbook_operations.py | 295 ---------------- .../operations/workbooks_operations.py | 289 +++++++++++++++- 18 files changed, 781 insertions(+), 738 deletions(-) create mode 100644 azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/models/components_resource.py rename azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/models/{resource.py => webtests_resource.py} (95%) rename azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/models/{workbooks.py => workbook_paged.py} (55%) create mode 100644 azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/models/workbook_resource.py rename azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/operations/{analytics_item_operations.py => analytics_items_operations.py} (99%) delete mode 100644 azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/operations/favorite_operations.py delete mode 100644 azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/operations/workbook_operations.py diff --git a/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/application_insights_management_client.py b/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/application_insights_management_client.py index 2d858aacfc17..410a75b014f4 100644 --- a/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/application_insights_management_client.py +++ b/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/application_insights_management_client.py @@ -25,12 +25,10 @@ from .operations.components_operations import ComponentsOperations from .operations.work_item_configurations_operations import WorkItemConfigurationsOperations from .operations.favorites_operations import FavoritesOperations -from .operations.favorite_operations import FavoriteOperations from .operations.web_test_locations_operations import WebTestLocationsOperations from .operations.web_tests_operations import WebTestsOperations -from .operations.analytics_item_operations import AnalyticsItemOperations +from .operations.analytics_items_operations import AnalyticsItemsOperations from .operations.workbooks_operations import WorkbooksOperations -from .operations.workbook_operations import WorkbookOperations from . import models @@ -96,18 +94,14 @@ class ApplicationInsightsManagementClient(object): :vartype work_item_configurations: azure.mgmt.applicationinsights.operations.WorkItemConfigurationsOperations :ivar favorites: Favorites operations :vartype favorites: azure.mgmt.applicationinsights.operations.FavoritesOperations - :ivar favorite: Favorite operations - :vartype favorite: azure.mgmt.applicationinsights.operations.FavoriteOperations :ivar web_test_locations: WebTestLocations operations :vartype web_test_locations: azure.mgmt.applicationinsights.operations.WebTestLocationsOperations :ivar web_tests: WebTests operations :vartype web_tests: azure.mgmt.applicationinsights.operations.WebTestsOperations - :ivar analytics_item: AnalyticsItem operations - :vartype analytics_item: azure.mgmt.applicationinsights.operations.AnalyticsItemOperations + :ivar analytics_items: AnalyticsItems operations + :vartype analytics_items: azure.mgmt.applicationinsights.operations.AnalyticsItemsOperations :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 @@ -152,15 +146,11 @@ def __init__( self._client, self.config, self._serialize, self._deserialize) self.favorites = FavoritesOperations( self._client, self.config, self._serialize, self._deserialize) - self.favorite = FavoriteOperations( - self._client, self.config, self._serialize, self._deserialize) self.web_test_locations = WebTestLocationsOperations( self._client, self.config, self._serialize, self._deserialize) self.web_tests = WebTestsOperations( self._client, self.config, self._serialize, self._deserialize) - self.analytics_item = AnalyticsItemOperations( + self.analytics_items = AnalyticsItemsOperations( 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) diff --git a/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/models/__init__.py b/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/models/__init__.py index d5461ffaf45e..8f6e4cca097b 100644 --- a/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/models/__init__.py +++ b/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/models/__init__.py @@ -28,7 +28,7 @@ from .application_insights_component_available_features import ApplicationInsightsComponentAvailableFeatures from .application_insights_component_proactive_detection_configuration_rule_definitions import ApplicationInsightsComponentProactiveDetectionConfigurationRuleDefinitions from .application_insights_component_proactive_detection_configuration import ApplicationInsightsComponentProactiveDetectionConfiguration -from .resource import Resource +from .components_resource import ComponentsResource from .tags_resource import TagsResource from .application_insights_component import ApplicationInsightsComponent from .component_purge_body_filters import ComponentPurgeBodyFilters @@ -40,13 +40,14 @@ from .work_item_configuration_error import WorkItemConfigurationError, WorkItemConfigurationErrorException from .application_insights_component_favorite import ApplicationInsightsComponentFavorite from .application_insights_component_web_test_location import ApplicationInsightsComponentWebTestLocation +from .webtests_resource import WebtestsResource from .web_test_geolocation import WebTestGeolocation from .web_test_properties_configuration import WebTestPropertiesConfiguration from .web_test import WebTest from .application_insights_component_analytics_item_properties import ApplicationInsightsComponentAnalyticsItemProperties from .application_insights_component_analytics_item import ApplicationInsightsComponentAnalyticsItem +from .workbook_resource import WorkbookResource 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 @@ -55,6 +56,7 @@ from .application_insights_component_paged import ApplicationInsightsComponentPaged from .application_insights_component_web_test_location_paged import ApplicationInsightsComponentWebTestLocationPaged from .web_test_paged import WebTestPaged +from .workbook_paged import WorkbookPaged from .application_insights_management_client_enums import ( ApplicationType, FlowType, @@ -91,7 +93,7 @@ 'ApplicationInsightsComponentAvailableFeatures', 'ApplicationInsightsComponentProactiveDetectionConfigurationRuleDefinitions', 'ApplicationInsightsComponentProactiveDetectionConfiguration', - 'Resource', + 'ComponentsResource', 'TagsResource', 'ApplicationInsightsComponent', 'ComponentPurgeBodyFilters', @@ -103,13 +105,14 @@ 'WorkItemConfigurationError', 'WorkItemConfigurationErrorException', 'ApplicationInsightsComponentFavorite', 'ApplicationInsightsComponentWebTestLocation', + 'WebtestsResource', 'WebTestGeolocation', 'WebTestPropertiesConfiguration', 'WebTest', 'ApplicationInsightsComponentAnalyticsItemProperties', 'ApplicationInsightsComponentAnalyticsItem', + 'WorkbookResource', 'Workbook', - 'Workbooks', 'LinkProperties', 'ErrorFieldContract', 'WorkbookError', 'WorkbookErrorException', @@ -118,6 +121,7 @@ 'ApplicationInsightsComponentPaged', 'ApplicationInsightsComponentWebTestLocationPaged', 'WebTestPaged', + 'WorkbookPaged', 'ApplicationType', 'FlowType', 'RequestSource', diff --git a/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/models/application_insights_component.py b/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/models/application_insights_component.py index f3c11134bfe0..059940399eb6 100644 --- a/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/models/application_insights_component.py +++ b/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/models/application_insights_component.py @@ -9,10 +9,10 @@ # regenerated. # -------------------------------------------------------------------------- -from .resource import Resource +from .components_resource import ComponentsResource -class ApplicationInsightsComponent(Resource): +class ApplicationInsightsComponent(ComponentsResource): """An Application Insights component definition. Variables are only populated by the server, and will be ignored when diff --git a/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/models/application_insights_management_client_enums.py b/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/models/application_insights_management_client_enums.py index 9f47193bd8d7..f86366b1f65e 100644 --- a/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/models/application_insights_management_client_enums.py +++ b/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/models/application_insights_management_client_enums.py @@ -30,8 +30,8 @@ class RequestSource(Enum): class PurgeState(Enum): - pending = "Pending" - completed = "Completed" + pending = "pending" + completed = "completed" class FavoriteType(Enum): diff --git a/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/models/component_purge_status_response.py b/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/models/component_purge_status_response.py index 7c6e7d8e41a1..88bc48117059 100644 --- a/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/models/component_purge_status_response.py +++ b/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/models/component_purge_status_response.py @@ -16,7 +16,7 @@ class ComponentPurgeStatusResponse(Model): """Response containing status for a specific purge operation. :param status: Status of the operation represented by the requested Id. - Possible values include: 'Pending', 'Completed' + Possible values include: 'pending', 'completed' :type status: str or ~azure.mgmt.applicationinsights.models.PurgeState """ diff --git a/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/models/components_resource.py b/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/models/components_resource.py new file mode 100644 index 000000000000..bdf5f7ae486a --- /dev/null +++ b/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/models/components_resource.py @@ -0,0 +1,54 @@ +# 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 ComponentsResource(Model): + """An azure resource object. + + 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] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__(self, location, tags=None): + super(ComponentsResource, self).__init__() + self.id = None + self.name = None + self.type = None + self.location = location + self.tags = tags diff --git a/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/models/web_test.py b/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/models/web_test.py index 103aa8c9c064..674d2fb6c2e5 100644 --- a/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/models/web_test.py +++ b/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/models/web_test.py @@ -9,10 +9,10 @@ # regenerated. # -------------------------------------------------------------------------- -from .resource import Resource +from .webtests_resource import WebtestsResource -class WebTest(Resource): +class WebTest(WebtestsResource): """An Application Insights web test definition. Variables are only populated by the server, and will be ignored when diff --git a/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/models/resource.py b/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/models/webtests_resource.py similarity index 95% rename from azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/models/resource.py rename to azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/models/webtests_resource.py index 1552cf70c86d..5ee88c94334c 100644 --- a/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/models/resource.py +++ b/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/models/webtests_resource.py @@ -12,7 +12,7 @@ from msrest.serialization import Model -class Resource(Model): +class WebtestsResource(Model): """An azure resource object. Variables are only populated by the server, and will be ignored when @@ -46,7 +46,7 @@ class Resource(Model): } def __init__(self, location, tags=None): - super(Resource, self).__init__() + super(WebtestsResource, self).__init__() self.id = None self.name = None self.type = None diff --git a/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/models/workbook.py b/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/models/workbook.py index 176aef106a65..b4c6a22eefc1 100644 --- a/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/models/workbook.py +++ b/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/models/workbook.py @@ -9,10 +9,10 @@ # regenerated. # -------------------------------------------------------------------------- -from .resource import Resource +from .workbook_resource import WorkbookResource -class Workbook(Resource): +class Workbook(WorkbookResource): """An Application Insights workbook definition. Variables are only populated by the server, and will be ignored when @@ -68,7 +68,6 @@ class Workbook(Resource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'location': {'required': True}, 'workbook_name': {'required': True}, 'serialized_data': {'required': True}, 'workbook_id': {'required': True}, @@ -97,7 +96,7 @@ class Workbook(Resource): '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): + def __init__(self, workbook_name, serialized_data, workbook_id, category, user_id, location=None, 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 diff --git a/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/models/workbooks.py b/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/models/workbook_paged.py similarity index 55% rename from azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/models/workbooks.py rename to azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/models/workbook_paged.py index fe59aec37ce0..5487b5ce3e32 100644 --- a/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/models/workbooks.py +++ b/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/models/workbook_paged.py @@ -9,20 +9,19 @@ # regenerated. # -------------------------------------------------------------------------- -from msrest.serialization import Model +from msrest.paging import Paged -class Workbooks(Model): - """Workbook list result. - - :param value: An array of workbooks. - :type value: list[~azure.mgmt.applicationinsights.models.Workbook] +class WorkbookPaged(Paged): + """ + A paging container for iterating over a list of :class:`Workbook ` object """ _attribute_map = { - 'value': {'key': 'value', 'type': '[Workbook]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[Workbook]'} } - def __init__(self, value=None): - super(Workbooks, self).__init__() - self.value = value + def __init__(self, *args, **kwargs): + + super(WorkbookPaged, self).__init__(*args, **kwargs) diff --git a/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/models/workbook_resource.py b/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/models/workbook_resource.py new file mode 100644 index 000000000000..bafc8d172ef5 --- /dev/null +++ b/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/models/workbook_resource.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 WorkbookResource(Model): + """An azure resource object. + + 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] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__(self, location=None, tags=None): + super(WorkbookResource, self).__init__() + self.id = None + self.name = None + self.type = None + self.location = location + self.tags = tags diff --git a/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/operations/__init__.py b/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/operations/__init__.py index 5d80e59ee21c..dadfea943845 100644 --- a/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/operations/__init__.py +++ b/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/operations/__init__.py @@ -21,12 +21,10 @@ from .components_operations import ComponentsOperations from .work_item_configurations_operations import WorkItemConfigurationsOperations from .favorites_operations import FavoritesOperations -from .favorite_operations import FavoriteOperations from .web_test_locations_operations import WebTestLocationsOperations from .web_tests_operations import WebTestsOperations -from .analytics_item_operations import AnalyticsItemOperations +from .analytics_items_operations import AnalyticsItemsOperations from .workbooks_operations import WorkbooksOperations -from .workbook_operations import WorkbookOperations __all__ = [ 'Operations', @@ -41,10 +39,8 @@ 'ComponentsOperations', 'WorkItemConfigurationsOperations', 'FavoritesOperations', - 'FavoriteOperations', 'WebTestLocationsOperations', 'WebTestsOperations', - 'AnalyticsItemOperations', + 'AnalyticsItemsOperations', 'WorkbooksOperations', - 'WorkbookOperations', ] diff --git a/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/operations/analytics_item_operations.py b/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/operations/analytics_items_operations.py similarity index 99% rename from azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/operations/analytics_item_operations.py rename to azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/operations/analytics_items_operations.py index 2f96fd3e210a..0323f8667f0b 100644 --- a/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/operations/analytics_item_operations.py +++ b/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/operations/analytics_items_operations.py @@ -16,8 +16,8 @@ from .. import models -class AnalyticsItemOperations(object): - """AnalyticsItemOperations operations. +class AnalyticsItemsOperations(object): + """AnalyticsItemsOperations operations. :param client: Client for service requests. :param config: Configuration of service client. diff --git a/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/operations/components_operations.py b/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/operations/components_operations.py index 6ef8925afec7..fd2aa2a6d6da 100644 --- a/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/operations/components_operations.py +++ b/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/operations/components_operations.py @@ -12,8 +12,6 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError -from msrest.exceptions import DeserializationError -from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -439,9 +437,32 @@ def update_tags( return deserialized update_tags.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}'} - - def _purge_initial( + def purge( self, resource_group_name, resource_name, table, filters, custom_headers=None, raw=False, **operation_config): + """Purges data in an Application Insights component by a set of + user-defined filters. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component + resource. + :type resource_name: str + :param table: Table from which to purge data. + :type table: str + :param filters: The set of columns and filters (queries) to run over + them to purge the resulting data. + :type filters: + list[~azure.mgmt.applicationinsights.models.ComponentPurgeBodyFilters] + :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: ComponentPurgeResponse or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.applicationinsights.models.ComponentPurgeResponse + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ body = models.ComponentPurgeBody(table=table, filters=filters) # Construct URL @@ -475,15 +496,13 @@ def _purge_initial( response = self._client.send( request, header_parameters, body_content, stream=False, **operation_config) - if response.status_code not in [200, 202]: + if response.status_code not in [202]: exp = CloudError(response) exp.request_id = response.headers.get('x-ms-request-id') raise exp deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('ComponentPurgeStatusResponse', response) if response.status_code == 202: deserialized = self._deserialize('ComponentPurgeResponse', response) @@ -492,77 +511,72 @@ def _purge_initial( return client_raw_response return deserialized + purge.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/purge'} - def purge( - self, resource_group_name, resource_name, table, filters, custom_headers=None, raw=False, **operation_config): - """Purges data in an Application Insights component by a set of - user-defined filters. + def get_purge_status( + self, resource_group_name, resource_name, purge_id, custom_headers=None, raw=False, **operation_config): + """Get status for an ongoing purge operation. :param resource_group_name: The name of the resource group. :type resource_group_name: str :param resource_name: The name of the Application Insights component resource. :type resource_name: str - :param table: Table from which to purge data. - :type table: str - :param filters: The set of columns and filters (queries) to run over - them to purge the resulting data. - :type filters: - list[~azure.mgmt.applicationinsights.models.ComponentPurgeBodyFilters] + :param purge_id: In a purge status request, this is the Id of the + operation the status of which is returned. + :type purge_id: str :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response - :return: An instance of AzureOperationPoller that returns object or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[object] or + :param operation_config: :ref:`Operation configuration + overrides`. + :return: ComponentPurgeStatusResponse or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.applicationinsights.models.ComponentPurgeStatusResponse or ~msrest.pipeline.ClientRawResponse :raises: :class:`CloudError` """ - raw_result = self._purge_initial( - resource_group_name=resource_group_name, - resource_name=resource_name, - table=table, - filters=filters, - custom_headers=custom_headers, - raw=True, - **operation_config - ) - if raw: - return raw_result - - # Construct and send request - def long_running_send(): - return raw_result.response + # Construct URL + url = self.get_purge_status.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'purgeId': self._serialize.url("purge_id", purge_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) - def get_long_running_status(status_link, headers=None): + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - request = self._client.get(status_link) - if headers: - request.headers.update(headers) - header_parameters = {} - header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] - return self._client.send( - request, header_parameters, stream=False, **operation_config) + # Construct headers + header_parameters = {} + 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') - def get_long_running_output(response): + # Construct and send request + request = self._client.get(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) - if response.status_code not in [200, 202]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp - deserialized = self._deserialize('object', response) + deserialized = None - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if response.status_code == 200: + deserialized = self._deserialize('ComponentPurgeStatusResponse', response) - return deserialized + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response - long_running_operation_timeout = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - return AzureOperationPoller( - long_running_send, get_long_running_output, - get_long_running_status, long_running_operation_timeout) - purge.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/purge'} + return deserialized + get_purge_status.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/operations/{purgeId}'} diff --git a/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/operations/favorite_operations.py b/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/operations/favorite_operations.py deleted file mode 100644 index 05c4e229f79e..000000000000 --- a/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/operations/favorite_operations.py +++ /dev/null @@ -1,323 +0,0 @@ -# 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 msrestazure.azure_exceptions import CloudError - -from .. import models - - -class FavoriteOperations(object): - """FavoriteOperations 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: Client Api Version. Constant value: "2015-05-01". - """ - - models = models - - def __init__(self, client, config, serializer, deserializer): - - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self.api_version = "2015-05-01" - - self.config = config - - def get( - self, resource_group_name, resource_name, favorite_id, custom_headers=None, raw=False, **operation_config): - """Get a single favorite by its FavoriteId, defined within an Application - Insights component. - - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component - resource. - :type resource_name: str - :param favorite_id: The Id of a specific favorite defined in the - Application Insights component - :type favorite_id: 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: ApplicationInsightsComponentFavorite or ClientRawResponse if - raw=true - :rtype: - ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentFavorite - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ - # Construct URL - url = self.get.metadata['url'] - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), - 'favoriteId': self._serialize.url("favorite_id", favorite_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') - - # Construct headers - header_parameters = {} - 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 and send request - request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, stream=False, **operation_config) - - if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('ApplicationInsightsComponentFavorite', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/favorites/{favoriteId}'} - - def add( - self, resource_group_name, resource_name, favorite_id, favorite_properties, custom_headers=None, raw=False, **operation_config): - """Adds a new favorites to an Application Insights component. - - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component - resource. - :type resource_name: str - :param favorite_id: The Id of a specific favorite defined in the - Application Insights component - :type favorite_id: str - :param favorite_properties: Properties that need to be specified to - create a new favorite and add it to an Application Insights component. - :type favorite_properties: - ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentFavorite - :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: ApplicationInsightsComponentFavorite or ClientRawResponse if - raw=true - :rtype: - ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentFavorite - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ - # Construct URL - url = self.add.metadata['url'] - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), - 'favoriteId': self._serialize.url("favorite_id", favorite_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') - - # Construct headers - header_parameters = {} - 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(favorite_properties, 'ApplicationInsightsComponentFavorite') - - # Construct and send request - request = self._client.put(url, query_parameters) - response = self._client.send( - request, header_parameters, body_content, stream=False, **operation_config) - - if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('ApplicationInsightsComponentFavorite', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - add.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/favorites/{favoriteId}'} - - def update( - self, resource_group_name, resource_name, favorite_id, favorite_properties, custom_headers=None, raw=False, **operation_config): - """Updates a favorite that has already been added to an Application - Insights component. - - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component - resource. - :type resource_name: str - :param favorite_id: The Id of a specific favorite defined in the - Application Insights component - :type favorite_id: str - :param favorite_properties: Properties that need to be specified to - update the existing favorite. - :type favorite_properties: - ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentFavorite - :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: ApplicationInsightsComponentFavorite or ClientRawResponse if - raw=true - :rtype: - ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentFavorite - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ - # Construct URL - url = self.update.metadata['url'] - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), - 'favoriteId': self._serialize.url("favorite_id", favorite_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') - - # Construct headers - header_parameters = {} - 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(favorite_properties, 'ApplicationInsightsComponentFavorite') - - # Construct and send request - request = self._client.patch(url, query_parameters) - response = self._client.send( - request, header_parameters, body_content, stream=False, **operation_config) - - if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('ApplicationInsightsComponentFavorite', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/favorites/{favoriteId}'} - - def delete( - self, resource_group_name, resource_name, favorite_id, custom_headers=None, raw=False, **operation_config): - """Remove a favorite that is associated to an Application Insights - component. - - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component - resource. - :type resource_name: str - :param favorite_id: The Id of a specific favorite defined in the - Application Insights component - :type favorite_id: 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:`CloudError` - """ - # Construct URL - url = self.delete.metadata['url'] - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), - 'favoriteId': self._serialize.url("favorite_id", favorite_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') - - # Construct headers - header_parameters = {} - 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 and send request - request = self._client.delete(url, query_parameters) - response = self._client.send(request, header_parameters, stream=False, **operation_config) - - if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/favorites/{favoriteId}'} diff --git a/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/operations/favorites_operations.py b/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/operations/favorites_operations.py index baebf01c476f..6b88133361a7 100644 --- a/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/operations/favorites_operations.py +++ b/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/operations/favorites_operations.py @@ -125,3 +125,288 @@ def list( return deserialized list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/favorites'} + + def get( + self, resource_group_name, resource_name, favorite_id, custom_headers=None, raw=False, **operation_config): + """Get a single favorite by its FavoriteId, defined within an Application + Insights component. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component + resource. + :type resource_name: str + :param favorite_id: The Id of a specific favorite defined in the + Application Insights component + :type favorite_id: 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: ApplicationInsightsComponentFavorite or ClientRawResponse if + raw=true + :rtype: + ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentFavorite + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'favoriteId': self._serialize.url("favorite_id", favorite_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') + + # Construct headers + header_parameters = {} + 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 and send request + request = self._client.get(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('ApplicationInsightsComponentFavorite', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/favorites/{favoriteId}'} + + def add( + self, resource_group_name, resource_name, favorite_id, favorite_properties, custom_headers=None, raw=False, **operation_config): + """Adds a new favorites to an Application Insights component. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component + resource. + :type resource_name: str + :param favorite_id: The Id of a specific favorite defined in the + Application Insights component + :type favorite_id: str + :param favorite_properties: Properties that need to be specified to + create a new favorite and add it to an Application Insights component. + :type favorite_properties: + ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentFavorite + :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: ApplicationInsightsComponentFavorite or ClientRawResponse if + raw=true + :rtype: + ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentFavorite + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.add.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'favoriteId': self._serialize.url("favorite_id", favorite_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') + + # Construct headers + header_parameters = {} + 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(favorite_properties, 'ApplicationInsightsComponentFavorite') + + # Construct and send request + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('ApplicationInsightsComponentFavorite', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + add.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/favorites/{favoriteId}'} + + def update( + self, resource_group_name, resource_name, favorite_id, favorite_properties, custom_headers=None, raw=False, **operation_config): + """Updates a favorite that has already been added to an Application + Insights component. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component + resource. + :type resource_name: str + :param favorite_id: The Id of a specific favorite defined in the + Application Insights component + :type favorite_id: str + :param favorite_properties: Properties that need to be specified to + update the existing favorite. + :type favorite_properties: + ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentFavorite + :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: ApplicationInsightsComponentFavorite or ClientRawResponse if + raw=true + :rtype: + ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentFavorite + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.update.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'favoriteId': self._serialize.url("favorite_id", favorite_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') + + # Construct headers + header_parameters = {} + 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(favorite_properties, 'ApplicationInsightsComponentFavorite') + + # Construct and send request + request = self._client.patch(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('ApplicationInsightsComponentFavorite', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/favorites/{favoriteId}'} + + def delete( + self, resource_group_name, resource_name, favorite_id, custom_headers=None, raw=False, **operation_config): + """Remove a favorite that is associated to an Application Insights + component. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component + resource. + :type resource_name: str + :param favorite_id: The Id of a specific favorite defined in the + Application Insights component + :type favorite_id: 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:`CloudError` + """ + # Construct URL + url = self.delete.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'favoriteId': self._serialize.url("favorite_id", favorite_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') + + # Construct headers + header_parameters = {} + 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 and send request + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/favorites/{favoriteId}'} diff --git a/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/operations/workbook_operations.py b/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/operations/workbook_operations.py deleted file mode 100644 index 085e32419bb2..000000000000 --- a/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/operations/workbook_operations.py +++ /dev/null @@ -1,295 +0,0 @@ -# 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 WorkbookOperations(object): - """WorkbookOperations 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: Client Api Version. Constant value: "2015-05-01". - """ - - models = models - - def __init__(self, client, config, serializer, deserializer): - - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self.api_version = "2015-05-01" - - self.config = config - - def get( - self, resource_group_name, resource_name, custom_headers=None, raw=False, **operation_config): - """Get a single workbook by its resourceName. - - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component - resource. - :type resource_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: Workbook or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.applicationinsights.models.Workbook or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`WorkbookErrorException` - """ - # 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'), - 'resourceName': self._serialize.url("resource_name", resource_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['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 and send request - request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, stream=False, **operation_config) - - if response.status_code not in [200]: - raise models.WorkbookErrorException(self._deserialize, response) - - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('Workbook', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroup/{resourceGroupName}/providers/microsoft.insights/workbooks/{resourceName}'} - - def delete( - self, resource_group_name, resource_name, custom_headers=None, raw=False, **operation_config): - """Delete a workbook. - - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component - resource. - :type resource_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:`WorkbookErrorException` - """ - # 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'), - 'resourceName': self._serialize.url("resource_name", resource_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['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 and send request - request = self._client.delete(url, query_parameters) - response = self._client.send(request, header_parameters, stream=False, **operation_config) - - if response.status_code not in [201, 204]: - raise models.WorkbookErrorException(self._deserialize, response) - - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroup/{resourceGroupName}/providers/microsoft.insights/workbooks/{resourceName}'} - - def create_or_update( - self, resource_group_name, resource_name, workbook_properties, custom_headers=None, raw=False, **operation_config): - """Create a new workbook. - - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component - resource. - :type resource_name: str - :param workbook_properties: Properties that need to be specified to - create a new workbook. - :type workbook_properties: - ~azure.mgmt.applicationinsights.models.Workbook - :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: Workbook or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.applicationinsights.models.Workbook or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`WorkbookErrorException` - """ - # 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'), - 'resourceName': self._serialize.url("resource_name", resource_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['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(workbook_properties, 'Workbook') - - # Construct and send request - request = self._client.put(url, query_parameters) - response = self._client.send( - request, header_parameters, body_content, stream=False, **operation_config) - - if response.status_code not in [200, 201]: - raise models.WorkbookErrorException(self._deserialize, response) - - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('Workbook', response) - if response.status_code == 201: - deserialized = self._deserialize('Workbook', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroup/{resourceGroupName}/providers/microsoft.insights/workbooks/{resourceName}'} - - def update( - self, resource_group_name, resource_name, workbook_properties, custom_headers=None, raw=False, **operation_config): - """Updates a workbook that has already been added. - - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component - resource. - :type resource_name: str - :param workbook_properties: Properties that need to be specified to - create a new workbook. - :type workbook_properties: - ~azure.mgmt.applicationinsights.models.Workbook - :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: Workbook or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.applicationinsights.models.Workbook or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`WorkbookErrorException` - """ - # 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'), - 'resourceName': self._serialize.url("resource_name", resource_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['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(workbook_properties, 'Workbook') - - # Construct and send request - request = self._client.patch(url, query_parameters) - response = self._client.send( - request, header_parameters, body_content, stream=False, **operation_config) - - if response.status_code not in [200]: - raise models.WorkbookErrorException(self._deserialize, response) - - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('Workbook', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroup/{resourceGroupName}/providers/microsoft.insights/workbooks/{resourceName}'} diff --git a/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/operations/workbooks_operations.py b/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/operations/workbooks_operations.py index 96a9f6b28f9d..294edd059bcd 100644 --- a/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/operations/workbooks_operations.py +++ b/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/operations/workbooks_operations.py @@ -58,27 +58,98 @@ def list_by_resource_group( deserialized response :param operation_config: :ref:`Operation configuration overrides`. - :return: Workbooks or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.applicationinsights.models.Workbooks or + :return: An iterator like instance of Workbook + :rtype: + ~azure.mgmt.applicationinsights.models.WorkbookPaged[~azure.mgmt.applicationinsights.models.Workbook] + :raises: + :class:`WorkbookErrorException` + """ + 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['category'] = self._serialize.query("category", category, 'str') + if tags is not None: + query_parameters['tags'] = self._serialize.query("tags", tags, '[str]', div=',') + if can_fetch_content is not None: + query_parameters['canFetchContent'] = self._serialize.query("can_fetch_content", can_fetch_content, 'bool') + 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['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 and send request + request = self._client.get(url, query_parameters) + response = self._client.send( + request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.WorkbookErrorException(self._deserialize, response) + + return response + + # Deserialize response + deserialized = models.WorkbookPaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.WorkbookPaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroup/{resourceGroupName}/providers/microsoft.insights/workbooks'} + + def get( + self, resource_group_name, resource_name, custom_headers=None, raw=False, **operation_config): + """Get a single workbook by its resourceName. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component + resource. + :type resource_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: Workbook or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.applicationinsights.models.Workbook or ~msrest.pipeline.ClientRawResponse :raises: :class:`WorkbookErrorException` """ # Construct URL - url = self.list_by_resource_group.metadata['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') + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str') } url = self._client.format_url(url, **path_format_arguments) # Construct parameters query_parameters = {} - query_parameters['category'] = self._serialize.query("category", category, 'str') - if tags is not None: - query_parameters['tags'] = self._serialize.query("tags", tags, '[str]', div=',') - if can_fetch_content is not None: - query_parameters['canFetchContent'] = self._serialize.query("can_fetch_content", can_fetch_content, 'bool') query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') # Construct headers @@ -101,11 +172,207 @@ def list_by_resource_group( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('Workbooks', response) + deserialized = self._deserialize('Workbook', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) return client_raw_response return deserialized - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroup/{resourceGroupName}/providers/microsoft.insights/workbooks'} + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroup/{resourceGroupName}/providers/microsoft.insights/workbooks/{resourceName}'} + + def delete( + self, resource_group_name, resource_name, custom_headers=None, raw=False, **operation_config): + """Delete a workbook. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component + resource. + :type resource_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:`WorkbookErrorException` + """ + # 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'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['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 and send request + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [201, 204]: + raise models.WorkbookErrorException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroup/{resourceGroupName}/providers/microsoft.insights/workbooks/{resourceName}'} + + def create_or_update( + self, resource_group_name, resource_name, workbook_properties, custom_headers=None, raw=False, **operation_config): + """Create a new workbook. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component + resource. + :type resource_name: str + :param workbook_properties: Properties that need to be specified to + create a new workbook. + :type workbook_properties: + ~azure.mgmt.applicationinsights.models.Workbook + :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: Workbook or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.applicationinsights.models.Workbook or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`WorkbookErrorException` + """ + # 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'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['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(workbook_properties, 'Workbook') + + # Construct and send request + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) + + if response.status_code not in [200, 201]: + raise models.WorkbookErrorException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('Workbook', response) + if response.status_code == 201: + deserialized = self._deserialize('Workbook', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroup/{resourceGroupName}/providers/microsoft.insights/workbooks/{resourceName}'} + + def update( + self, resource_group_name, resource_name, workbook_properties, custom_headers=None, raw=False, **operation_config): + """Updates a workbook that has already been added. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component + resource. + :type resource_name: str + :param workbook_properties: Properties that need to be specified to + create a new workbook. + :type workbook_properties: + ~azure.mgmt.applicationinsights.models.Workbook + :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: Workbook or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.applicationinsights.models.Workbook or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`WorkbookErrorException` + """ + # 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'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['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(workbook_properties, 'Workbook') + + # Construct and send request + request = self._client.patch(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.WorkbookErrorException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('Workbook', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroup/{resourceGroupName}/providers/microsoft.insights/workbooks/{resourceName}'} From 99765f2eaf935990bd769bfe3495e5ffc497061c Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Thu, 28 Jun 2018 22:11:53 +0000 Subject: [PATCH 2/2] Generated from 190ab39fd849acebb0ff3546dc03ee4de9b94c42 Using plural for operation group name consistently --- .../applicationinsights/models/__init__.py | 4 +++ .../models/annotation_paged.py | 27 +++++++++++++++++++ .../models/work_item_configuration_paged.py | 27 +++++++++++++++++++ .../operations/annotations_operations.py | 9 ++++--- .../work_item_configurations_operations.py | 8 +++--- 5 files changed, 67 insertions(+), 8 deletions(-) create mode 100644 azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/models/annotation_paged.py create mode 100644 azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/models/work_item_configuration_paged.py diff --git a/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/models/__init__.py b/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/models/__init__.py index 8f6e4cca097b..26f873dcb858 100644 --- a/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/models/__init__.py +++ b/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/models/__init__.py @@ -52,8 +52,10 @@ from .error_field_contract import ErrorFieldContract from .workbook_error import WorkbookError, WorkbookErrorException from .operation_paged import OperationPaged +from .annotation_paged import AnnotationPaged from .application_insights_component_api_key_paged import ApplicationInsightsComponentAPIKeyPaged from .application_insights_component_paged import ApplicationInsightsComponentPaged +from .work_item_configuration_paged import WorkItemConfigurationPaged from .application_insights_component_web_test_location_paged import ApplicationInsightsComponentWebTestLocationPaged from .web_test_paged import WebTestPaged from .workbook_paged import WorkbookPaged @@ -117,8 +119,10 @@ 'ErrorFieldContract', 'WorkbookError', 'WorkbookErrorException', 'OperationPaged', + 'AnnotationPaged', 'ApplicationInsightsComponentAPIKeyPaged', 'ApplicationInsightsComponentPaged', + 'WorkItemConfigurationPaged', 'ApplicationInsightsComponentWebTestLocationPaged', 'WebTestPaged', 'WorkbookPaged', diff --git a/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/models/annotation_paged.py b/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/models/annotation_paged.py new file mode 100644 index 000000000000..c9de7bcba53a --- /dev/null +++ b/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/models/annotation_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 AnnotationPaged(Paged): + """ + A paging container for iterating over a list of :class:`Annotation ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[Annotation]'} + } + + def __init__(self, *args, **kwargs): + + super(AnnotationPaged, self).__init__(*args, **kwargs) diff --git a/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/models/work_item_configuration_paged.py b/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/models/work_item_configuration_paged.py new file mode 100644 index 000000000000..6543cadd6a76 --- /dev/null +++ b/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/models/work_item_configuration_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 WorkItemConfigurationPaged(Paged): + """ + A paging container for iterating over a list of :class:`WorkItemConfiguration ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[WorkItemConfiguration]'} + } + + def __init__(self, *args, **kwargs): + + super(WorkItemConfigurationPaged, self).__init__(*args, **kwargs) diff --git a/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/operations/annotations_operations.py b/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/operations/annotations_operations.py index 525dc3cdae67..b22064ede510 100644 --- a/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/operations/annotations_operations.py +++ b/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/operations/annotations_operations.py @@ -56,8 +56,9 @@ def list( deserialized response :param operation_config: :ref:`Operation configuration overrides`. - :return: An iterator like instance of None - :rtype: list[~azure.mgmt.applicationinsights.models.Annotation][None] + :return: An iterator like instance of Annotation + :rtype: + ~azure.mgmt.applicationinsights.models.AnnotationPaged[~azure.mgmt.applicationinsights.models.Annotation] :raises: :class:`AnnotationErrorException` """ @@ -104,11 +105,11 @@ def internal_paging(next_link=None, raw=False): return response # Deserialize response - deserialized = models.list(internal_paging, self._deserialize.dependencies) + deserialized = models.AnnotationPaged(internal_paging, self._deserialize.dependencies) if raw: header_dict = {} - client_raw_response = models.list(internal_paging, self._deserialize.dependencies, header_dict) + client_raw_response = models.AnnotationPaged(internal_paging, self._deserialize.dependencies, header_dict) return client_raw_response return deserialized diff --git a/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/operations/work_item_configurations_operations.py b/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/operations/work_item_configurations_operations.py index 6000e78fca5c..42667b98d8db 100644 --- a/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/operations/work_item_configurations_operations.py +++ b/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/operations/work_item_configurations_operations.py @@ -51,9 +51,9 @@ def list( deserialized response :param operation_config: :ref:`Operation configuration overrides`. - :return: An iterator like instance of None + :return: An iterator like instance of WorkItemConfiguration :rtype: - list[~azure.mgmt.applicationinsights.models.WorkItemConfiguration][None] + ~azure.mgmt.applicationinsights.models.WorkItemConfigurationPaged[~azure.mgmt.applicationinsights.models.WorkItemConfiguration] :raises: :class:`WorkItemConfigurationErrorException` """ @@ -98,11 +98,11 @@ def internal_paging(next_link=None, raw=False): return response # Deserialize response - deserialized = models.list(internal_paging, self._deserialize.dependencies) + deserialized = models.WorkItemConfigurationPaged(internal_paging, self._deserialize.dependencies) if raw: header_dict = {} - client_raw_response = models.list(internal_paging, self._deserialize.dependencies, header_dict) + client_raw_response = models.WorkItemConfigurationPaged(internal_paging, self._deserialize.dependencies, header_dict) return client_raw_response return deserialized