Module etcd-client.client.http

HTTP client for etcd.

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.api (self) Determinates and returns an api version of the endpoint.
instance.close (self) Close a client.

Module functions

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

Constansts

API_V3_ALPHA v3alpha
API_V3_BETA v3beta
API_V3 v3

Defaults

http_client_new_opts_default Default HTTP client instance options.
http_client_request_opts_default Default HTTP client request options.

HTTP options

http_client_new_opts HTTP client instance options.
http_client_request_opts HTTP client request options.


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.api (self)

Determinates and returns an api version of the endpoint.

It may return false and an error if unable to get an API version.

Parameters:

  • self

    HTTP client instance.

Returns:

  1. true, string
  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, opts)

Create a new http client instance.

Parameters:

Returns:

    http client instance.

Constansts

API_V3_ALPHA

v3alpha

API_V3_BETA

v3beta

API_V3

v3

Defaults

Default HTTP client instance options.

Just empty table at the moment.

Default HTTP client request options.

Enables keepalive_* options to enforce the HTTP client to hold connections for a while in order to reuse them for next requests.

Fields:

  • keepalive_idle = 60

  • keepalive_interval = 60

HTTP options

HTTP client instance options.

Available HTTP client parameters may vary depending on tarantool version. Refer to the HTTP client documentation for precise list of available options.

Fields:

  • max_connections (integer, optional)

    Maximum number of entries in the connection cache.

  • max_total_connections (integer, optional)

    Maximum number of active connections.

    XXX: verify descriptions XXX: defaults

HTTP client request options.

Available HTTP client parameters may vary depending on tarantool version. Refer to the HTTP client documentation for precise list of available options.

Fields:

  • ca_path (string, optional)

    A path to an SSL certificate directory.

  • ca_file (string, optional)

    A path to an SSL certificate file.

  • unix_socket (string, optional)

    A path to a Unix domain socket.

  • verify_host (boolean, optional)

    Whether to verify the certificate's name (CN) against host.

  • verify_peer (boolean, optional)

    Whether to verify the peer's SSL certificate.

  • ssl_key (string, optional)

    Set path to the file with a private key for a TLS and SSL client certificate.

  • ssl_cert (string, optional)

    Set path to the file with a SSL client certificate.

  • proxy (string, optional)

    Set a proxy to use.

  • proxy_port (integer, optional)

    Set a port number the proxy listens on.

  • proxy_user_pwd (string, optional)

    Set a user name and a password to use in authentication.

  • no_proxy (string, optional)

    Disable proxy use for specific hosts.

  • headers (table, optional)

    HTTP headers. A table with strings keys and values, where a key means an HTTP header name (a part before a colon) and a value is the part after the colon.

  • keepalive_idle (integer, optional)

    Amount of seconds the connection should be idle before the client will send a keepalive probe.

    Set it together with keepalive_interval, otherwise the option will be ignored.

  • keepalive_interval (integer, optional)

    Amount of seconds between keepalive probes.

    Set it together with keepalive_idle, otherwise the option will be ignored.

  • low_speed_time (integer, optional)

    An average transfer speed in bytes per second that the transfer should be below during low_speed_limit seconds to consider it to be too slow and abort.

  • low_speed_limit (integer, optional)

    See low_speed_time.

  • timeout (number, optional)

    Amount of seconds to wait for the response.

  • max_header_name_length (integer, optional)

    Maximum length of a HTTP header name (a part before a colon) in a response.

    A longer name is truncated.

  • verbose (boolean, optional)

    Whether to print debugging information to stderr.

  • interface (string, optional)

    Set network interface for outgoing connections.

    May be an interface name, an IP addres or a host name. See syntax in the libcurl documentation.

  • follow_location (boolean, optional)

    Whether to follow the 'Location' header that a server sends as part of an 3xx response.

  • accept_encoding (string, optional)

    Set a list of accepted encodings, e.g. 'deflate, gzip'. Enables automatic decompression of HTTP responses.

    Supported encodings are 'deflate' and 'gzip' (may vary depending on how tarantool is built). Use '' (an empty string) to enable all supported encodings.

    See more in the libcurl documentation.

    XXX: defaults where applicable