laceworksdk.api.v1.download_file
Lacework Download File API wrapper.
1# -*- coding: utf-8 -*- 2""" 3Lacework Download File API wrapper. 4""" 5 6import logging 7 8logger = logging.getLogger(__name__) 9 10 11class DownloadFileAPI: 12 """ 13 Lacework Download File API. 14 """ 15 16 def __init__(self, session): 17 """ 18 Initializes the DownloadFileAPI object. 19 20 :param session: An instance of the HttpSession class 21 22 :return DownloadFileAPI object. 23 """ 24 25 super().__init__() 26 27 self._session = session 28 29 def get(self, 30 file): 31 """ 32 A method to get the AWS CloudFormation template of the specified type. 33 34 :param file: a string representing which template to download. 35 ("aws-config" or "aws-cloudtrail") 36 37 :return response json 38 """ 39 40 logger.info("Getting AWS CloudFormation from Lacework...") 41 42 # Build the Download File request URI 43 api_uri = f"/api/v1/external/files/templates/{file}" 44 45 response = self._session.get(api_uri) 46 47 return response.json()
class
DownloadFileAPI:
12class DownloadFileAPI: 13 """ 14 Lacework Download File API. 15 """ 16 17 def __init__(self, session): 18 """ 19 Initializes the DownloadFileAPI object. 20 21 :param session: An instance of the HttpSession class 22 23 :return DownloadFileAPI object. 24 """ 25 26 super().__init__() 27 28 self._session = session 29 30 def get(self, 31 file): 32 """ 33 A method to get the AWS CloudFormation template of the specified type. 34 35 :param file: a string representing which template to download. 36 ("aws-config" or "aws-cloudtrail") 37 38 :return response json 39 """ 40 41 logger.info("Getting AWS CloudFormation from Lacework...") 42 43 # Build the Download File request URI 44 api_uri = f"/api/v1/external/files/templates/{file}" 45 46 response = self._session.get(api_uri) 47 48 return response.json()
Lacework Download File API.
DownloadFileAPI(session)
17 def __init__(self, session): 18 """ 19 Initializes the DownloadFileAPI object. 20 21 :param session: An instance of the HttpSession class 22 23 :return DownloadFileAPI object. 24 """ 25 26 super().__init__() 27 28 self._session = session
Initializes the DownloadFileAPI object.
Parameters
- session: An instance of the HttpSession class
:return DownloadFileAPI object.
def
get(self, file):
30 def get(self, 31 file): 32 """ 33 A method to get the AWS CloudFormation template of the specified type. 34 35 :param file: a string representing which template to download. 36 ("aws-config" or "aws-cloudtrail") 37 38 :return response json 39 """ 40 41 logger.info("Getting AWS CloudFormation from Lacework...") 42 43 # Build the Download File request URI 44 api_uri = f"/api/v1/external/files/templates/{file}" 45 46 response = self._session.get(api_uri) 47 48 return response.json()
A method to get the AWS CloudFormation template of the specified type.
Parameters
- file: a string representing which template to download. ("aws-config" or "aws-cloudtrail")
:return response json