Documentation
¶
Index ¶
- Constants
- Variables
- func GetRequestScope(r *http.Request) map[string]string
- func ScopeFromHeaders(headers http.Header) map[string]string
- func SendErrorResponse(w http.ResponseWriter, code int, body string)
- func SendJSONResponse(w http.ResponseWriter, resp string)
- func SendResponse(w http.ResponseWriter, r *http.Request, resp KeyResponse)
- func SendTEXTResponse(w http.ResponseWriter, resp string)
- func TypeToString(keytype int) string
- type ConfMgr
- func (c *ConfMgr) ClientHandler(inner http.Handler, name string) http.HandlerFunc
- func (c *ConfMgr) ExistingKeys(key string, wantedType int, scope map[string]string, b backend.ConfigBackend) []string
- func (c *ConfMgr) HandleAdminGetHashField(w http.ResponseWriter, r *http.Request, b backend.ConfigBackend)
- func (c *ConfMgr) HandleAdminGetKeyType(w http.ResponseWriter, r *http.Request, b backend.ConfigBackend)
- func (c *ConfMgr) HandleAdminGetListIndex(w http.ResponseWriter, r *http.Request, b backend.ConfigBackend)
- func (c *ConfMgr) HandleAdminKeyDelete(w http.ResponseWriter, r *http.Request, b backend.ConfigBackend)
- func (c *ConfMgr) HandleAdminKeyGet(w http.ResponseWriter, r *http.Request, b backend.ConfigBackend)
- func (c *ConfMgr) HandleAdminKeyStore(w http.ResponseWriter, r *http.Request, b backend.ConfigBackend)
- func (c *ConfMgr) HandleAdminListAppend(w http.ResponseWriter, r *http.Request, b backend.ConfigBackend)
- func (c *ConfMgr) HandleAdminListHashFields(w http.ResponseWriter, r *http.Request, b backend.ConfigBackend)
- func (c *ConfMgr) HandleAdminListKeys(w http.ResponseWriter, r *http.Request, b backend.ConfigBackend)
- func (c *ConfMgr) HandleAdminListKeysFiltered(w http.ResponseWriter, r *http.Request, b backend.ConfigBackend)
- func (c *ConfMgr) HandleAdminSetHashField(w http.ResponseWriter, r *http.Request, b backend.ConfigBackend)
- func (c *ConfMgr) HandleLookupHash(w http.ResponseWriter, r *http.Request, b backend.ConfigBackend)
- func (c *ConfMgr) HandleLookupHashField(w http.ResponseWriter, r *http.Request, b backend.ConfigBackend)
- func (c *ConfMgr) HandleLookupList(w http.ResponseWriter, r *http.Request, b backend.ConfigBackend)
- func (c *ConfMgr) HandleLookupListIndex(w http.ResponseWriter, r *http.Request, b backend.ConfigBackend)
- func (c *ConfMgr) HandleLookupString(w http.ResponseWriter, r *http.Request, b backend.ConfigBackend)
- func (c *ConfMgr) Index(w http.ResponseWriter, r *http.Request, b backend.ConfigBackend)
- func (c *ConfMgr) ListAppendFromJSON(keyName string, jsondata []byte, b backend.ConfigBackend) error
- func (c *ConfMgr) ListKeys(filter string, b backend.ConfigBackend) (ListKeyResponse, error)
- func (c *ConfMgr) LookupHash(keyName string, scope map[string]string, b backend.ConfigBackend) (LookupHashResponse, error)
- func (c *ConfMgr) LookupHashField(keyName string, fieldName string, scope map[string]string, ...) (LookupStringResponse, error)
- func (c *ConfMgr) LookupHashFieldByString(searchString string, scope map[string]string, b backend.ConfigBackend) (string, error)
- func (c *ConfMgr) LookupList(keyName string, scope map[string]string, b backend.ConfigBackend) (LookupListResponse, error)
- func (c *ConfMgr) LookupListIndex(keyName string, listIndex int64, scope map[string]string, ...) (LookupStringResponse, error)
- func (c *ConfMgr) LookupListIndexByString(searchString string, scope map[string]string, b backend.ConfigBackend) (string, error)
- func (c *ConfMgr) LookupString(keyName string, scope map[string]string, b backend.ConfigBackend) (LookupStringResponse, error)
- func (c *ConfMgr) LookupStringByString(searchString string, scope map[string]string, b backend.ConfigBackend) (string, error)
- func (c *ConfMgr) NewRouter() *mux.Router
- func (c *ConfMgr) RouteDefinitions() Routes
- func (c *ConfMgr) Run()
- func (c *ConfMgr) SaveKeyFromJSON(keyName string, jsondata []byte, b backend.ConfigBackend) error
- func (c *ConfMgr) SearchPaths(reqscope map[string]string) []string
- func (c *ConfMgr) SetHashFieldFromJSON(keyName string, fieldName string, jsondata []byte, b backend.ConfigBackend) error
- func (c *ConfMgr) SetRequestScopeFromHeaders(headers http.Header)
- func (c *ConfMgr) StoreHash(keyName string, data HashKeyResponse, b backend.ConfigBackend) error
- func (c *ConfMgr) StoreList(keyName string, data ListKeyResponse, b backend.ConfigBackend) error
- func (c *ConfMgr) StoreString(keyName string, data StringKeyResponse, b backend.ConfigBackend) error
- func (c *ConfMgr) SubstituteValues(input string, scope map[string]string, b backend.ConfigBackend) (string, error)
- type DataRequest
- type GenericRequest
- type HandlerFuncBackend
- type HashKeyResponse
- type KeyResponse
- type ListKeyResponse
- type LookupHashResponse
- type LookupListResponse
- type LookupStringResponse
- type Route
- type Routes
- type StringKeyResponse
- type ValueSource
Constants ¶
View Source
const ReqScope = 0
Variables ¶
View Source
var (
BackendFactory backend.ConfigBackendFactory
)
Functions ¶
func SendErrorResponse ¶
func SendErrorResponse(w http.ResponseWriter, code int, body string)
func SendJSONResponse ¶
func SendJSONResponse(w http.ResponseWriter, resp string)
func SendResponse ¶
func SendResponse(w http.ResponseWriter, r *http.Request, resp KeyResponse)
func SendTEXTResponse ¶
func SendTEXTResponse(w http.ResponseWriter, resp string)
func TypeToString ¶
Types ¶
type ConfMgr ¶
type ConfMgr struct {
Config config.ConfigMgrConfig
Backend backend.ConfigBackend
Router *mux.Router
RequestScope map[string]string
}
func NewConfMgr ¶
func (*ConfMgr) ClientHandler ¶
func (*ConfMgr) ExistingKeys ¶
func (c *ConfMgr) ExistingKeys(key string, wantedType int, scope map[string]string, b backend.ConfigBackend) []string
* Return all matches based on search path and partial key name
func (*ConfMgr) HandleAdminGetHashField ¶
func (c *ConfMgr) HandleAdminGetHashField(w http.ResponseWriter, r *http.Request, b backend.ConfigBackend)
func (*ConfMgr) HandleAdminGetKeyType ¶
func (c *ConfMgr) HandleAdminGetKeyType(w http.ResponseWriter, r *http.Request, b backend.ConfigBackend)
func (*ConfMgr) HandleAdminGetListIndex ¶
func (c *ConfMgr) HandleAdminGetListIndex(w http.ResponseWriter, r *http.Request, b backend.ConfigBackend)
func (*ConfMgr) HandleAdminKeyDelete ¶
func (c *ConfMgr) HandleAdminKeyDelete(w http.ResponseWriter, r *http.Request, b backend.ConfigBackend)
func (*ConfMgr) HandleAdminKeyGet ¶
func (c *ConfMgr) HandleAdminKeyGet(w http.ResponseWriter, r *http.Request, b backend.ConfigBackend)
* Retrieve an absolute key (of any type)
func (*ConfMgr) HandleAdminKeyStore ¶
func (c *ConfMgr) HandleAdminKeyStore(w http.ResponseWriter, r *http.Request, b backend.ConfigBackend)
func (*ConfMgr) HandleAdminListAppend ¶
func (c *ConfMgr) HandleAdminListAppend(w http.ResponseWriter, r *http.Request, b backend.ConfigBackend)
func (*ConfMgr) HandleAdminListHashFields ¶
func (c *ConfMgr) HandleAdminListHashFields(w http.ResponseWriter, r *http.Request, b backend.ConfigBackend)
func (*ConfMgr) HandleAdminListKeys ¶
func (c *ConfMgr) HandleAdminListKeys(w http.ResponseWriter, r *http.Request, b backend.ConfigBackend)
func (*ConfMgr) HandleAdminListKeysFiltered ¶
func (c *ConfMgr) HandleAdminListKeysFiltered(w http.ResponseWriter, r *http.Request, b backend.ConfigBackend)
func (*ConfMgr) HandleAdminSetHashField ¶
func (c *ConfMgr) HandleAdminSetHashField(w http.ResponseWriter, r *http.Request, b backend.ConfigBackend)
func (*ConfMgr) HandleLookupHash ¶
func (c *ConfMgr) HandleLookupHash(w http.ResponseWriter, r *http.Request, b backend.ConfigBackend)
func (*ConfMgr) HandleLookupHashField ¶
func (c *ConfMgr) HandleLookupHashField(w http.ResponseWriter, r *http.Request, b backend.ConfigBackend)
func (*ConfMgr) HandleLookupList ¶
func (c *ConfMgr) HandleLookupList(w http.ResponseWriter, r *http.Request, b backend.ConfigBackend)
func (*ConfMgr) HandleLookupListIndex ¶
func (c *ConfMgr) HandleLookupListIndex(w http.ResponseWriter, r *http.Request, b backend.ConfigBackend)
func (*ConfMgr) HandleLookupString ¶
func (c *ConfMgr) HandleLookupString(w http.ResponseWriter, r *http.Request, b backend.ConfigBackend)
func (*ConfMgr) Index ¶
func (c *ConfMgr) Index(w http.ResponseWriter, r *http.Request, b backend.ConfigBackend)
func (*ConfMgr) ListAppendFromJSON ¶
func (*ConfMgr) ListKeys ¶
func (c *ConfMgr) ListKeys(filter string, b backend.ConfigBackend) (ListKeyResponse, error)
func (*ConfMgr) LookupHash ¶
func (*ConfMgr) LookupHashField ¶
func (*ConfMgr) LookupHashFieldByString ¶
func (*ConfMgr) LookupList ¶
func (*ConfMgr) LookupListIndex ¶
func (*ConfMgr) LookupListIndexByString ¶
func (*ConfMgr) LookupString ¶
func (*ConfMgr) LookupStringByString ¶
func (*ConfMgr) RouteDefinitions ¶
func (*ConfMgr) SaveKeyFromJSON ¶
func (*ConfMgr) SearchPaths ¶
*
- Returns the paths in reverse order as this is how all other functions
- will consume it *
func (*ConfMgr) SetHashFieldFromJSON ¶
func (*ConfMgr) SetRequestScopeFromHeaders ¶
* Extract scope variables from x-cfg-FOO request headers
func (*ConfMgr) StoreHash ¶
func (c *ConfMgr) StoreHash(keyName string, data HashKeyResponse, b backend.ConfigBackend) error
func (*ConfMgr) StoreList ¶
func (c *ConfMgr) StoreList(keyName string, data ListKeyResponse, b backend.ConfigBackend) error
func (*ConfMgr) StoreString ¶
func (c *ConfMgr) StoreString(keyName string, data StringKeyResponse, b backend.ConfigBackend) error
type DataRequest ¶
type DataRequest struct {
Data string `json:"data"`
}
type GenericRequest ¶
type GenericRequest struct {
Type string `json:"type"`
Data interface{} `json:"data"`
}
func (*GenericRequest) AsHash ¶
func (r *GenericRequest) AsHash() HashKeyResponse
func (*GenericRequest) AsList ¶
func (r *GenericRequest) AsList() ListKeyResponse
func (*GenericRequest) AsString ¶
func (r *GenericRequest) AsString() StringKeyResponse
type HandlerFuncBackend ¶
type HandlerFuncBackend func(w http.ResponseWriter, r *http.Request, b backend.ConfigBackend)
type HashKeyResponse ¶
func (HashKeyResponse) ToJsonString ¶
func (r HashKeyResponse) ToJsonString() (string, error)
func (HashKeyResponse) ToString ¶
func (r HashKeyResponse) ToString() string
type KeyResponse ¶
type ListKeyResponse ¶
func (ListKeyResponse) ToJsonString ¶
func (r ListKeyResponse) ToJsonString() (string, error)
func (ListKeyResponse) ToString ¶
func (r ListKeyResponse) ToString() string
type LookupHashResponse ¶
type LookupHashResponse struct {
Type string `json:"type"`
Data map[string]ValueSource `json:"data"`
}
func (LookupHashResponse) ToJsonString ¶
func (r LookupHashResponse) ToJsonString() (string, error)
func (LookupHashResponse) ToString ¶
func (r LookupHashResponse) ToString() string
type LookupListResponse ¶
type LookupListResponse struct {
Type string `json:"type"`
Data []ValueSource `json:"data"`
}
func (LookupListResponse) ToJsonString ¶
func (r LookupListResponse) ToJsonString() (string, error)
func (LookupListResponse) ToString ¶
func (r LookupListResponse) ToString() string
func (r ValueSource) MarshalJSON() ([]byte, error) {
return json.Marshal(r.Value)
}
type LookupStringResponse ¶
type LookupStringResponse struct {
Type string `json:"type"`
Data ValueSource `json:"data"`
}
func (LookupStringResponse) ToJsonString ¶
func (r LookupStringResponse) ToJsonString() (string, error)
func (LookupStringResponse) ToString ¶
func (r LookupStringResponse) ToString() string
type Route ¶
type Route struct {
Name string
Method string
Pattern string
HandlerFunc http.HandlerFunc
}
type StringKeyResponse ¶
func (StringKeyResponse) ToJsonString ¶
func (r StringKeyResponse) ToJsonString() (string, error)
func (StringKeyResponse) ToString ¶
func (r StringKeyResponse) ToString() string
type ValueSource ¶
Source Files
¶
Click to show internal directories.
Click to hide internal directories.