Agent API
This API allows you to enable/disable an agent. The api uses agent uuid to identify an agent. The agent uuid can be found in Go configuration xml.
Key
| URL format | HTTP Verb | Data | Explanation |
|---|---|---|---|
| http://[server]/go/api/agents/[agent-uuid]/enable | POST | no parameters | A disabled agent is enabled. A pending agent is approved. |
| http://[server]/go/api/agents/[agent-uuid]/disable | POST | no parameters | An enabled/pending agent is disabled. |
Examples
- We use curl, a command line tool for transferring files with URL syntax, in the following examples. Of course, you can use any HTTP client library.
- We assume that the URL of the Go server is http://goserver.com:8153/ .
- We assume security has been switched on, and that there is a user named jez with the password badger .
The configuration with agents like this:
<cruise>
....
<agents>
<agent hostname="agent-machine1" ipaddress="10.38.10.7" uuid="e4d86ae7-7b7d-4bb9-9b3e-876c06d01605" isDenied="true">
<resources>
<resource>twist</resource>
<resource>windows</resource>
</resources>
</agent>
<agent hostname="agent-machine2" ipaddress="10.2.12.26" uuid="bf0e5682-51ad-4183-8776-b13491cf2f59">
<resources>
<resource>ec2</resource>
</resources>
</agent>
<agent hostname="agent-machine3" ipaddress="10.2.12.26" uuid="259f7a6b-f386-4d10-bee3-28997678c05c"/>
<agent hostname="agent-machine3" ipaddress="10.18.3.152" uuid="098d4904-0533-4160-8c92-077849cd52df" />
</agents>
</cruise>
If you want enable agent on 'agent-machine1'
curl -u jez:badger -d "" http://goserver.com:8153/go/api/agents/e4d86ae7-7b7d-4bb9-9b3e-876c06d01605/enable
If you want disable agent on 'agent-machine2'
curl -u jez:badger -d "" http://goserver.com:8153/go/api/agents/bf0e5682-51ad-4183-8776-b13491cf2f59/disable