Path: blob/master/src/SentinelUtilities/SentinelAzure/azure_loganalytics_helper.py
3255 views
# -------------------------------------------------------------------------1# Copyright (c) Microsoft Corporation. All rights reserved.2# Licensed under the MIT License. See License.txt in the project root for3# license information.4# --------------------------------------------------------------------------5"""6Azure LogAnalytics Helper:7This module provides helper methods to initialize and8manipulate LogAnalyticsManagementClient object.9Workspace is the focal point.10"""111213class LogAnalyticsHelper():14""" Helper class for Log Analytics """1516def __init__(self, la_client):17self.la_client = la_client1819def get_workspace_name_list(self):20""" retrieve L.A. workspace names as a list """21return sorted([ws.name for ws in self.la_client.workspaces.list()])2223def get_workspace_id(self, workspace_name):24""" retrieve L.A. workspace id based on workspace name """25workspace = next(ws for ws in self.la_client.workspaces.list() if ws.name == workspace_name)26return workspace.customer_id27# end of the class282930