laceworksdk.api.v2.team_members

Lacework TeamMembers API wrapper.

  1# -*- coding: utf-8 -*-
  2"""
  3Lacework TeamMembers API wrapper.
  4"""
  5
  6from laceworksdk.api.crud_endpoint import CrudEndpoint
  7
  8
  9class TeamMembersAPI(CrudEndpoint):
 10
 11    def __init__(self, session):
 12        """
 13        Initializes the TeamMembersAPI object.
 14
 15        :param session: An instance of the HttpSession class
 16
 17        :return TeamMembersAPI object.
 18        """
 19
 20        super().__init__(session, "TeamMembers")
 21
 22    def create(self,
 23               user_name,
 24               user_enabled,
 25               props,
 26               org_admin=None,
 27               org_user=None,
 28               admin_role_accounts=None,
 29               user_role_accounts=None,
 30               **request_params):
 31        """
 32        A method to create a new TeamMembers object.
 33
 34        :param user_name: A string representing the email address of the user.
 35        :param user_enabled: A boolean/integer representing whether the object is enabled.
 36            (0 or 1)
 37        :param props: An object containing object configuration
 38            obj:
 39                :param firstName: The first name of the team member.
 40                :param lastName: The last name of the team member.
 41                :param company: The company of the team member.
 42                :param accountAdmin: A boolean representing if the team member is an account admin.
 43        :param org_admin: A boolean representing if the object is an organization admin.
 44            (Organization-level Access Required)
 45        :param org_user: A boolean representing if the object is an organization user.
 46            (Organization-level Access Required)
 47        :param admin_role_accounts: A list of strings representing accounts where the object is an admin.
 48            (Organization-level Access Required)
 49        :param user_role_accounts: A list of strings representing accounts where the object is a user.
 50            (Organization-level Access Required)
 51        :param request_params: Additional request parameters.
 52            (provides support for parameters that may be added in the future)
 53
 54        :return response json
 55        """
 56
 57        return super().create(
 58            user_name=user_name,
 59            user_enabled=int(bool(user_enabled)),
 60            props=props,
 61            org_admin=org_admin,
 62            org_user=org_user,
 63            admin_role_accounts=admin_role_accounts,
 64            user_role_accounts=user_role_accounts,
 65            **request_params
 66        )
 67
 68    def get(self, guid=None):
 69        """
 70        A method to get TeamMembers objects.
 71
 72        :param guid: A string representing the object GUID.
 73
 74        :return response json
 75        """
 76
 77        return super().get(id=guid)
 78
 79    def get_by_guid(self, guid):
 80        """
 81        A method to get a TeamMembers object by GUID.
 82
 83        :param guid: A string representing the object GUID.
 84
 85        :return response json
 86        """
 87
 88        return self.get(guid=guid)
 89
 90    def update(self,
 91               guid,
 92               user_name=None,
 93               user_enabled=None,
 94               props=None,
 95               org_admin=None,
 96               org_user=None,
 97               admin_role_accounts=None,
 98               user_role_accounts=None,
 99               **request_params):
100        """
101        A method to update a TeamMembers object.
102
103        :param guid: A string representing the object GUID.
104        :param user_name: A string representing the email address of the object.
105        :param user_enabled: A boolean/integer representing whether the object is enabled.
106            (0 or 1)
107        :param props: An object containing object configuration
108            obj:
109                :param firstName: The first name of the team member.
110                :param lastName: The last name of the team member.
111                :param company: The company of the team member.
112                :param accountAdmin: A boolean representing if the team member is an account admin.
113        :param org_admin: A boolean representing if the object is an organization admin.
114            (Organization-level Access Required)
115        :param org_user: A boolean representing if the object is an organization user.
116            (Organization-level Access Required)
117        :param admin_role_accounts: A list of strings representing accounts where the object is an admin.
118            (Organization-level Access Required)
119        :param user_role_accounts: A list of strings representing accounts where the object is a user.
120            (Organization-level Access Required)
121        :param request_params: Additional request parameters.
122            (provides support for parameters that may be added in the future)
123
124        :return response json
125        """
126
127        if user_enabled is not None:
128            user_enabled = int(bool(user_enabled))
129
130        return super().update(
131            id=guid,
132            user_name=user_name,
133            user_enabled=user_enabled,
134            props=props,
135            org_admin=org_admin,
136            org_user=org_user,
137            admin_role_accounts=admin_role_accounts,
138            user_role_accounts=user_role_accounts,
139            **request_params
140        )
141
142    def delete(self,
143               guid):
144        """
145        A method to delete a TeamMembers object.
146
147        :param guid: A string representing the object GUID.
148
149        :return response json
150        """
151
152        return super().delete(id=guid)
class TeamMembersAPI(laceworksdk.api.crud_endpoint.CrudEndpoint):
 10class TeamMembersAPI(CrudEndpoint):
 11
 12    def __init__(self, session):
 13        """
 14        Initializes the TeamMembersAPI object.
 15
 16        :param session: An instance of the HttpSession class
 17
 18        :return TeamMembersAPI object.
 19        """
 20
 21        super().__init__(session, "TeamMembers")
 22
 23    def create(self,
 24               user_name,
 25               user_enabled,
 26               props,
 27               org_admin=None,
 28               org_user=None,
 29               admin_role_accounts=None,
 30               user_role_accounts=None,
 31               **request_params):
 32        """
 33        A method to create a new TeamMembers object.
 34
 35        :param user_name: A string representing the email address of the user.
 36        :param user_enabled: A boolean/integer representing whether the object is enabled.
 37            (0 or 1)
 38        :param props: An object containing object configuration
 39            obj:
 40                :param firstName: The first name of the team member.
 41                :param lastName: The last name of the team member.
 42                :param company: The company of the team member.
 43                :param accountAdmin: A boolean representing if the team member is an account admin.
 44        :param org_admin: A boolean representing if the object is an organization admin.
 45            (Organization-level Access Required)
 46        :param org_user: A boolean representing if the object is an organization user.
 47            (Organization-level Access Required)
 48        :param admin_role_accounts: A list of strings representing accounts where the object is an admin.
 49            (Organization-level Access Required)
 50        :param user_role_accounts: A list of strings representing accounts where the object is a user.
 51            (Organization-level Access Required)
 52        :param request_params: Additional request parameters.
 53            (provides support for parameters that may be added in the future)
 54
 55        :return response json
 56        """
 57
 58        return super().create(
 59            user_name=user_name,
 60            user_enabled=int(bool(user_enabled)),
 61            props=props,
 62            org_admin=org_admin,
 63            org_user=org_user,
 64            admin_role_accounts=admin_role_accounts,
 65            user_role_accounts=user_role_accounts,
 66            **request_params
 67        )
 68
 69    def get(self, guid=None):
 70        """
 71        A method to get TeamMembers objects.
 72
 73        :param guid: A string representing the object GUID.
 74
 75        :return response json
 76        """
 77
 78        return super().get(id=guid)
 79
 80    def get_by_guid(self, guid):
 81        """
 82        A method to get a TeamMembers object by GUID.
 83
 84        :param guid: A string representing the object GUID.
 85
 86        :return response json
 87        """
 88
 89        return self.get(guid=guid)
 90
 91    def update(self,
 92               guid,
 93               user_name=None,
 94               user_enabled=None,
 95               props=None,
 96               org_admin=None,
 97               org_user=None,
 98               admin_role_accounts=None,
 99               user_role_accounts=None,
100               **request_params):
101        """
102        A method to update a TeamMembers object.
103
104        :param guid: A string representing the object GUID.
105        :param user_name: A string representing the email address of the object.
106        :param user_enabled: A boolean/integer representing whether the object is enabled.
107            (0 or 1)
108        :param props: An object containing object configuration
109            obj:
110                :param firstName: The first name of the team member.
111                :param lastName: The last name of the team member.
112                :param company: The company of the team member.
113                :param accountAdmin: A boolean representing if the team member is an account admin.
114        :param org_admin: A boolean representing if the object is an organization admin.
115            (Organization-level Access Required)
116        :param org_user: A boolean representing if the object is an organization user.
117            (Organization-level Access Required)
118        :param admin_role_accounts: A list of strings representing accounts where the object is an admin.
119            (Organization-level Access Required)
120        :param user_role_accounts: A list of strings representing accounts where the object is a user.
121            (Organization-level Access Required)
122        :param request_params: Additional request parameters.
123            (provides support for parameters that may be added in the future)
124
125        :return response json
126        """
127
128        if user_enabled is not None:
129            user_enabled = int(bool(user_enabled))
130
131        return super().update(
132            id=guid,
133            user_name=user_name,
134            user_enabled=user_enabled,
135            props=props,
136            org_admin=org_admin,
137            org_user=org_user,
138            admin_role_accounts=admin_role_accounts,
139            user_role_accounts=user_role_accounts,
140            **request_params
141        )
142
143    def delete(self,
144               guid):
145        """
146        A method to delete a TeamMembers object.
147
148        :param guid: A string representing the object GUID.
149
150        :return response json
151        """
152
153        return super().delete(id=guid)

A class used to implement CRUD create/read/update/delete functionality for Lacework API Endpoints

TeamMembersAPI(session)
12    def __init__(self, session):
13        """
14        Initializes the TeamMembersAPI object.
15
16        :param session: An instance of the HttpSession class
17
18        :return TeamMembersAPI object.
19        """
20
21        super().__init__(session, "TeamMembers")

Initializes the TeamMembersAPI object.

Parameters
  • session: An instance of the HttpSession class

:return TeamMembersAPI object.

def create( self, user_name, user_enabled, props, org_admin=None, org_user=None, admin_role_accounts=None, user_role_accounts=None, **request_params):
23    def create(self,
24               user_name,
25               user_enabled,
26               props,
27               org_admin=None,
28               org_user=None,
29               admin_role_accounts=None,
30               user_role_accounts=None,
31               **request_params):
32        """
33        A method to create a new TeamMembers object.
34
35        :param user_name: A string representing the email address of the user.
36        :param user_enabled: A boolean/integer representing whether the object is enabled.
37            (0 or 1)
38        :param props: An object containing object configuration
39            obj:
40                :param firstName: The first name of the team member.
41                :param lastName: The last name of the team member.
42                :param company: The company of the team member.
43                :param accountAdmin: A boolean representing if the team member is an account admin.
44        :param org_admin: A boolean representing if the object is an organization admin.
45            (Organization-level Access Required)
46        :param org_user: A boolean representing if the object is an organization user.
47            (Organization-level Access Required)
48        :param admin_role_accounts: A list of strings representing accounts where the object is an admin.
49            (Organization-level Access Required)
50        :param user_role_accounts: A list of strings representing accounts where the object is a user.
51            (Organization-level Access Required)
52        :param request_params: Additional request parameters.
53            (provides support for parameters that may be added in the future)
54
55        :return response json
56        """
57
58        return super().create(
59            user_name=user_name,
60            user_enabled=int(bool(user_enabled)),
61            props=props,
62            org_admin=org_admin,
63            org_user=org_user,
64            admin_role_accounts=admin_role_accounts,
65            user_role_accounts=user_role_accounts,
66            **request_params
67        )

A method to create a new TeamMembers object.

Parameters
  • user_name: A string representing the email address of the user.
  • user_enabled: A boolean/integer representing whether the object is enabled. (0 or 1)
  • props: An object containing object configuration obj: :param firstName: The first name of the team member. :param lastName: The last name of the team member. :param company: The company of the team member. :param accountAdmin: A boolean representing if the team member is an account admin.
  • org_admin: A boolean representing if the object is an organization admin. (Organization-level Access Required)
  • org_user: A boolean representing if the object is an organization user. (Organization-level Access Required)
  • admin_role_accounts: A list of strings representing accounts where the object is an admin. (Organization-level Access Required)
  • user_role_accounts: A list of strings representing accounts where the object is a user. (Organization-level Access Required)
  • request_params: Additional request parameters. (provides support for parameters that may be added in the future)

:return response json

def get(self, guid=None):
69    def get(self, guid=None):
70        """
71        A method to get TeamMembers objects.
72
73        :param guid: A string representing the object GUID.
74
75        :return response json
76        """
77
78        return super().get(id=guid)

A method to get TeamMembers objects.

Parameters
  • guid: A string representing the object GUID.

:return response json

def get_by_guid(self, guid):
80    def get_by_guid(self, guid):
81        """
82        A method to get a TeamMembers object by GUID.
83
84        :param guid: A string representing the object GUID.
85
86        :return response json
87        """
88
89        return self.get(guid=guid)

A method to get a TeamMembers object by GUID.

Parameters
  • guid: A string representing the object GUID.

:return response json

def update( self, guid, user_name=None, user_enabled=None, props=None, org_admin=None, org_user=None, admin_role_accounts=None, user_role_accounts=None, **request_params):
 91    def update(self,
 92               guid,
 93               user_name=None,
 94               user_enabled=None,
 95               props=None,
 96               org_admin=None,
 97               org_user=None,
 98               admin_role_accounts=None,
 99               user_role_accounts=None,
100               **request_params):
101        """
102        A method to update a TeamMembers object.
103
104        :param guid: A string representing the object GUID.
105        :param user_name: A string representing the email address of the object.
106        :param user_enabled: A boolean/integer representing whether the object is enabled.
107            (0 or 1)
108        :param props: An object containing object configuration
109            obj:
110                :param firstName: The first name of the team member.
111                :param lastName: The last name of the team member.
112                :param company: The company of the team member.
113                :param accountAdmin: A boolean representing if the team member is an account admin.
114        :param org_admin: A boolean representing if the object is an organization admin.
115            (Organization-level Access Required)
116        :param org_user: A boolean representing if the object is an organization user.
117            (Organization-level Access Required)
118        :param admin_role_accounts: A list of strings representing accounts where the object is an admin.
119            (Organization-level Access Required)
120        :param user_role_accounts: A list of strings representing accounts where the object is a user.
121            (Organization-level Access Required)
122        :param request_params: Additional request parameters.
123            (provides support for parameters that may be added in the future)
124
125        :return response json
126        """
127
128        if user_enabled is not None:
129            user_enabled = int(bool(user_enabled))
130
131        return super().update(
132            id=guid,
133            user_name=user_name,
134            user_enabled=user_enabled,
135            props=props,
136            org_admin=org_admin,
137            org_user=org_user,
138            admin_role_accounts=admin_role_accounts,
139            user_role_accounts=user_role_accounts,
140            **request_params
141        )

A method to update a TeamMembers object.

Parameters
  • guid: A string representing the object GUID.
  • user_name: A string representing the email address of the object.
  • user_enabled: A boolean/integer representing whether the object is enabled. (0 or 1)
  • props: An object containing object configuration obj: :param firstName: The first name of the team member. :param lastName: The last name of the team member. :param company: The company of the team member. :param accountAdmin: A boolean representing if the team member is an account admin.
  • org_admin: A boolean representing if the object is an organization admin. (Organization-level Access Required)
  • org_user: A boolean representing if the object is an organization user. (Organization-level Access Required)
  • admin_role_accounts: A list of strings representing accounts where the object is an admin. (Organization-level Access Required)
  • user_role_accounts: A list of strings representing accounts where the object is a user. (Organization-level Access Required)
  • request_params: Additional request parameters. (provides support for parameters that may be added in the future)

:return response json

def delete(self, guid):
143    def delete(self,
144               guid):
145        """
146        A method to delete a TeamMembers object.
147
148        :param guid: A string representing the object GUID.
149
150        :return response json
151        """
152
153        return super().delete(id=guid)

A method to delete a TeamMembers object.

Parameters
  • guid: A string representing the object GUID.

:return response json