c-go: Use http Etag cache

Add a new command-line cachedir flag to specify where to store the http
cache responses. This cache will only be used for OpenAPI Swagger spec
for now (as this is the only end-point that returns an ETag).

Kubernetes-commit: d7bba25d4a42f346f1963c86fc0dab43aa4f242e
This commit is contained in:
Antoine Pelisse
2017-06-09 10:30:47 -07:00
committed by Kubernetes Publisher
parent 9d2814a37f
commit d7f469601f
8 changed files with 43 additions and 0 deletions

View File

@@ -71,6 +71,10 @@ type Config struct {
// TODO: demonstrate an OAuth2 compatible client.
BearerToken string
// CacheDir is the directory where we'll store HTTP cached responses.
// If set to empty string, no caching mechanism will be used.
CacheDir string
// Impersonate is the configuration that RESTClient will use for impersonation.
Impersonate ImpersonationConfig

View File

@@ -249,6 +249,7 @@ func TestAnonymousConfig(t *testing.T) {
expected.BearerToken = ""
expected.Username = ""
expected.Password = ""
expected.CacheDir = ""
expected.AuthProvider = nil
expected.AuthConfigPersister = nil
expected.TLSClientConfig.CertData = nil

View File

@@ -89,6 +89,7 @@ func (c *Config) TransportConfig() (*transport.Config, error) {
},
Username: c.Username,
Password: c.Password,
CacheDir: c.CacheDir,
BearerToken: c.BearerToken,
Impersonate: transport.ImpersonationConfig{
UserName: c.Impersonate.UserName,