k3s/vendor/github.com/Microsoft/hcsshim/internal/schema2/configuration.go

73 lines
2.1 KiB
Go
Raw Normal View History

2019-01-12 04:58:27 +00:00
/*
* HCS API
*
* No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
*
* API version: 2.1
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
package hcsschema
import (
"net/http"
)
// contextKeys are used to identify the type of value in the context.
// Since these are string, it is possible to get a short description of the
// context key for logging and debugging using key.String().
type contextKey string
func (c contextKey) String() string {
return "auth " + string(c)
}
var (
// ContextOAuth2 takes a oauth2.TokenSource as authentication for the request.
2019-09-30 23:25:17 +00:00
ContextOAuth2 = contextKey("token")
2019-01-12 04:58:27 +00:00
// ContextBasicAuth takes BasicAuth as authentication for the request.
2019-09-30 23:25:17 +00:00
ContextBasicAuth = contextKey("basic")
2019-01-12 04:58:27 +00:00
// ContextAccessToken takes a string oauth2 access token as authentication for the request.
2019-09-30 23:25:17 +00:00
ContextAccessToken = contextKey("accesstoken")
2019-01-12 04:58:27 +00:00
// ContextAPIKey takes an APIKey as authentication for the request
2019-09-30 23:25:17 +00:00
ContextAPIKey = contextKey("apikey")
2019-01-12 04:58:27 +00:00
)
2019-09-30 23:25:17 +00:00
// BasicAuth provides basic http authentication to a request passed via context using ContextBasicAuth
2019-01-12 04:58:27 +00:00
type BasicAuth struct {
2019-09-30 23:25:17 +00:00
UserName string `json:"userName,omitempty"`
Password string `json:"password,omitempty"`
2019-01-12 04:58:27 +00:00
}
// APIKey provides API key based authentication to a request passed via context using ContextAPIKey
type APIKey struct {
2019-09-30 23:25:17 +00:00
Key string
Prefix string
2019-01-12 04:58:27 +00:00
}
type Configuration struct {
2019-09-30 23:25:17 +00:00
BasePath string `json:"basePath,omitempty"`
Host string `json:"host,omitempty"`
Scheme string `json:"scheme,omitempty"`
DefaultHeader map[string]string `json:"defaultHeader,omitempty"`
UserAgent string `json:"userAgent,omitempty"`
HTTPClient *http.Client
2019-01-12 04:58:27 +00:00
}
func NewConfiguration() *Configuration {
cfg := &Configuration{
BasePath: "https://localhost",
DefaultHeader: make(map[string]string),
UserAgent: "Swagger-Codegen/2.1.0/go",
}
return cfg
}
func (c *Configuration) AddDefaultHeader(key string, value string) {
c.DefaultHeader[key] = value
2019-09-30 23:25:17 +00:00
}