laceworksdk.api.v2.agent_access_tokens
Lacework AgentAccessTokens API wrapper.
1# -*- coding: utf-8 -*- 2""" 3Lacework AgentAccessTokens API wrapper. 4""" 5 6from laceworksdk.api.crud_endpoint import CrudEndpoint 7 8 9class AgentAccessTokensAPI(CrudEndpoint): 10 11 def __init__(self, session): 12 """ 13 Initializes the AgentAccessTokensAPI object. 14 15 :param session: An instance of the HttpSession class 16 17 :return AgentAccessTokensAPI object. 18 """ 19 20 super().__init__(session, "AgentAccessTokens") 21 22 def create(self, 23 alias=None, 24 enabled=True, 25 **request_params): 26 """ 27 A method to create a new AgentAccessTokens object. 28 29 :param alias: A string representing the object alias. 30 :param enabled: A boolean/integer representing whether the object is enabled. 31 (0 or 1) 32 :param request_params: Additional request parameters. 33 (provides support for parameters that may be added in the future) 34 35 :return response json 36 """ 37 38 return super().create( 39 token_alias=alias, 40 token_enabled=int(bool(enabled)), 41 **request_params 42 ) 43 44 def get_by_id(self, 45 id): 46 """ 47 A method to get an AgentAccessTokens object by ID. 48 49 :param id: A string representing the object ID. 50 51 :return response json 52 """ 53 54 return self.get(id=id) 55 56 def update(self, 57 id, 58 token_enabled=None, 59 **request_params): 60 """ 61 A method to update an AgentAccessTokens object. 62 63 :param id: A string representing the object ID. 64 :param alias: A string representing the object alias. 65 :param enabled: A boolean/integer representing whether the object is enabled. 66 (0 or 1) 67 :param request_params: Additional request parameters. 68 (provides support for parameters that may be added in the future) 69 70 :return response json 71 """ 72 73 if token_enabled is not None: 74 token_enabled = int(bool(token_enabled)) 75 76 return super().update( 77 id=id, 78 token_enabled=token_enabled, 79 **request_params 80 ) 81 82 def delete(self): 83 """ 84 A method to 'pass' when attempting to delete an AgentAccessToken object. 85 86 Lacework does not currently allow for agent access tokens to be deleted. 87 """
10class AgentAccessTokensAPI(CrudEndpoint): 11 12 def __init__(self, session): 13 """ 14 Initializes the AgentAccessTokensAPI object. 15 16 :param session: An instance of the HttpSession class 17 18 :return AgentAccessTokensAPI object. 19 """ 20 21 super().__init__(session, "AgentAccessTokens") 22 23 def create(self, 24 alias=None, 25 enabled=True, 26 **request_params): 27 """ 28 A method to create a new AgentAccessTokens object. 29 30 :param alias: A string representing the object alias. 31 :param enabled: A boolean/integer representing whether the object is enabled. 32 (0 or 1) 33 :param request_params: Additional request parameters. 34 (provides support for parameters that may be added in the future) 35 36 :return response json 37 """ 38 39 return super().create( 40 token_alias=alias, 41 token_enabled=int(bool(enabled)), 42 **request_params 43 ) 44 45 def get_by_id(self, 46 id): 47 """ 48 A method to get an AgentAccessTokens object by ID. 49 50 :param id: A string representing the object ID. 51 52 :return response json 53 """ 54 55 return self.get(id=id) 56 57 def update(self, 58 id, 59 token_enabled=None, 60 **request_params): 61 """ 62 A method to update an AgentAccessTokens object. 63 64 :param id: A string representing the object ID. 65 :param alias: A string representing the object alias. 66 :param enabled: A boolean/integer representing whether the object is enabled. 67 (0 or 1) 68 :param request_params: Additional request parameters. 69 (provides support for parameters that may be added in the future) 70 71 :return response json 72 """ 73 74 if token_enabled is not None: 75 token_enabled = int(bool(token_enabled)) 76 77 return super().update( 78 id=id, 79 token_enabled=token_enabled, 80 **request_params 81 ) 82 83 def delete(self): 84 """ 85 A method to 'pass' when attempting to delete an AgentAccessToken object. 86 87 Lacework does not currently allow for agent access tokens to be deleted. 88 """
A class used to implement CRUD create/read/update/delete functionality for Lacework API Endpoints
AgentAccessTokensAPI(session)
12 def __init__(self, session): 13 """ 14 Initializes the AgentAccessTokensAPI object. 15 16 :param session: An instance of the HttpSession class 17 18 :return AgentAccessTokensAPI object. 19 """ 20 21 super().__init__(session, "AgentAccessTokens")
Initializes the AgentAccessTokensAPI object.
Parameters
- session: An instance of the HttpSession class
:return AgentAccessTokensAPI object.
def
create(self, alias=None, enabled=True, **request_params):
23 def create(self, 24 alias=None, 25 enabled=True, 26 **request_params): 27 """ 28 A method to create a new AgentAccessTokens object. 29 30 :param alias: A string representing the object alias. 31 :param enabled: A boolean/integer representing whether the object is enabled. 32 (0 or 1) 33 :param request_params: Additional request parameters. 34 (provides support for parameters that may be added in the future) 35 36 :return response json 37 """ 38 39 return super().create( 40 token_alias=alias, 41 token_enabled=int(bool(enabled)), 42 **request_params 43 )
A method to create a new AgentAccessTokens object.
Parameters
- alias: A string representing the object alias.
- enabled: A boolean/integer representing whether the object is enabled. (0 or 1)
- request_params: Additional request parameters. (provides support for parameters that may be added in the future)
:return response json
def
get_by_id(self, id):
45 def get_by_id(self, 46 id): 47 """ 48 A method to get an AgentAccessTokens object by ID. 49 50 :param id: A string representing the object ID. 51 52 :return response json 53 """ 54 55 return self.get(id=id)
A method to get an AgentAccessTokens object by ID.
Parameters
- id: A string representing the object ID.
:return response json
def
update(self, id, token_enabled=None, **request_params):
57 def update(self, 58 id, 59 token_enabled=None, 60 **request_params): 61 """ 62 A method to update an AgentAccessTokens object. 63 64 :param id: A string representing the object ID. 65 :param alias: A string representing the object alias. 66 :param enabled: A boolean/integer representing whether the object is enabled. 67 (0 or 1) 68 :param request_params: Additional request parameters. 69 (provides support for parameters that may be added in the future) 70 71 :return response json 72 """ 73 74 if token_enabled is not None: 75 token_enabled = int(bool(token_enabled)) 76 77 return super().update( 78 id=id, 79 token_enabled=token_enabled, 80 **request_params 81 )
A method to update an AgentAccessTokens object.
Parameters
- id: A string representing the object ID.
- alias: A string representing the object alias.
- enabled: A boolean/integer representing whether the object is enabled. (0 or 1)
- request_params: Additional request parameters. (provides support for parameters that may be added in the future)
:return response json
def
delete(self):
83 def delete(self): 84 """ 85 A method to 'pass' when attempting to delete an AgentAccessToken object. 86 87 Lacework does not currently allow for agent access tokens to be deleted. 88 """
A method to 'pass' when attempting to delete an AgentAccessToken object.
Lacework does not currently allow for agent access tokens to be deleted.