Module etcd-client.client.auth_http

HTTP client for etcd with authorization.

Instance methods

instance.request (self, location, req) Send the request to the specified location.
instance.stream (self, location) Create a stream to the specified location.
instance.close (self) Close a client.

Module functions

new (endpoint, name, password, opts) Create a new http client instance.


Instance methods

instance.request (self, location, req)

Send the request to the specified location.

Parameters:

  • self

    HTTP client instance.

  • location (string)

    A target location.

  • req (string)

    Request body.

Returns:

  1. true, response
  2. false, etcd-client.error.http.HttpError
  3. false, etcd-client.error.etcd.EtcdError.
instance.stream (self, location)

Create a stream to the specified location.

Parameters:

  • self

    HTTP client instance.

  • location (string)

    A target location.

Returns:

  1. true, etcd-client.client.jsstream instance
  2. false, etcd-client.error.http.HttpError
  3. false, etcd-client.error.etcd.EtcdError
instance.close (self)

Close a client.

Parameters:

  • self

    HTTP client instance.

Returns:

    nil

Module functions

new (endpoint, name, password, opts)

Create a new http client instance.

It's a wrapper around etcd-client.client.http with automatic authentification and re-authentification on token expire.

Parameters:

  • endpoint (string)

    An endpoint for requests.

  • name (string)

    User name.

  • password (string)

    User password.

  • opts (table)

    HTTP client options, see opts param at etcd-client.client.http.new.

Returns:

    http client instance