handler

package
v0.0.0-...-73d3301 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 28, 2016 License: GPL-2.0 Imports: 18 Imported by: 0

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

Constants

This section is empty.

Variables

View Source
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")
)
View Source
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

func HandleFunc(pattern string, handler func() handy.Handler)

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 (*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 (*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 (*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 (*DomainVerificationHandler) Head

func (*DomainVerificationHandler) Interceptors

func (*DomainVerificationHandler) MessageResponse

func (h *DomainVerificationHandler) MessageResponse(messageId string, roid string) error

func (*DomainVerificationHandler) Put

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 (*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 (*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 (*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)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL