mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
add funcy/functions_go & update docker/distribution
This commit is contained in:
committed by
Travis Reeder
parent
452dc1ee86
commit
c9c7950d0f
57
vendor/github.com/funcy/functions_go/configuration.go
generated
vendored
Normal file
57
vendor/github.com/funcy/functions_go/configuration.go
generated
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
package functions
|
||||
|
||||
import (
|
||||
"encoding/base64"
|
||||
"net/http"
|
||||
"time"
|
||||
)
|
||||
|
||||
|
||||
type Configuration struct {
|
||||
UserName string `json:"userName,omitempty"`
|
||||
Password string `json:"password,omitempty"`
|
||||
APIKeyPrefix map[string]string `json:"APIKeyPrefix,omitempty"`
|
||||
APIKey map[string]string `json:"APIKey,omitempty"`
|
||||
Debug bool `json:"debug,omitempty"`
|
||||
DebugFile string `json:"debugFile,omitempty"`
|
||||
OAuthToken string `json:"oAuthToken,omitempty"`
|
||||
BasePath string `json:"basePath,omitempty"`
|
||||
Host string `json:"host,omitempty"`
|
||||
Scheme string `json:"scheme,omitempty"`
|
||||
AccessToken string `json:"accessToken,omitempty"`
|
||||
DefaultHeader map[string]string `json:"defaultHeader,omitempty"`
|
||||
UserAgent string `json:"userAgent,omitempty"`
|
||||
APIClient *APIClient
|
||||
Transport *http.Transport
|
||||
Timeout *time.Duration `json:"timeout,omitempty"`
|
||||
}
|
||||
|
||||
func NewConfiguration() *Configuration {
|
||||
cfg := &Configuration{
|
||||
BasePath: "https://127.0.0.1:8080/v1",
|
||||
DefaultHeader: make(map[string]string),
|
||||
APIKey: make(map[string]string),
|
||||
APIKeyPrefix: make(map[string]string),
|
||||
UserAgent: "Swagger-Codegen/0.1.28/go",
|
||||
APIClient: &APIClient{},
|
||||
}
|
||||
|
||||
cfg.APIClient.config = cfg
|
||||
return cfg
|
||||
}
|
||||
|
||||
func (c *Configuration) GetBasicAuthEncodedString() string {
|
||||
return base64.StdEncoding.EncodeToString([]byte(c.UserName + ":" + c.Password))
|
||||
}
|
||||
|
||||
func (c *Configuration) AddDefaultHeader(key string, value string) {
|
||||
c.DefaultHeader[key] = value
|
||||
}
|
||||
|
||||
func (c *Configuration) GetAPIKeyWithPrefix(APIKeyIdentifier string) string {
|
||||
if c.APIKeyPrefix[APIKeyIdentifier] != "" {
|
||||
return c.APIKeyPrefix[APIKeyIdentifier] + " " + c.APIKey[APIKeyIdentifier]
|
||||
}
|
||||
|
||||
return c.APIKey[APIKeyIdentifier]
|
||||
}
|
||||
Reference in New Issue
Block a user