class Etcd::Api
- Etcd::Api
- Reference
- Object
Defined in:
etcd/api.crConstant Summary
-
DEFAULT_HOST =
"localhost"
-
DEFAULT_PORT =
2379
-
DEFAULT_VERSION =
"v3"
Constructors
- .new(url : URI, api_version : String = DEFAULT_VERSION)
- .new(host : String = "localhost", port : Int32 | Nil = nil, api_version : String | Nil = nil)
Instance Method Summary
-
#api_version : String
API version
-
#api_version=(api_version : String)
API version
-
#connection : HTTP::Client
:no_doc: Underlying HTTP connection - exposed for access from test framework only.
-
#delete(path, headers : HTTP::Headers | Nil = nil, body : HTTP::Client::BodyType | Nil = nil)
Executes a DELETE request on the etcd client connection.
-
#delete(path, headers : HTTP::Headers | Nil = nil, body : HTTP::Client::BodyType = nil, &)
Executes a DELETE request and yields a
HTTP::Client::Response
. -
#delete(path, headers : HTTP::Headers, body = nil)
Executes a DELETE request on the etcd client connection with a JSON body formed from the passed
NamedTuple
... -
#delete(path, body = nil)
Executes a DELETE request on the etcd client connection with a JSON body formed from the passed
NamedTuple
... -
#delete(path, headers : HTTP::Headers, body : NamedTuple | Hash, &)
Executes a DELETE request on the etcd client connection with a JSON body formed from the passed
NamedTuple
and yields streamed response entries to the block. -
#delete(path, body : NamedTuple | Hash, &)
Executes a DELETE request on the etcd client connection with a JSON body formed from the passed
NamedTuple
and yields streamed response entries to the block. -
#get(path, headers : HTTP::Headers | Nil = nil, body : HTTP::Client::BodyType | Nil = nil)
Executes a GET request on the etcd client connection.
-
#get(path, headers : HTTP::Headers | Nil = nil, body : HTTP::Client::BodyType = nil, &)
Executes a GET request and yields a
HTTP::Client::Response
. -
#get(path, headers : HTTP::Headers, body = nil)
Executes a GET request on the etcd client connection with a JSON body formed from the passed
NamedTuple
... -
#get(path, body = nil)
Executes a GET request on the etcd client connection with a JSON body formed from the passed
NamedTuple
... -
#get(path, headers : HTTP::Headers, body : NamedTuple | Hash, &)
Executes a GET request on the etcd client connection with a JSON body formed from the passed
NamedTuple
and yields streamed response entries to the block. -
#get(path, body : NamedTuple | Hash, &)
Executes a GET request on the etcd client connection with a JSON body formed from the passed
NamedTuple
and yields streamed response entries to the block. - #host : String
- #port : Int32
-
#post(path, headers : HTTP::Headers | Nil = nil, body : HTTP::Client::BodyType | Nil = nil)
Executes a POST request on the etcd client connection.
-
#post(path, headers : HTTP::Headers | Nil = nil, body : HTTP::Client::BodyType = nil, &)
Executes a POST request and yields a
HTTP::Client::Response
. -
#post(path, headers : HTTP::Headers, body = nil)
Executes a POST request on the etcd client connection with a JSON body formed from the passed
NamedTuple
... -
#post(path, body = nil)
Executes a POST request on the etcd client connection with a JSON body formed from the passed
NamedTuple
... -
#post(path, headers : HTTP::Headers, body : NamedTuple | Hash, &)
Executes a POST request on the etcd client connection with a JSON body formed from the passed
NamedTuple
and yields streamed response entries to the block. -
#post(path, body : NamedTuple | Hash, &)
Executes a POST request on the etcd client connection with a JSON body formed from the passed
NamedTuple
and yields streamed response entries to the block. -
#put(path, headers : HTTP::Headers | Nil = nil, body : HTTP::Client::BodyType | Nil = nil)
Executes a PUT request on the etcd client connection.
-
#put(path, headers : HTTP::Headers | Nil = nil, body : HTTP::Client::BodyType = nil, &)
Executes a PUT request and yields a
HTTP::Client::Response
. -
#put(path, headers : HTTP::Headers, body = nil)
Executes a PUT request on the etcd client connection with a JSON body formed from the passed
NamedTuple
... -
#put(path, body = nil)
Executes a PUT request on the etcd client connection with a JSON body formed from the passed
NamedTuple
... -
#put(path, headers : HTTP::Headers, body : NamedTuple | Hash, &)
Executes a PUT request on the etcd client connection with a JSON body formed from the passed
NamedTuple
and yields streamed response entries to the block. -
#put(path, body : NamedTuple | Hash, &)
Executes a PUT request on the etcd client connection with a JSON body formed from the passed
NamedTuple
and yields streamed response entries to the block. -
#spawn_connection
TODO Add connection pooling.
- #token : String | Nil
- #url : URI | Nil
Constructor Detail
Instance Method Detail
:no_doc: Underlying HTTP connection - exposed for access from test framework only.
Executes a DELETE request on the etcd client connection.
The response status will be automatically checked and a Etcd::ApiError raised if unsuccessful.
Executes a DELETE request and yields a HTTP::Client::Response
.
When working with endpoint that provide stream responses these may be accessed as available
by calling #body_io
on the yielded response object.
The response status will be automatically checked and a etcd::ApiError raised if unsuccessful.
Executes a DELETE request on the etcd client connection with a JSON body
formed from the passed NamedTuple
... or a Hash
.
Executes a DELETE request on the etcd client connection with a JSON body
formed from the passed NamedTuple
... or a Hash
.
Executes a DELETE request on the etcd client connection with a JSON body
formed from the passed NamedTuple
and yields streamed response entries to the block.
Executes a DELETE request on the etcd client connection with a JSON body
formed from the passed NamedTuple
and yields streamed response entries to the block.
Executes a GET request on the etcd client connection.
The response status will be automatically checked and a Etcd::ApiError raised if unsuccessful.
Executes a GET request and yields a HTTP::Client::Response
.
When working with endpoint that provide stream responses these may be accessed as available
by calling #body_io
on the yielded response object.
The response status will be automatically checked and a etcd::ApiError raised if unsuccessful.
Executes a GET request on the etcd client connection with a JSON body
formed from the passed NamedTuple
... or a Hash
.
Executes a GET request on the etcd client connection with a JSON body
formed from the passed NamedTuple
... or a Hash
.
Executes a GET request on the etcd client connection with a JSON body
formed from the passed NamedTuple
and yields streamed response entries to the block.
Executes a GET request on the etcd client connection with a JSON body
formed from the passed NamedTuple
and yields streamed response entries to the block.
Executes a POST request on the etcd client connection.
The response status will be automatically checked and a Etcd::ApiError raised if unsuccessful.
Executes a POST request and yields a HTTP::Client::Response
.
When working with endpoint that provide stream responses these may be accessed as available
by calling #body_io
on the yielded response object.
The response status will be automatically checked and a etcd::ApiError raised if unsuccessful.
Executes a POST request on the etcd client connection with a JSON body
formed from the passed NamedTuple
... or a Hash
.
Executes a POST request on the etcd client connection with a JSON body
formed from the passed NamedTuple
... or a Hash
.
Executes a POST request on the etcd client connection with a JSON body
formed from the passed NamedTuple
and yields streamed response entries to the block.
Executes a POST request on the etcd client connection with a JSON body
formed from the passed NamedTuple
and yields streamed response entries to the block.
Executes a PUT request on the etcd client connection.
The response status will be automatically checked and a Etcd::ApiError raised if unsuccessful.
Executes a PUT request and yields a HTTP::Client::Response
.
When working with endpoint that provide stream responses these may be accessed as available
by calling #body_io
on the yielded response object.
The response status will be automatically checked and a etcd::ApiError raised if unsuccessful.
Executes a PUT request on the etcd client connection with a JSON body
formed from the passed NamedTuple
... or a Hash
.
Executes a PUT request on the etcd client connection with a JSON body
formed from the passed NamedTuple
... or a Hash
.
Executes a PUT request on the etcd client connection with a JSON body
formed from the passed NamedTuple
and yields streamed response entries to the block.
Executes a PUT request on the etcd client connection with a JSON body
formed from the passed NamedTuple
and yields streamed response entries to the block.
TODO Add connection pooling. Currently, there's contention on the http connection Better to lease connections from a pool, and use the sclient object This way, we can reuse the same infra around the connection