@@ -192,4 +192,75 @@ def delete(self, stack_id: int) -> Optional[Dict[str, Any]]:
192192 return self .client ._request ("DELETE" , f"stacks/{ stack_id } " )
193193
194194
195+ class EnvironmentClient (SubClient ):
196+ """
197+ Client for managing Cycleops environments.
198+ """
199+
200+ def list (self ) -> Optional [Dict [str , Any ]]:
201+ return self .client ._request ("GET" , f"environments" )
202+
203+
204+ class HostClient (SubClient ):
205+ """
206+ Client for managing Cycleops hosts.
207+ """
208+
209+ def list (self ) -> Optional [Dict [str , Any ]]:
210+ return self .client ._request ("GET" , f"hosts" )
211+
212+ def retrieve (
213+ self , host_id : Optional [int ] = None , params : Optional [Dict [str , Any ]] = None
214+ ) -> Optional [Dict [str , Any ]]:
215+ if host_id :
216+ return self .client ._request ("GET" , f"hosts/{ host_id } " )
217+
218+ return self .client ._request ("GET" , f"hosts" , params = params )
219+
220+ def create (self , ** kwargs : Any ) -> Optional [Dict [str , Any ]]:
221+ payload : Dict [str , Any ] = {k : v for (k , v ) in kwargs .items () if v }
222+
223+ return self .client ._request ("POST" , "hosts" , payload )
224+
225+ def update (self , host_id : int , ** kwargs : Any ) -> Optional [Dict [str , Any ]]:
226+ payload : Dict [str , Any ] = {k : v for (k , v ) in kwargs .items () if v }
227+
228+ return self .client ._request ("PATCH" , f"hosts/{ host_id } " , payload )
229+
230+ def delete (self , host_id : int ) -> Optional [Dict [str , Any ]]:
231+ return self .client ._request ("DELETE" , f"hosts/{ host_id } " )
232+
233+
234+ class HostgroupClient (SubClient ):
235+ """
236+ Client for managing Cycleops hostgroups.
237+ """
238+
239+ def list (self ) -> Optional [Dict [str , Any ]]:
240+ return self .client ._request ("GET" , f"hostgroups" )
241+
242+ def retrieve (
243+ self ,
244+ hostgroup_id : Optional [int ] = None ,
245+ params : Optional [Dict [str , Any ]] = None ,
246+ ) -> Optional [Dict [str , Any ]]:
247+ if hostgroup_id :
248+ return self .client ._request ("GET" , f"hostgroups/{ hostgroup_id } " )
249+
250+ return self .client ._request ("GET" , f"hostgroups" , params = params )
251+
252+ def create (self , ** kwargs : Any ) -> Optional [Dict [str , Any ]]:
253+ payload : Dict [str , Any ] = {k : v for (k , v ) in kwargs .items () if v }
254+
255+ return self .client ._request ("POST" , "hostgroups" , payload )
256+
257+ def update (self , hostgroup_id : int , ** kwargs : Any ) -> Optional [Dict [str , Any ]]:
258+ payload : Dict [str , Any ] = {k : v for (k , v ) in kwargs .items () if v }
259+
260+ return self .client ._request ("PATCH" , f"hostgroups/{ hostgroup_id } " , payload )
261+
262+ def delete (self , hostgroup_id : int ) -> Optional [Dict [str , Any ]]:
263+ return self .client ._request ("DELETE" , f"hostgroups/{ hostgroup_id } " )
264+
265+
195266cycleops_client : Client = Client ()
0 commit comments