models

package
v0.0.0-...-76456f8 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2014 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Endpoint

type Endpoint struct {
	Id         uint           `json:"id"`
	Target     *string        `json:"target"`
	Name       *string        `json:"name"`
	Operations OperationsList `json:"operations"`
	Protocol   *string        `json:"protocol"`
}

func (*Endpoint) Validate

func (e *Endpoint) Validate() error

type ErrorMessage

type ErrorMessage struct {
	Id           int    `json:"id"`
	MessageType  string `json:"message_type"`
	ErrorMessage string `json:"error_message"`
	ErrorCode    string `json:"error_code"`
}

type Model

type Model interface {
	Validate() error
}

type Operation

type Operation struct {
	Id        uint      `json:"id"`
	ProjectId *uint     `json:"project_id"`
	Request   *Request  `json:"request"`
	Response  *Response `json:"response"`
}

func (*Operation) Validate

func (o *Operation) Validate() error

type OperationsList

type OperationsList list.List

func (*OperationsList) MarshalJSON

func (l *OperationsList) MarshalJSON() ([]byte, error)

func (*OperationsList) PushBack

func (l *OperationsList) PushBack(op *Operation)

func (*OperationsList) UnmarshalJSON

func (l *OperationsList) UnmarshalJSON(data []byte) error

type Project

type Project struct {
	Id          uint      `json:"id"`
	Endpoint    *Endpoint `json:"endpoint"`
	Name        *string   `json:"name"`
	LastUpdated time.Time `json:"last_updated"`
}

func (*Project) Validate

func (p *Project) Validate() error

type Request

type Request struct {
	Method           string      `json:"method"`
	Proto            string      `json:"protocol"`
	Header           http.Header `json:"headers,omitempty"`
	Body             []byte      `json:"body"`
	ContentLength    int64       `json:"content_length"`
	TransferEncoding []string    `json:"transfer_encoding,omitempty"`
	Host             string      `json:"host"`
	RemoteAddr       string      `json:"remote_addr"`
	RequestURI       string      `json:"request_uri"`
	Timestamp        int64       `json:"timestamp"`
}

Our abstracted represnetation of a request.

func NewRequest

func NewRequest(request *http.Request) (*Request, error)

func (*Request) String

func (r *Request) String() string

type Response

type Response struct {
	Proto            string      `json:"protocol"`
	Header           http.Header `json:"headers"`
	Trailer          http.Header `json:"trailer"`
	Body             string      `json:"body"`
	ContentLength    int64       `json:"content_length"`
	TransferEncoding []string    `json:"transfer_encoding"`
	Status           string      `json:"status"`
	StatusCode       int         `json:"status_code"`
	Timestamp        int64       `json:"timestamp"`
}

func NewResponse

func NewResponse(resp *http.Response) (*Response, error)

Jump to

Keyboard shortcuts

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