Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Azure
GitHub Repository: Azure/Azure-Sentinel-Notebooks
Path: blob/master/src/SentinelUtilities/SentinelAzure/azure_loganalytics_helper.py
3255 views
1
# -------------------------------------------------------------------------
2
# Copyright (c) Microsoft Corporation. All rights reserved.
3
# Licensed under the MIT License. See License.txt in the project root for
4
# license information.
5
# --------------------------------------------------------------------------
6
"""
7
Azure LogAnalytics Helper:
8
This module provides helper methods to initialize and
9
manipulate LogAnalyticsManagementClient object.
10
Workspace is the focal point.
11
"""
12
13
14
class LogAnalyticsHelper():
15
""" Helper class for Log Analytics """
16
17
def __init__(self, la_client):
18
self.la_client = la_client
19
20
def get_workspace_name_list(self):
21
""" retrieve L.A. workspace names as a list """
22
return sorted([ws.name for ws in self.la_client.workspaces.list()])
23
24
def get_workspace_id(self, workspace_name):
25
""" retrieve L.A. workspace id based on workspace name """
26
workspace = next(ws for ws in self.la_client.workspaces.list() if ws.name == workspace_name)
27
return workspace.customer_id
28
# end of the class
29
30