Commit Graph

7 Commits

Author SHA1 Message Date
Sebastiaan van Stijn 28d7dba41d
Merge pull request #39032 from thaJeztah/improve_version_negotiation
Add client.WithAPIVersionNegotiation() option
2019-04-20 13:34:22 +02:00
Sebastiaan van Stijn 44982c775e
Add client.WithTimeout() option
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-04-11 13:35:48 +02:00
Sebastiaan van Stijn b26aa97914
Add client.WithAPIVersionNegotiation() option
WithAPIVersionNegotiation enables automatic API version negotiation for the client.

With this option enabled, the client automatically negotiates the API version
to use when making requests. API version negotiation is performed on the first
request; subsequent requests will not re-negotiate.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-04-10 19:23:47 +02:00
Sebastiaan van Stijn 0041e2419a
Fix empty WithVersion blocking version negotiation
commit 3d72963ab8 fixed
situations where a version negotiation could override
the version, even though a client was initialized with a
fixed version.

In situations where the "fixed" version is empty, we
should ignore the option, and treat the client as
"not having a fixed version", so that API version
negotiation can still be performed.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-04-10 11:14:37 +02:00
Sebastiaan van Stijn e6c0d19c3a
client: define "Opt" type
Minor improvement, but makes defining a list of options
a bit cleaner, and more descriptive;

Before:

    opts := make([]func(*client.Client) error, 0)

After:

    opts := make([]client.Opt, 0)

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-04-10 01:23:45 +02:00
Sebastiaan van Stijn 3d72963ab8
Fix client version not being pinned when set
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-03-20 10:46:36 +01:00
Sebastiaan van Stijn 01eb35bfb3
Move client-opts to a separate file
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-01-21 14:52:46 +01:00