clostack.client

A mostly generated wrapper to the CloudStack API.

api-name

(api-name op)

Given a hyphenated name, yield a camel case one

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

http-get

(http-get uri opts params)

http-post

(http-post uri opts params)

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.

parse-body

(parse-body response)

polling-request

(polling-request client jobid)

Perform a polling request, in a blocking fashion. Fetches are done every second.

prepare-error-fn

(prepare-error-fn f)

request

(request client opcode)(request client opcode args)

Perform a synchronous HTTP request against the API

request-fn

(request-fn config)

request-fns

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