Documentation ¶
Index ¶
- type HTTPHandler
- func (handler HTTPHandler) GetAccessRequest(w http.ResponseWriter, r *http.Request)
- func (handler HTTPHandler) GetApplication(w http.ResponseWriter, r *http.Request)
- func (handler HTTPHandler) GetApplications(w http.ResponseWriter, r *http.Request)
- func (handler HTTPHandler) GetPing(w http.ResponseWriter, r *http.Request)
- func (handler HTTPHandler) PostAccessChange(w http.ResponseWriter, r *http.Request)
- func (handler HTTPHandler) PostAccessRequest(w http.ResponseWriter, r *http.Request)
- func (handler HTTPHandler) PostApplication(w http.ResponseWriter, r *http.Request)
- func (handler HTTPHandler) PostApproval(w http.ResponseWriter, r *http.Request)
- type HTTPNotifier
- type MongoDBClient
- func (c *MongoDBClient) CreateAccessRequest(proposed *types.AccessRequest) (*types.AccessRequest, error)
- func (c *MongoDBClient) CreateApplication(proposed *types.Application) (*types.Application, error)
- func (c *MongoDBClient) GetAccessRequest(id string) (*types.AccessRequest, error)
- func (c *MongoDBClient) GetApplication(id string) (*types.Application, error)
- func (c *MongoDBClient) GetApplications() ([]*types.Application, error)
- func (c *MongoDBClient) RecordAccessChange(change *types.AccessChange, accessRequestID string) (*types.AccessRequest, error)
- func (c *MongoDBClient) RecordApproval(approval *types.Approval, accessRequestID string) (*types.AccessRequest, error)
- type MongoDBClientConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HTTPHandler ¶
type HTTPHandler struct {
// contains filtered or unexported fields
}
HTTPHandler can handle incoming HTTP requests in fiber
func NewHTTPHandler ¶
func NewHTTPHandler(client types.BrandenburgClient, notifier types.Notifier) HTTPHandler
NewHTTPHandler initialises a new HTTPHandler with the provided client
func (HTTPHandler) GetAccessRequest ¶
func (handler HTTPHandler) GetAccessRequest(w http.ResponseWriter, r *http.Request)
GetAccessRequest returns 200 and a matching AccessRequest
func (HTTPHandler) GetApplication ¶
func (handler HTTPHandler) GetApplication(w http.ResponseWriter, r *http.Request)
GetApplication returns 200 and a matching Application
func (HTTPHandler) GetApplications ¶
func (handler HTTPHandler) GetApplications(w http.ResponseWriter, r *http.Request)
GetApplications return 200 containing a JSON array of Applications
func (HTTPHandler) GetPing ¶
func (handler HTTPHandler) GetPing(w http.ResponseWriter, r *http.Request)
GetPing will return a 200 Pong in all cases
func (HTTPHandler) PostAccessChange ¶
func (handler HTTPHandler) PostAccessChange(w http.ResponseWriter, r *http.Request)
PostAccessChange records an AccessChange to an AccessRequest using POST body and query string params
func (HTTPHandler) PostAccessRequest ¶
func (handler HTTPHandler) PostAccessRequest(w http.ResponseWriter, r *http.Request)
PostAccessRequest creates a new AccessRequest from POST body
func (HTTPHandler) PostApplication ¶
func (handler HTTPHandler) PostApplication(w http.ResponseWriter, r *http.Request)
PostApplication creates a new AccessRequest from POST body
func (HTTPHandler) PostApproval ¶
func (handler HTTPHandler) PostApproval(w http.ResponseWriter, r *http.Request)
PostApproval records an Approval to an AccessRequest using POST body and query string params
type HTTPNotifier ¶
HTTPNotifier sends HTTP POSTs to targets including Notification payloads
func NewHTTPNotifier ¶
func NewHTTPNotifier(targets []string) (*HTTPNotifier, error)
NewHTTPNotifier returns a completely initialised HTTPNotifier
func (*HTTPNotifier) Notify ¶
func (h *HTTPNotifier) Notify(notification *types.Notification) error
Notify will POST a Notification to all targets
type MongoDBClient ¶
type MongoDBClient struct {
// contains filtered or unexported fields
}
MongoDBClient allows persistence to a db
func NewMongoDBClient ¶
func NewMongoDBClient(config *MongoDBClientConfig) (*MongoDBClient, error)
NewMongoDBClient readies a MongoDBClient for use
func (*MongoDBClient) CreateAccessRequest ¶
func (c *MongoDBClient) CreateAccessRequest(proposed *types.AccessRequest) (*types.AccessRequest, error)
CreateAccessRequest returns an existing matching or newly created AccessRequest and sends notifications to targets
func (*MongoDBClient) CreateApplication ¶
func (c *MongoDBClient) CreateApplication(proposed *types.Application) (*types.Application, error)
CreateApplication returns an existing matching or newly created Application
func (*MongoDBClient) GetAccessRequest ¶
func (c *MongoDBClient) GetAccessRequest(id string) (*types.AccessRequest, error)
GetAccessRequest returns the AccessRequest matching provided id Will return nil with no error if no matching AccessRequest exists
func (*MongoDBClient) GetApplication ¶
func (c *MongoDBClient) GetApplication(id string) (*types.Application, error)
GetApplication returns a matching Application If none is found, a nil Application and nil error is returned
func (*MongoDBClient) GetApplications ¶
func (c *MongoDBClient) GetApplications() ([]*types.Application, error)
GetApplications returns all Application records
func (*MongoDBClient) RecordAccessChange ¶
func (c *MongoDBClient) RecordAccessChange(change *types.AccessChange, accessRequestID string) (*types.AccessRequest, error)
RecordAccessChange adds an AccessChange record to an AccessRequest and sends notifications to targets
func (*MongoDBClient) RecordApproval ¶
func (c *MongoDBClient) RecordApproval(approval *types.Approval, accessRequestID string) (*types.AccessRequest, error)
RecordApproval adds an Approval record to an AccessRequest and sends notifications to targets