@@ -357,7 +357,7 @@ def results(
357
357
elements_key = "results" ,
358
358
element_key = "result" ,
359
359
label = label ,
360
- ** params
360
+ ** params ,
361
361
)
362
362
363
363
def latest_results (
@@ -763,8 +763,74 @@ def get_build_queue(self, expand="queuedBuilds"):
763
763
def server_info (self ):
764
764
return self .get (self .resource_url ("info" ))
765
765
766
- def agent_status (self ):
767
- return self .get (self .resource_url ("agent" ))
766
+ def agent_status (self , online = False ):
767
+ """
768
+ Provides a list of all agents.
769
+
770
+ :param online: filter only online agents (default False = all)
771
+ :return:
772
+ """
773
+ return self .get (self .resource_url ("agent" ), params = {"online" : online })
774
+
775
+ def agent_is_online (self , agent_id ):
776
+ """
777
+ Get agent online status.
778
+
779
+ :param agent_id: Bamboo agent ID (integer number)
780
+ :return: True/False
781
+ """
782
+ response = self .get (self .resource_url (f"agent/{ agent_id } /status" ))
783
+ return response ["online" ]
784
+
785
+ def agent_enable (self , agent_id ):
786
+ """
787
+ Enable agent
788
+
789
+ :param agent_id: Bamboo agent ID (integer number)
790
+ :return: None
791
+ """
792
+ self .put (self .resource_url (f"agent/{ agent_id } /enable" ))
793
+
794
+ def agent_disable (self , agent_id ):
795
+ """
796
+ Disable agent
797
+
798
+ :param agent_id: Bamboo agent ID (integer number)
799
+ :return: None
800
+ """
801
+ self .put (self .resource_url (f"agent/{ agent_id } /disable" ))
802
+
803
+ def agent_remote (self , online = False ):
804
+ """
805
+ Provides a list of all agent authentication statuses.
806
+
807
+ :param online: list only online agents (default False = all)
808
+ :return: list of agent-describing dictionaries
809
+ """
810
+ return self .get (self .resource_url ("agent/remote" ), params = {"online" : online })
811
+
812
+ def agent_details (self , agent_id , expand = None ):
813
+ """
814
+ Provides details of an agent with given id.
815
+
816
+ :param agent_id: Bamboo agent ID (integer number)
817
+ :param expand: Expand fields (None, capabilities, executableEnvironments, executableJobs)
818
+ :return:
819
+ """
820
+ params = None
821
+ if expand :
822
+ params = {"expand" : expand }
823
+ return self .get (self .resource_url (f"agent/{ agent_id } " ), params = params )
824
+
825
+ def agent_capabilities (self , agent_id , include_shared = True ):
826
+ """
827
+ List agent's capabilities.
828
+
829
+ :param agent_id: Bamboo agent ID (integer number)
830
+ :param include_shared: Include shared capabilities
831
+ :return: agents
832
+ """
833
+ return self .get (self .resource_url (f"agent/{ agent_id } /capability" ), params = {"includeShared" : include_shared })
768
834
769
835
def activity (self ):
770
836
return self .get ("build/admin/ajax/getDashboardSummary.action" )
0 commit comments