Documentation ¶
Index ¶
- func Boot(routes RouteCollection, addr string, port uint16) *server.ArborServer
- func CheckRegistration(token string)
- func DELETE(w http.ResponseWriter, url string, format string, token string, ...)
- func DeleteClient(name string)
- func GET(w http.ResponseWriter, url string, format string, token string, ...)
- func ListClients()
- func PATCH(w http.ResponseWriter, url string, format string, token string, ...)
- func POST(w http.ResponseWriter, url string, format string, token string, ...)
- func PUT(w http.ResponseWriter, url string, format string, token string, ...)
- func RegisterClient(name string)
- type Route
- type RouteCollection
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Boot ¶
func Boot(routes RouteCollection, addr string, port uint16) *server.ArborServer
Boot is a standard server CLI
Provide a set of routes to serve and a port to serve on.
Usage: executable [-r | --register-client client_name] [-c | --check-registration token] [-u | --unsecured]
-r | --register-client client_name
registers a client, generates a token
-c | --check-registration token
checks if a token is valid and returns name of client
-u | --unsecured
runs arbor without the security layer
-l | --list-clients lists all registered client names -d | --delete-client client_name deletes the client token with the given name without args
runs arbor with the security layer
It will start the arbor instance, parsing the command arguments and execute the behavior.
func CheckRegistration ¶
func CheckRegistration(token string)
CheckRegistration allows you to check what client was assigned to a particular token
func DELETE ¶
DELETE provides a proxy DELETE request allowing authorized clients to make DELETE requests of the microservices
Pass the http Request from the client and the ResponseWriter it expects.
Pass the target url of the backend service (not the url the client called).
Pass the format of the service.
Pass a authorization token (optional).
Will call the service and return the result to the client.
func DeleteClient ¶
func DeleteClient(name string)
func GET ¶
GET provides a proxy GET request allowing authorized clients to make GET requests of the microservices
Pass the http Request from the client and the ResponseWriter it expects.
Pass the target url of the backend service (not the url the client called).
Pass the format of the service.
Pass a authorization token (optional).
Will call the service and return the result to the client.
func ListClients ¶
func ListClients()
func PATCH ¶
PATCH provides a proxy PATCH request allowing authorized clients to make PATCH requests of the microservices
Pass the http Request from the client and the ResponseWriter it expects.
Pass the target url of the backend service (not the url the client called).
Pass the format of the service.
Pass a authorization token (optional).
Will call the service and return the result to the client.
func POST ¶
POST provides a proxy POST request allowing authorized clients to make POST requests of the microservices
Pass the http Request from the client and the ResponseWriter it expects.
Pass the target url of the backend service (not the url the client called).
Pass the format of the service.
Pass a authorization token (optional).
Will call the service and return the result to the client.
func PUT ¶
PUT provides a proxy PUT request allowing authorized clients to make PUT requests of the microservices
Pass the http Request from the client and the ResponseWriter it expects.
Pass the target url of the backend service (not the url the client called).
Pass the format of the service.
Pass a authorization token (optional).
Will call the service and return the result to the client.
func RegisterClient ¶
func RegisterClient(name string)
RegisterClient will generate a access token for a client
Currently uses a db of client names.
Types ¶
type Route ¶
type Route struct { Name string `json:"Name"` Method string `json:"Method"` Pattern string `json:"Pattern"` Handler http.HandlerFunc `json:"Handler"` }
Route is a struct that defines a route for a microservice
Name: Name of the route.
Method: The type of request (GET, POST, DELETE, etc.).
Pattern: The exposed url pattern for clients to hit, allows for url encoded variables to be specified with {VARIABLE}.
HandlerFunc: The function to handle the request, this basicically should just be the proxy call, but it allows you to specify more specific things.
type RouteCollection ¶
type RouteCollection []Route
RouteCollection is a slice of routes that is used to represent a service (may change name here)
Usage: The recomendation is to create a RouteCollection variable for all of you services and for each service create a specific one then in a registration function append all the service collections into the single master collection.