forked from lacework/python-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample_compliance.py
More file actions
32 lines (22 loc) · 1.08 KB
/
example_compliance.py
File metadata and controls
32 lines (22 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# -*- coding: utf-8 -*-
"""
Example script showing how to use the LaceworkClient class.
"""
import logging
import os
from dotenv import load_dotenv
from laceworksdk import LaceworkClient
logging.basicConfig(level=logging.DEBUG)
load_dotenv()
if __name__ == "__main__":
# Use enviroment variables to instantiate a LaceworkClient instance
lacework_client = LaceworkClient(api_key=os.getenv("LW_API_KEY"),
api_secret=os.getenv("LW_API_SECRET"),
account=os.getenv("LW_ACCOUNT"))
# Compliance API
# Get latest compliance report in JSON format for AWS account
lacework_client.compliance.get_latest_aws_report(aws_account_id="123456789", file_format="json")
# Get latest compliance report in PDF format for AWS account
lacework_client.compliance.get_latest_aws_report(aws_account_id="123456789", file_format="pdf", pdf_path="<PATH_TO_PDF_OUTPUT>")
# Get a list of subscriptions for an Azure Tenant
lacework_client.compliance.list_azure_subscriptions("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx")