server

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2020 License: MIT Imports: 8 Imported by: 0

README

server

import "github.com/brittonhayes/citadel/gen/http/incidents/server"

Index

func DecodeFindRequest

func DecodeFindRequest(mux goahttp.Muxer, decoder func(*http.Request) goahttp.Decoder) func(*http.Request) (interface{}, error)

DecodeFindRequest returns a decoder for requests sent to the incidents find endpoint.

func DecodeListAllRequest

func DecodeListAllRequest(mux goahttp.Muxer, decoder func(*http.Request) goahttp.Decoder) func(*http.Request) (interface{}, error)

DecodeListAllRequest returns a decoder for requests sent to the incidents list all endpoint.

func EncodeFindResponse

func EncodeFindResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, interface{}) error

EncodeFindResponse returns an encoder for responses returned by the incidents find endpoint.

func EncodeListAllResponse

func EncodeListAllResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, interface{}) error

EncodeListAllResponse returns an encoder for responses returned by the incidents list all endpoint.

func FindIncidentsPath

func FindIncidentsPath(id uint64) string

FindIncidentsPath returns the URL path to the incidents service find HTTP endpoint.

func ListAllIncidentsPath

func ListAllIncidentsPath() string

ListAllIncidentsPath returns the URL path to the incidents service list all HTTP endpoint.

func Mount

func Mount(mux goahttp.Muxer, h *Server)

Mount configures the mux to serve the incidents endpoints.

func MountFindHandler

func MountFindHandler(mux goahttp.Muxer, h http.Handler)

MountFindHandler configures the mux to serve the "incidents" service "find" endpoint.

func MountListAllHandler

func MountListAllHandler(mux goahttp.Muxer, h http.Handler)

MountListAllHandler configures the mux to serve the "incidents" service "list all" endpoint.

func NewFindHandler

func NewFindHandler(
    endpoint endpoint.Endpoint,
    mux goahttp.Muxer,
    decoder func(*http.Request) goahttp.Decoder,
    encoder func(context.Context, http.ResponseWriter) goahttp.Encoder,
    errhandler func(context.Context, http.ResponseWriter, error),
    formatter func(err error) goahttp.Statuser,
) http.Handler

NewFindHandler creates a HTTP handler which loads the HTTP request and calls the "incidents" service "find" endpoint.

func NewFindPayload

func NewFindPayload(id uint64) *incidents.FindPayload

NewFindPayload builds a incidents service find endpoint payload.

func NewListAllHandler

func NewListAllHandler(
    endpoint endpoint.Endpoint,
    mux goahttp.Muxer,
    decoder func(*http.Request) goahttp.Decoder,
    encoder func(context.Context, http.ResponseWriter) goahttp.Encoder,
    errhandler func(context.Context, http.ResponseWriter, error),
    formatter func(err error) goahttp.Statuser,
) http.Handler

NewListAllHandler creates a HTTP handler which loads the HTTP request and calls the "incidents" service "list all" endpoint.

func NewListAllLimitPayload

func NewListAllLimitPayload(limit *int32) *incidents.LimitPayload

NewListAllLimitPayload builds a incidents service list all endpoint payload.

type ErrorNamer

ErrorNamer is an interface implemented by generated error structs that exposes the name of the error as defined in the design.

type ErrorNamer interface {
    ErrorName() string
}

type FindResponseBody

FindResponseBody is the type of the "incidents" service "find" endpoint HTTP response body.

type FindResponseBody struct {
    // Unique ID of the incident
    ID  *uint64 `form:"id,omitempty" json:"id,omitempty" xml:"id,omitempty"`
    // Date the incident occurred
    Date *string `form:"date,omitempty" json:"date,omitempty" xml:"date,omitempty"`
    // Date the incident occurred
    DateClosed *string `form:"date_closed,omitempty" json:"date_closed,omitempty" xml:"date_closed,omitempty"`
    // Permissions associated with incident
    Permissions *string `form:"Permissions,omitempty" json:"Permissions,omitempty" xml:"Permissions,omitempty"`
    // The severity of the incident
    Severity *int `form:"severity,omitempty" json:"severity,omitempty" xml:"severity,omitempty"`
    // The short title of the incident
    Title *string `form:"title,omitempty" json:"title,omitempty" xml:"title,omitempty"`
    // The detailed description of the incident
    Summary *string `form:"summary,omitempty" json:"summary,omitempty" xml:"summary,omitempty"`
    // The scope of impact of this incident
    Scope *string `form:"scope,omitempty" json:"scope,omitempty" xml:"scope,omitempty"`
    // What group or individual caused the initial incident
    ResponsibleParty *string `form:"responsible_party,omitempty" json:"responsible_party,omitempty" xml:"responsible_party,omitempty"`
    // A list of the affected customers
    AffectedCustomers []string `form:"affected_customers,omitempty" json:"affected_customers,omitempty" xml:"affected_customers,omitempty"`
    // The original cause of the incident
    RootCause *string `form:"root_cause,omitempty" json:"root_cause,omitempty" xml:"root_cause,omitempty"`
    // The slack channel for incident discussions
    SlackChannel *string `form:"slack_channel,omitempty" json:"slack_channel,omitempty" xml:"slack_channel,omitempty"`
    // When the incident was submitted
    CreatedAt *string `form:"created_at,omitempty" json:"created_at,omitempty" xml:"created_at,omitempty"`
    // When the incident was last updated
    UpdatedAt *string `form:"updated_at,omitempty" json:"updated_at,omitempty" xml:"updated_at,omitempty"`
}
func NewFindResponseBody
func NewFindResponseBody(res *incidents.Incident) *FindResponseBody

NewFindResponseBody builds the HTTP response body from the result of the "find" endpoint of the "incidents" service.

type IncidentResponse

IncidentResponse is used to define fields on response body types.

type IncidentResponse struct {
    // Unique ID of the incident
    ID  *uint64 `form:"id,omitempty" json:"id,omitempty" xml:"id,omitempty"`
    // Date the incident occurred
    Date *string `form:"date,omitempty" json:"date,omitempty" xml:"date,omitempty"`
    // Date the incident occurred
    DateClosed *string `form:"date_closed,omitempty" json:"date_closed,omitempty" xml:"date_closed,omitempty"`
    // Permissions associated with incident
    Permissions *string `form:"Permissions,omitempty" json:"Permissions,omitempty" xml:"Permissions,omitempty"`
    // The severity of the incident
    Severity *int `form:"severity,omitempty" json:"severity,omitempty" xml:"severity,omitempty"`
    // The short title of the incident
    Title *string `form:"title,omitempty" json:"title,omitempty" xml:"title,omitempty"`
    // The detailed description of the incident
    Summary *string `form:"summary,omitempty" json:"summary,omitempty" xml:"summary,omitempty"`
    // The scope of impact of this incident
    Scope *string `form:"scope,omitempty" json:"scope,omitempty" xml:"scope,omitempty"`
    // What group or individual caused the initial incident
    ResponsibleParty *string `form:"responsible_party,omitempty" json:"responsible_party,omitempty" xml:"responsible_party,omitempty"`
    // A list of the affected customers
    AffectedCustomers []string `form:"affected_customers,omitempty" json:"affected_customers,omitempty" xml:"affected_customers,omitempty"`
    // The original cause of the incident
    RootCause *string `form:"root_cause,omitempty" json:"root_cause,omitempty" xml:"root_cause,omitempty"`
    // The slack channel for incident discussions
    SlackChannel *string `form:"slack_channel,omitempty" json:"slack_channel,omitempty" xml:"slack_channel,omitempty"`
    // When the incident was submitted
    CreatedAt *string `form:"created_at,omitempty" json:"created_at,omitempty" xml:"created_at,omitempty"`
    // When the incident was last updated
    UpdatedAt *string `form:"updated_at,omitempty" json:"updated_at,omitempty" xml:"updated_at,omitempty"`
}

type ListAllResponseBody

ListAllResponseBody is the type of the "incidents" service "list all" endpoint HTTP response body.

type ListAllResponseBody []*IncidentResponse
func NewListAllResponseBody
func NewListAllResponseBody(res []*incidents.Incident) ListAllResponseBody

NewListAllResponseBody builds the HTTP response body from the result of the "list all" endpoint of the "incidents" service.

type MountPoint

MountPoint holds information about the mounted endpoints.

type MountPoint struct {
    // Method is the name of the service method served by the mounted HTTP handler.
    Method string
    // Verb is the HTTP method used to match requests to the mounted handler.
    Verb string
    // Pattern is the HTTP request path pattern used to match requests to the
    // mounted handler.
    Pattern string
}

type Server

Server lists the incidents service endpoint HTTP handlers.

type Server struct {
    Mounts  []*MountPoint
    Find    http.Handler
    ListAll http.Handler
}
func New
func New(
    e *incidents.Endpoints,
    mux goahttp.Muxer,
    decoder func(*http.Request) goahttp.Decoder,
    encoder func(context.Context, http.ResponseWriter) goahttp.Encoder,
    errhandler func(context.Context, http.ResponseWriter, error),
    formatter func(err error) goahttp.Statuser,
) *Server

New instantiates HTTP handlers for all the incidents service endpoints using the provided encoder and decoder. The handlers are mounted on the given mux using the HTTP verb and path defined in the design. errhandler is called whenever a response fails to be encoded. formatter is used to format errors returned by the service methods prior to encoding. Both errhandler and formatter are optional and can be nil.

func (*Server) Service
func (s *Server) Service() string

Service returns the name of the service served.

func (*Server) Use
func (s *Server) Use(m func(http.Handler) http.Handler)

Use wraps the server handlers with the given middleware.

Generated by gomarkdoc

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeFindRequest

func DecodeFindRequest(mux goahttp.Muxer, decoder func(*http.Request) goahttp.Decoder) func(*http.Request) (interface{}, error)

DecodeFindRequest returns a decoder for requests sent to the incidents find endpoint.

func DecodeListAllRequest

func DecodeListAllRequest(mux goahttp.Muxer, decoder func(*http.Request) goahttp.Decoder) func(*http.Request) (interface{}, error)

DecodeListAllRequest returns a decoder for requests sent to the incidents list all endpoint.

func EncodeFindResponse

func EncodeFindResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, interface{}) error

EncodeFindResponse returns an encoder for responses returned by the incidents find endpoint.

func EncodeListAllResponse

func EncodeListAllResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, interface{}) error

EncodeListAllResponse returns an encoder for responses returned by the incidents list all endpoint.

func FindIncidentsPath

func FindIncidentsPath(id uint64) string

FindIncidentsPath returns the URL path to the incidents service find HTTP endpoint.

func ListAllIncidentsPath

func ListAllIncidentsPath() string

ListAllIncidentsPath returns the URL path to the incidents service list all HTTP endpoint.

func Mount

func Mount(mux goahttp.Muxer, h *Server)

Mount configures the mux to serve the incidents endpoints.

func MountFindHandler

func MountFindHandler(mux goahttp.Muxer, h http.Handler)

MountFindHandler configures the mux to serve the "incidents" service "find" endpoint.

func MountListAllHandler

func MountListAllHandler(mux goahttp.Muxer, h http.Handler)

MountListAllHandler configures the mux to serve the "incidents" service "list all" endpoint.

func NewFindHandler

func NewFindHandler(
	endpoint endpoint.Endpoint,
	mux goahttp.Muxer,
	decoder func(*http.Request) goahttp.Decoder,
	encoder func(context.Context, http.ResponseWriter) goahttp.Encoder,
	errhandler func(context.Context, http.ResponseWriter, error),
	formatter func(err error) goahttp.Statuser,
) http.Handler

NewFindHandler creates a HTTP handler which loads the HTTP request and calls the "incidents" service "find" endpoint.

func NewFindPayload

func NewFindPayload(id uint64) *incidents.FindPayload

NewFindPayload builds a incidents service find endpoint payload.

func NewListAllHandler

func NewListAllHandler(
	endpoint endpoint.Endpoint,
	mux goahttp.Muxer,
	decoder func(*http.Request) goahttp.Decoder,
	encoder func(context.Context, http.ResponseWriter) goahttp.Encoder,
	errhandler func(context.Context, http.ResponseWriter, error),
	formatter func(err error) goahttp.Statuser,
) http.Handler

NewListAllHandler creates a HTTP handler which loads the HTTP request and calls the "incidents" service "list all" endpoint.

func NewListAllLimitPayload

func NewListAllLimitPayload(limit *int32) *incidents.LimitPayload

NewListAllLimitPayload builds a incidents service list all endpoint payload.

Types

type ErrorNamer

type ErrorNamer interface {
	ErrorName() string
}

ErrorNamer is an interface implemented by generated error structs that exposes the name of the error as defined in the design.

type FindResponseBody

type FindResponseBody struct {
	// Unique ID of the incident
	ID *uint64 `form:"id,omitempty" json:"id,omitempty" xml:"id,omitempty"`
	// Date the incident occurred
	Date *string `form:"date,omitempty" json:"date,omitempty" xml:"date,omitempty"`
	// Date the incident occurred
	DateClosed *string `form:"date_closed,omitempty" json:"date_closed,omitempty" xml:"date_closed,omitempty"`
	// Permissions associated with incident
	Permissions *string `form:"Permissions,omitempty" json:"Permissions,omitempty" xml:"Permissions,omitempty"`
	// The severity of the incident
	Severity *int `form:"severity,omitempty" json:"severity,omitempty" xml:"severity,omitempty"`
	// The short title of the incident
	Title *string `form:"title,omitempty" json:"title,omitempty" xml:"title,omitempty"`
	// The detailed description of the incident
	Summary *string `form:"summary,omitempty" json:"summary,omitempty" xml:"summary,omitempty"`
	// The scope of impact of this incident
	Scope *string `form:"scope,omitempty" json:"scope,omitempty" xml:"scope,omitempty"`
	// What group or individual caused the initial incident
	ResponsibleParty *string `form:"responsible_party,omitempty" json:"responsible_party,omitempty" xml:"responsible_party,omitempty"`
	// A list of the affected customers
	AffectedCustomers []string `form:"affected_customers,omitempty" json:"affected_customers,omitempty" xml:"affected_customers,omitempty"`
	// The original cause of the incident
	RootCause *string `form:"root_cause,omitempty" json:"root_cause,omitempty" xml:"root_cause,omitempty"`
	// The slack channel for incident discussions
	SlackChannel *string `form:"slack_channel,omitempty" json:"slack_channel,omitempty" xml:"slack_channel,omitempty"`
	// When the incident was submitted
	CreatedAt *string `form:"created_at,omitempty" json:"created_at,omitempty" xml:"created_at,omitempty"`
	// When the incident was last updated
	UpdatedAt *string `form:"updated_at,omitempty" json:"updated_at,omitempty" xml:"updated_at,omitempty"`
}

FindResponseBody is the type of the "incidents" service "find" endpoint HTTP response body.

func NewFindResponseBody

func NewFindResponseBody(res *incidents.Incident) *FindResponseBody

NewFindResponseBody builds the HTTP response body from the result of the "find" endpoint of the "incidents" service.

type IncidentResponse

type IncidentResponse struct {
	// Unique ID of the incident
	ID *uint64 `form:"id,omitempty" json:"id,omitempty" xml:"id,omitempty"`
	// Date the incident occurred
	Date *string `form:"date,omitempty" json:"date,omitempty" xml:"date,omitempty"`
	// Date the incident occurred
	DateClosed *string `form:"date_closed,omitempty" json:"date_closed,omitempty" xml:"date_closed,omitempty"`
	// Permissions associated with incident
	Permissions *string `form:"Permissions,omitempty" json:"Permissions,omitempty" xml:"Permissions,omitempty"`
	// The severity of the incident
	Severity *int `form:"severity,omitempty" json:"severity,omitempty" xml:"severity,omitempty"`
	// The short title of the incident
	Title *string `form:"title,omitempty" json:"title,omitempty" xml:"title,omitempty"`
	// The detailed description of the incident
	Summary *string `form:"summary,omitempty" json:"summary,omitempty" xml:"summary,omitempty"`
	// The scope of impact of this incident
	Scope *string `form:"scope,omitempty" json:"scope,omitempty" xml:"scope,omitempty"`
	// What group or individual caused the initial incident
	ResponsibleParty *string `form:"responsible_party,omitempty" json:"responsible_party,omitempty" xml:"responsible_party,omitempty"`
	// A list of the affected customers
	AffectedCustomers []string `form:"affected_customers,omitempty" json:"affected_customers,omitempty" xml:"affected_customers,omitempty"`
	// The original cause of the incident
	RootCause *string `form:"root_cause,omitempty" json:"root_cause,omitempty" xml:"root_cause,omitempty"`
	// The slack channel for incident discussions
	SlackChannel *string `form:"slack_channel,omitempty" json:"slack_channel,omitempty" xml:"slack_channel,omitempty"`
	// When the incident was submitted
	CreatedAt *string `form:"created_at,omitempty" json:"created_at,omitempty" xml:"created_at,omitempty"`
	// When the incident was last updated
	UpdatedAt *string `form:"updated_at,omitempty" json:"updated_at,omitempty" xml:"updated_at,omitempty"`
}

IncidentResponse is used to define fields on response body types.

type ListAllResponseBody

type ListAllResponseBody []*IncidentResponse

ListAllResponseBody is the type of the "incidents" service "list all" endpoint HTTP response body.

func NewListAllResponseBody

func NewListAllResponseBody(res []*incidents.Incident) ListAllResponseBody

NewListAllResponseBody builds the HTTP response body from the result of the "list all" endpoint of the "incidents" service.

type MountPoint

type MountPoint struct {
	// Method is the name of the service method served by the mounted HTTP handler.
	Method string
	// Verb is the HTTP method used to match requests to the mounted handler.
	Verb string
	// Pattern is the HTTP request path pattern used to match requests to the
	// mounted handler.
	Pattern string
}

MountPoint holds information about the mounted endpoints.

type Server

type Server struct {
	Mounts  []*MountPoint
	Find    http.Handler
	ListAll http.Handler
}

Server lists the incidents service endpoint HTTP handlers.

func New

func New(
	e *incidents.Endpoints,
	mux goahttp.Muxer,
	decoder func(*http.Request) goahttp.Decoder,
	encoder func(context.Context, http.ResponseWriter) goahttp.Encoder,
	errhandler func(context.Context, http.ResponseWriter, error),
	formatter func(err error) goahttp.Statuser,
) *Server

New instantiates HTTP handlers for all the incidents service endpoints using the provided encoder and decoder. The handlers are mounted on the given mux using the HTTP verb and path defined in the design. errhandler is called whenever a response fails to be encoded. formatter is used to format errors returned by the service methods prior to encoding. Both errhandler and formatter are optional and can be nil.

func (*Server) Service

func (s *Server) Service() string

Service returns the name of the service served.

func (*Server) Use

func (s *Server) Use(m func(http.Handler) http.Handler)

Use wraps the server handlers with the given middleware.

Jump to

Keyboard shortcuts

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