Documentation
¶
Index ¶
- Variables
- func AddDynamicEndpoint(endpointPattern, path, description, name, method string, ...)
- func BuildEnvironmentFromConfig(path, urlFlag string) (*url.URL, *http.Client, error)
- func FindFunctionEndpoint(u *url.URL, c *http.Client, f, m string) (*EndPoint, *Response)
- func FunctionPath() string
- func NotifyManager(managerName string, n Notification) error
- func RegisterNotificationManager(managerName, endpoint string) error
- func StartAPIServer(path string, port int, insecure bool) error
- func WriteClientConfig(path, address string, s *ServerConfig) error
- func WriteServerConfig(path, hostname, address string, port int, cert, key []byte) error
- type ClientConfig
- type EndPoint
- type Notification
- type Response
- func ParsePlunderDelete(u *url.URL, c *http.Client) (*Response, error)
- func ParsePlunderGet(u *url.URL, c *http.Client) (*Response, error)
- func ParsePlunderPatch(u *url.URL, c *http.Client, data []byte) (*Response, error)
- func ParsePlunderPost(u *url.URL, c *http.Client, data []byte) (*Response, error)
- type ServerConfig
Constants ¶
This section is empty.
Variables ¶
var EndPointManager []EndPoint
EndPointManager - Contains all of the dynamically created endpoints
Functions ¶
func AddDynamicEndpoint ¶
func AddDynamicEndpoint(endpointPattern, path, description, name, method string, epFunc http.HandlerFunc)
AddDynamicEndpoint - will add an endpoint to the api server and link it back to a function
func BuildEnvironmentFromConfig ¶
BuildEnvironmentFromConfig will use the apiserver pkg to parse a configuration file and create a http client with the correct authentication and URL
func FindFunctionEndpoint ¶
FindFunctionEndpoint - will do a look up to find an exposed dynamic endpoint
func FunctionPath ¶
func FunctionPath() string
FunctionPath - this will return the api server path for any external caller using the package
func NotifyManager ¶
func NotifyManager(managerName string, n Notification) error
NotifyManager - This will Notify a Manager that there is a new notification that needs to go to subscribers
func RegisterNotificationManager ¶
RegisterNotificationManager will create a manager and an endpoint
func StartAPIServer ¶
StartAPIServer - will parse a configuration file and passed variables and start the API Server
func WriteClientConfig ¶
func WriteClientConfig(path, address string, s *ServerConfig) error
WriteClientConfig - will write out the server configuration for the API Server
Types ¶
type ClientConfig ¶
type ClientConfig struct {
Address string `json:"address,omitempty"`
Port int `json:"port"`
ClientCert string `json:"cert"`
}
ClientConfig is the structure of an expected configuration for pldctl
func (*ClientConfig) GetServerAddressURL ¶
func (c *ClientConfig) GetServerAddressURL() *url.URL
GetServerAddressURL will retrieve a parsed URL
func (*ClientConfig) RetrieveClientCert ¶
func (c *ClientConfig) RetrieveClientCert() ([]byte, error)
RetrieveClientCert will decode the base64 certificate
type EndPoint ¶
type EndPoint struct {
Name string `json:"name"`
Path string `json:"path"`
FunctionPath string `json:"functionEndpoint"`
Description string `json:"description"`
Method string `json:"method"`
}
EndPoint is the source of truth for handling all of the endpoints exposed through the API Server it also provides a mechanism to interact with the apiserver to find/create api endpoints
func GetEndpoint ¶
GetEndpoint - will return the details for an endpoint
type Notification ¶
Notification is what will be sent to subscribers of a manager
type Response ¶
type Response struct {
Warning string `json:"warning,omitempty"` // when it maybe worked
Error string `json:"error,omitempty"` // when it goes wrong
Success string `json:"success,omitempty"` // when it goes correct
Payload json.RawMessage `json:"payload,omitempty"`
}
Response - This is the wrapper for responses back to a client, if any errors are created then the payload isn't guarenteed
func ParsePlunderDelete ¶
ParsePlunderDelete will attempt to retrieve data from the plunder API server
func ParsePlunderGet ¶
ParsePlunderGet will attempt to retrieve data from the plunder API server
func ParsePlunderPatch ¶
ParsePlunderPatch will attempt to retrieve data from the plunder API server
type ServerConfig ¶
type ServerConfig struct {
ClientConfig
ServerKey string `json:"key"`
}
ServerConfig is the structure of an expected configuration for pldctl
func OpenServerConfig ¶
func OpenServerConfig(path string) (*ServerConfig, error)
OpenServerConfig will open and parse a Plunder server configuration file
func (*ServerConfig) RetrieveClientCert ¶
func (s *ServerConfig) RetrieveClientCert() ([]byte, error)
RetrieveClientCert will decode the base64 certificate
func (*ServerConfig) RetrieveKey ¶
func (s *ServerConfig) RetrieveKey() ([]byte, error)
RetrieveKey will decode the base64 certificate