Commit Graph

27 Commits

Author SHA1 Message Date
Alex Munda
2bd2f586f4 Set/parse idempotency_token query param 2021-07-07 16:26:55 -05:00
Chris Baker
4e25e8e235 documenting test for #10301
enable -race detector for testing api
2021-04-06 17:31:29 +00:00
Conor Mongey
79a4895ad7 Revert "Headers -> Header"
This reverts commit 71396fa721945e55f51bc90ed02522936450209b.
2021-01-06 17:12:22 +00:00
Conor Mongey
c7cc71e2e0 Headers -> Header 2021-01-06 17:12:21 +00:00
Conor Mongey
679864ea05 Prefer http.Header over map[string]string to allow for multi-valued headers 2021-01-06 17:12:20 +00:00
Conor Mongey
3aadee8674 Allow setting of headers in api client 2021-01-06 17:03:58 +00:00
Benjamin Buzbee
648140a727 Add API support for cancelation contexts passed via QueryOptions and WriteOptions (#8836)
Copy Consul API's format: QueryOptions.WithContext(context) will now return
a new QueryOption whose HTTP requests will be canceled with the context
provided (and similar for WriteOptions)
2020-09-09 16:22:07 -04:00
Mahmood Ali
7f027a68ea api: avoid depending on helper internal package 2019-11-12 11:02:33 -05:00
Mahmood Ali
cbc155582a api: allow configuring http client
Allow clients to configure httpClient, e.g. set a pooled/keep-alive
client.

When caller configures HttpClient explicitly, we aim to use as-is; e.g.
we assume it's configured with TLS already.  Expose `ConfigureTLS` to
aid api consumers with configuring their http client.

Also, removes `SetTimeout` call that I believe is internal only and has
odd side-effects when called on already created config.  Also deprecates
`config.ConfigureTLS` in preference to the new `ConfigureTLS`.
2019-05-17 16:26:58 -04:00
Jeff Mitchell
5676986196 Divest api/ package of deps elsewhere in the nomad repo. (#5488)
* Divest api/ package of deps elsewhere in the nomad repo.

This will allow making api/ a module without then pulling in the
external repo, leading to a package name conflict.

This required some migration of tests to an apitests/ folder (can be
moved anywhere as it has no deps on it). It also required some
duplication of code, notably some test helpers from api/ -> apitests/
and part (but not all) of testutil/ -> api/testutil/.

Once there's more separation and an e.g. sdk/ folder those can be
removed in favor of a dep on the sdk/ folder, provided the sdk/ folder
doesn't depend on api/ or /.

* Also remove consul dep from api/ package

* Fix stupid linters

* Some restructuring
2019-03-29 14:47:40 -04:00
Alex Dadgar
4f2725bb98 Enhance API pkg to utilize Server's Client Tunnel
This PR enhances the API package by having client only RPCs route
through the server when they are low cost and for filesystem access to
first attempt a direct connection to the node and then falling back to
a server routed request.
2018-02-15 13:59:03 -08:00
Michael Schurter
fae8e7f699 SecretID -> AuthToken 2017-10-12 15:16:33 -07:00
Michael Schurter
04b8f8e7fc Remove structs import from api
Goes a step further and removes structs import from api's tests as well
by moving GenerateUUID to its own package.
2017-09-29 10:36:08 -07:00
Alex Dadgar
ac1539d5d9 Sync namespace changes 2017-09-07 17:04:21 -07:00
Armon Dadgar
d3a3575898 api: Adding support for ACL tokens 2017-09-04 13:09:34 -07:00
Alex Dadgar
4d3b75d867 Fix TLSServerName for Node API Client
This PR fixes the construction of the TLSServerName when connecting to a
node that has TLS enabled and adds tests for all possible permutations.

Fixes https://github.com/hashicorp/nomad/issues/3013
2017-08-29 11:11:19 -07:00
Alex Dadgar
a56f67b76d Parallel 2017-07-21 16:33:04 -07:00
Michael Schurter
2b7e091424 Fix API panic and bad missing port check
The format of the missing port error message changed from Go 1.7 to 1.8.
The fix is to just use strings.Contains instead of strings.HasPrefix
when looking for the "missing port" part.

Also add an error return to Client.newRequest as parsing the path
processes arbitrary user input and would panic if given an invalid URL.

See: https://groups.google.com/d/topic/nomad-tool/gi3-CTE7oXo/discussion
2017-02-20 11:12:34 -08:00
Kyle Havlovitz
145312c3ac Added NOMAD_HTTP_AUTH env var for basic auth 2016-08-17 15:13:35 -04:00
Diptanu Choudhury
938d512f49 Not running tests parallal 2016-08-11 21:53:27 -07:00
Chris Hines
79f1d76e92 Test request timing with a server slow enough to measure with low granularity system clocks. 2015-12-01 14:53:01 -05:00
Ryan Uber
3d8b115943 api: fixing join tests 2015-09-14 14:04:30 -07:00
Ryan Uber
7e26f938a2 command: use meta struct for common options 2015-09-14 13:24:03 -07:00
Ryan Uber
c5ab72acc2 api: run all tests in parallel 2015-09-13 12:17:08 -07:00
Ryan Uber
e2e1e4c3fb api: allow query parameters in query/write/delete 2015-09-08 14:26:26 -07:00
Ryan Uber
e0f9556590 api: add agent self call 2015-09-08 11:41:03 -07:00
Armon Dadgar
ddf83409f1 api: Adding basic skeleton 2015-09-06 13:29:51 -07:00