Documentation
¶
Overview ¶
Package handler store the REST handlers of specific URI
Package handler store the REST handlers of specific URI ¶
Package handler store the REST handlers of specific URI ¶
Package handler store the REST handlers of specific URI ¶
Package handler store the REST handlers of specific URI ¶
Package handler store the REST handlers of specific URI ¶
Package handler store the REST handlers of specific URI
Index ¶
- Variables
- func HandleFunc(pattern string, handler func() handy.Handler)
- type DomainHandler
- func (h *DomainHandler) ClearResponse()
- func (h *DomainHandler) Delete(w http.ResponseWriter, r *http.Request)
- func (h *DomainHandler) Get(w http.ResponseWriter, r *http.Request)
- func (h *DomainHandler) GetDatabase() *mgo.Database
- func (h *DomainHandler) GetDatabaseSession() *mgo.Session
- func (h *DomainHandler) GetETag() string
- func (h *DomainHandler) GetFQDN() string
- func (h *DomainHandler) GetLanguage() *messages.LanguagePack
- func (h *DomainHandler) GetLastModifiedAt() time.Time
- func (h *DomainHandler) Head(w http.ResponseWriter, r *http.Request)
- func (h *DomainHandler) Interceptors() handy.InterceptorChain
- func (h *DomainHandler) MessageResponse(messageId string, roid string) error
- func (h *DomainHandler) Put(w http.ResponseWriter, r *http.Request)
- func (h *DomainHandler) SetDatabase(database *mgo.Database)
- func (h *DomainHandler) SetDatabaseSession(session *mgo.Session)
- func (h *DomainHandler) SetDomain(domain model.Domain)
- func (h *DomainHandler) SetFQDN(fqdn string)
- func (h *DomainHandler) SetLanguage(language *messages.LanguagePack)
- type DomainVerificationHandler
- func (h *DomainVerificationHandler) Get(w http.ResponseWriter, r *http.Request)
- func (h *DomainVerificationHandler) GetDatabase() *mgo.Database
- func (h *DomainVerificationHandler) GetDatabaseSession() *mgo.Session
- func (h *DomainVerificationHandler) GetFQDN() string
- func (h *DomainVerificationHandler) GetLanguage() *messages.LanguagePack
- func (h *DomainVerificationHandler) Head(w http.ResponseWriter, r *http.Request)
- func (h *DomainVerificationHandler) Interceptors() handy.InterceptorChain
- func (h *DomainVerificationHandler) MessageResponse(messageId string, roid string) error
- func (h *DomainVerificationHandler) Put(w http.ResponseWriter, r *http.Request)
- func (h *DomainVerificationHandler) SetDatabase(database *mgo.Database)
- func (h *DomainVerificationHandler) SetDatabaseSession(session *mgo.Session)
- func (h *DomainVerificationHandler) SetFQDN(fqdn string)
- func (h *DomainVerificationHandler) SetLanguage(language *messages.LanguagePack)
- type DomainsHandler
- func (h *DomainsHandler) ClearResponse()
- func (h *DomainsHandler) Get(w http.ResponseWriter, r *http.Request)
- func (h *DomainsHandler) GetDatabase() *mgo.Database
- func (h *DomainsHandler) GetDatabaseSession() *mgo.Session
- func (h *DomainsHandler) GetETag() string
- func (h *DomainsHandler) GetLanguage() *messages.LanguagePack
- func (h *DomainsHandler) GetLastModifiedAt() time.Time
- func (h *DomainsHandler) Head(w http.ResponseWriter, r *http.Request)
- func (h *DomainsHandler) Interceptors() handy.InterceptorChain
- func (h *DomainsHandler) MessageResponse(messageId string, roid string) error
- func (h *DomainsHandler) SetDatabase(database *mgo.Database)
- func (h *DomainsHandler) SetDatabaseSession(session *mgo.Session)
- func (h *DomainsHandler) SetLanguage(language *messages.LanguagePack)
- type ScanHandler
- func (h *ScanHandler) ClearResponse()
- func (h *ScanHandler) Get(w http.ResponseWriter, r *http.Request)
- func (h *ScanHandler) GetDatabase() *mgo.Database
- func (h *ScanHandler) GetDatabaseSession() *mgo.Session
- func (h *ScanHandler) GetETag() string
- func (h *ScanHandler) GetLanguage() *messages.LanguagePack
- func (h *ScanHandler) GetLastModifiedAt() time.Time
- func (h *ScanHandler) GetStartedAt() string
- func (h *ScanHandler) Head(w http.ResponseWriter, r *http.Request)
- func (h *ScanHandler) Interceptors() handy.InterceptorChain
- func (h *ScanHandler) MessageResponse(messageId string, roid string) error
- func (h *ScanHandler) SetDatabase(database *mgo.Database)
- func (h *ScanHandler) SetDatabaseSession(session *mgo.Session)
- func (h *ScanHandler) SetLanguage(language *messages.LanguagePack)
- func (h *ScanHandler) SetScan(scan model.Scan)
- type ScansHandler
- func (h *ScansHandler) ClearResponse()
- func (h *ScansHandler) Get(w http.ResponseWriter, r *http.Request)
- func (h *ScansHandler) GetDatabase() *mgo.Database
- func (h *ScansHandler) GetDatabaseSession() *mgo.Session
- func (h *ScansHandler) GetETag() string
- func (h *ScansHandler) GetLanguage() *messages.LanguagePack
- func (h *ScansHandler) GetLastModifiedAt() time.Time
- func (h *ScansHandler) Head(w http.ResponseWriter, r *http.Request)
- func (h *ScansHandler) Interceptors() handy.InterceptorChain
- func (h *ScansHandler) MessageResponse(messageId string, roid string) error
- func (h *ScansHandler) SetDatabase(database *mgo.Database)
- func (h *ScansHandler) SetDatabaseSession(session *mgo.Session)
- func (h *ScansHandler) SetLanguage(language *messages.LanguagePack)
Constants ¶
This section is empty.
Variables ¶
var ( // Error throw when we don't find any valid date in the URI ErrDateNotFound = errors.New("Did not found a valid RFC 3339 date in the URI") )
var (
Routes map[string]func() handy.Handler
)
Routes is responsable for storing the link beteween an URI and a handler. It uses a library to match the URI because it's faster and allows more complex URI matchs, like /domain/<something>/verification
Functions ¶
func HandleFunc ¶
Function created only to register the handlers more easily
Types ¶
type DomainHandler ¶
type DomainHandler struct { handy.DefaultHandler // Inject the HTTP methods that this resource does not implement FQDN string `param:"fqdn"` // FQDN defined in the URI Request protocol.DomainRequest `request:"put"` // Domain request sent by the user Response *protocol.DomainResponse `response:"get"` // Domain response sent back to the user Message *protocol.MessageResponse `error` // Message on error sent to the user // contains filtered or unexported fields }
DomainHandler is responsable for keeping the state of a /domain/{fqdn} resource
func (*DomainHandler) ClearResponse ¶
func (h *DomainHandler) ClearResponse()
func (*DomainHandler) Delete ¶
func (h *DomainHandler) Delete(w http.ResponseWriter, r *http.Request)
func (*DomainHandler) Get ¶
func (h *DomainHandler) Get(w http.ResponseWriter, r *http.Request)
func (*DomainHandler) GetDatabase ¶
func (h *DomainHandler) GetDatabase() *mgo.Database
func (*DomainHandler) GetDatabaseSession ¶
func (h *DomainHandler) GetDatabaseSession() *mgo.Session
func (*DomainHandler) GetETag ¶
func (h *DomainHandler) GetETag() string
func (*DomainHandler) GetFQDN ¶
func (h *DomainHandler) GetFQDN() string
func (*DomainHandler) GetLanguage ¶
func (h *DomainHandler) GetLanguage() *messages.LanguagePack
func (*DomainHandler) GetLastModifiedAt ¶
func (h *DomainHandler) GetLastModifiedAt() time.Time
func (*DomainHandler) Head ¶
func (h *DomainHandler) Head(w http.ResponseWriter, r *http.Request)
func (*DomainHandler) Interceptors ¶
func (h *DomainHandler) Interceptors() handy.InterceptorChain
func (*DomainHandler) MessageResponse ¶
func (h *DomainHandler) MessageResponse(messageId string, roid string) error
func (*DomainHandler) Put ¶
func (h *DomainHandler) Put(w http.ResponseWriter, r *http.Request)
func (*DomainHandler) SetDatabase ¶
func (h *DomainHandler) SetDatabase(database *mgo.Database)
func (*DomainHandler) SetDatabaseSession ¶
func (h *DomainHandler) SetDatabaseSession(session *mgo.Session)
func (*DomainHandler) SetDomain ¶
func (h *DomainHandler) SetDomain(domain model.Domain)
func (*DomainHandler) SetFQDN ¶
func (h *DomainHandler) SetFQDN(fqdn string)
func (*DomainHandler) SetLanguage ¶
func (h *DomainHandler) SetLanguage(language *messages.LanguagePack)
type DomainVerificationHandler ¶
type DomainVerificationHandler struct { handy.DefaultHandler FQDN string `param:"fqdn"` Request protocol.DomainRequest `request:"put"` Response *protocol.DomainResponse `response:"put,get"` Message *protocol.MessageResponse `error` // contains filtered or unexported fields }
func (*DomainVerificationHandler) Get ¶
func (h *DomainVerificationHandler) Get(w http.ResponseWriter, r *http.Request)
func (*DomainVerificationHandler) GetDatabase ¶
func (h *DomainVerificationHandler) GetDatabase() *mgo.Database
func (*DomainVerificationHandler) GetDatabaseSession ¶
func (h *DomainVerificationHandler) GetDatabaseSession() *mgo.Session
func (*DomainVerificationHandler) GetFQDN ¶
func (h *DomainVerificationHandler) GetFQDN() string
func (*DomainVerificationHandler) GetLanguage ¶
func (h *DomainVerificationHandler) GetLanguage() *messages.LanguagePack
func (*DomainVerificationHandler) Head ¶
func (h *DomainVerificationHandler) Head(w http.ResponseWriter, r *http.Request)
func (*DomainVerificationHandler) Interceptors ¶
func (h *DomainVerificationHandler) Interceptors() handy.InterceptorChain
func (*DomainVerificationHandler) MessageResponse ¶
func (h *DomainVerificationHandler) MessageResponse(messageId string, roid string) error
func (*DomainVerificationHandler) Put ¶
func (h *DomainVerificationHandler) Put(w http.ResponseWriter, r *http.Request)
Put is responsable for checking a domain object on-the-fly without persisting in database, useful for pre-registration validations in the registry
func (*DomainVerificationHandler) SetDatabase ¶
func (h *DomainVerificationHandler) SetDatabase(database *mgo.Database)
func (*DomainVerificationHandler) SetDatabaseSession ¶
func (h *DomainVerificationHandler) SetDatabaseSession(session *mgo.Session)
func (*DomainVerificationHandler) SetFQDN ¶
func (h *DomainVerificationHandler) SetFQDN(fqdn string)
func (*DomainVerificationHandler) SetLanguage ¶
func (h *DomainVerificationHandler) SetLanguage(language *messages.LanguagePack)
type DomainsHandler ¶
type DomainsHandler struct { handy.DefaultHandler Response *protocol.DomainsResponse `response:"get"` Message *protocol.MessageResponse `error` // contains filtered or unexported fields }
func (*DomainsHandler) ClearResponse ¶
func (h *DomainsHandler) ClearResponse()
func (*DomainsHandler) Get ¶
func (h *DomainsHandler) Get(w http.ResponseWriter, r *http.Request)
func (*DomainsHandler) GetDatabase ¶
func (h *DomainsHandler) GetDatabase() *mgo.Database
func (*DomainsHandler) GetDatabaseSession ¶
func (h *DomainsHandler) GetDatabaseSession() *mgo.Session
func (*DomainsHandler) GetETag ¶
func (h *DomainsHandler) GetETag() string
The ETag header will be the hash of the content on list services
func (*DomainsHandler) GetLanguage ¶
func (h *DomainsHandler) GetLanguage() *messages.LanguagePack
func (*DomainsHandler) GetLastModifiedAt ¶
func (h *DomainsHandler) GetLastModifiedAt() time.Time
func (*DomainsHandler) Head ¶
func (h *DomainsHandler) Head(w http.ResponseWriter, r *http.Request)
func (*DomainsHandler) Interceptors ¶
func (h *DomainsHandler) Interceptors() handy.InterceptorChain
func (*DomainsHandler) MessageResponse ¶
func (h *DomainsHandler) MessageResponse(messageId string, roid string) error
func (*DomainsHandler) SetDatabase ¶
func (h *DomainsHandler) SetDatabase(database *mgo.Database)
func (*DomainsHandler) SetDatabaseSession ¶
func (h *DomainsHandler) SetDatabaseSession(session *mgo.Session)
func (*DomainsHandler) SetLanguage ¶
func (h *DomainsHandler) SetLanguage(language *messages.LanguagePack)
type ScanHandler ¶
type ScanHandler struct { handy.DefaultHandler // Inject the HTTP methods that this resource does not implement StartedAt string `param:"started-at"` // Scan start date in the URI Response *protocol.ScanResponse `response:"get"` // Scan response sent back to the user Message *protocol.MessageResponse `error` // Message on error sent to the user // contains filtered or unexported fields }
ScanHandler is responsable for keeping the state of a /scan/{started-at} resource
func (*ScanHandler) ClearResponse ¶
func (h *ScanHandler) ClearResponse()
func (*ScanHandler) Get ¶
func (h *ScanHandler) Get(w http.ResponseWriter, r *http.Request)
func (*ScanHandler) GetDatabase ¶
func (h *ScanHandler) GetDatabase() *mgo.Database
func (*ScanHandler) GetDatabaseSession ¶
func (h *ScanHandler) GetDatabaseSession() *mgo.Session
func (*ScanHandler) GetETag ¶
func (h *ScanHandler) GetETag() string
func (*ScanHandler) GetLanguage ¶
func (h *ScanHandler) GetLanguage() *messages.LanguagePack
func (*ScanHandler) GetLastModifiedAt ¶
func (h *ScanHandler) GetLastModifiedAt() time.Time
func (*ScanHandler) GetStartedAt ¶
func (h *ScanHandler) GetStartedAt() string
func (*ScanHandler) Head ¶
func (h *ScanHandler) Head(w http.ResponseWriter, r *http.Request)
func (*ScanHandler) Interceptors ¶
func (h *ScanHandler) Interceptors() handy.InterceptorChain
func (*ScanHandler) MessageResponse ¶
func (h *ScanHandler) MessageResponse(messageId string, roid string) error
func (*ScanHandler) SetDatabase ¶
func (h *ScanHandler) SetDatabase(database *mgo.Database)
func (*ScanHandler) SetDatabaseSession ¶
func (h *ScanHandler) SetDatabaseSession(session *mgo.Session)
func (*ScanHandler) SetLanguage ¶
func (h *ScanHandler) SetLanguage(language *messages.LanguagePack)
func (*ScanHandler) SetScan ¶
func (h *ScanHandler) SetScan(scan model.Scan)
type ScansHandler ¶
type ScansHandler struct { handy.DefaultHandler Response *protocol.ScansResponse `response:"get"` Message *protocol.MessageResponse `error` // contains filtered or unexported fields }
func (*ScansHandler) ClearResponse ¶
func (h *ScansHandler) ClearResponse()
func (*ScansHandler) Get ¶
func (h *ScansHandler) Get(w http.ResponseWriter, r *http.Request)
func (*ScansHandler) GetDatabase ¶
func (h *ScansHandler) GetDatabase() *mgo.Database
func (*ScansHandler) GetDatabaseSession ¶
func (h *ScansHandler) GetDatabaseSession() *mgo.Session
func (*ScansHandler) GetETag ¶
func (h *ScansHandler) GetETag() string
The ETag header will be the hash of the content on list services
func (*ScansHandler) GetLanguage ¶
func (h *ScansHandler) GetLanguage() *messages.LanguagePack
func (*ScansHandler) GetLastModifiedAt ¶
func (h *ScansHandler) GetLastModifiedAt() time.Time
func (*ScansHandler) Head ¶
func (h *ScansHandler) Head(w http.ResponseWriter, r *http.Request)
func (*ScansHandler) Interceptors ¶
func (h *ScansHandler) Interceptors() handy.InterceptorChain
func (*ScansHandler) MessageResponse ¶
func (h *ScansHandler) MessageResponse(messageId string, roid string) error
func (*ScansHandler) SetDatabase ¶
func (h *ScansHandler) SetDatabase(database *mgo.Database)
func (*ScansHandler) SetDatabaseSession ¶
func (h *ScansHandler) SetDatabaseSession(session *mgo.Session)
func (*ScansHandler) SetLanguage ¶
func (h *ScansHandler) SetLanguage(language *messages.LanguagePack)