clostack.client
A mostly generated wrapper to the CloudStack API.
async-request
(async-request client opcode handler)
(async-request {:keys [config opts]} opcode args handler)
Asynchronous request, will execute handler when response comes back.
http-client
(http-client)
(http-client {:keys [config opts], :or {opts {}}})
Create an HTTP client. Takes a map of two optional keys, if no configuration is present, it is picked up from the environment:
- :config a map of the following optional:
- :endpoint HTTP endpoint for the API
- :api-key
- :api-secret
- :request-method (:get or :post, default to :post)
- :page-size number of entities to fetch per page (500 per default)
- :opts: an opt map handed out to aleph’s http client
paging-request
(paging-request client op)
(paging-request client op args)
(paging-request client op args page width)
Perform a paging request. Elements are fetched by chunks of 500.
polling-request
(polling-request client jobid)
Perform a polling request, in a blocking fashion. Fetches are done every second.
request
(request client opcode)
(request client opcode args)
Perform a synchronous HTTP request against the API
with-response
macro
(with-response [sym client opcode args] & body)
Perform an asynchronous response, using body as the function body to execute.
wrap-body
(wrap-body body resp handler)
Ensure that response is JSON-formatted, if so parse it