@@ -97,3 +97,76 @@ def get(
9797 {"securityPolicyRules" : {}, "success" : False , "status" : response .status_code , "message" : error_message }
9898 )
9999 return {}
100+
101+ def integration_events (self , org_slug : str , integration_id : str ) -> dict :
102+ """Get integration events for a specific integration.
103+
104+ Args:
105+ org_slug: Organization slug
106+ integration_id: Integration ID
107+ """
108+ path = f"orgs/{ org_slug } /settings/integrations/{ integration_id } "
109+ response = self .api .do_request (path = path )
110+
111+ if response .status_code == 200 :
112+ return response .json ()
113+
114+ error_message = response .json ().get ("error" , {}).get ("message" , "Unknown error" )
115+ log .error (f"Error getting integration events: { response .status_code } , message: { error_message } " )
116+ return {}
117+
118+ def get_license_policy (self , org_slug : str ) -> dict :
119+ """Get license policy settings for an organization.
120+
121+ Args:
122+ org_slug: Organization slug
123+ """
124+ path = f"orgs/{ org_slug } /settings/license-policy"
125+ response = self .api .do_request (path = path )
126+
127+ if response .status_code == 200 :
128+ return response .json ()
129+
130+ error_message = response .json ().get ("error" , {}).get ("message" , "Unknown error" )
131+ log .error (f"Error getting license policy: { response .status_code } , message: { error_message } " )
132+ return {}
133+
134+ def update_security_policy (self , org_slug : str , body : dict , custom_rules_only : bool = False ) -> dict :
135+ """Update security policy settings for an organization.
136+
137+ Args:
138+ org_slug: Organization slug
139+ body: Security policy configuration to update
140+ custom_rules_only: Optional flag to update only custom rules
141+ """
142+ path = f"orgs/{ org_slug } /settings/security-policy"
143+ if custom_rules_only :
144+ path += "?custom_rules_only=true"
145+
146+ response = self .api .do_request (path = path , method = "POST" , payload = body )
147+
148+ if response .status_code == 200 :
149+ return response .json ()
150+
151+ error_message = response .json ().get ("error" , {}).get ("message" , "Unknown error" )
152+ log .error (f"Error updating security policy: { response .status_code } , message: { error_message } " )
153+ return {}
154+
155+ def update_license_policy (self , org_slug : str , body : dict , merge_update : bool = False ) -> dict :
156+ """Update license policy settings for an organization.
157+
158+ Args:
159+ org_slug: Organization slug
160+ body: License policy configuration to update
161+ merge_update: Optional flag to merge updates instead of replacing (defaults to False)
162+ """
163+ path = f"orgs/{ org_slug } /settings/license-policy?merge_update={ str (merge_update ).lower ()} "
164+
165+ response = self .api .do_request (path = path , method = "POST" , payload = body )
166+
167+ if response .status_code == 200 :
168+ return response .json ()
169+
170+ error_message = response .json ().get ("error" , {}).get ("message" , "Unknown error" )
171+ log .error (f"Error updating license policy: { response .status_code } , message: { error_message } " )
172+ return {}
0 commit comments