api

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2017 License: MIT Imports: 10 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// ConvertGUIDKey is the HTTP query key for the GUID to search for in the
	// Convert API call
	ConvertGUIDKey = "guid"
	// ConvertOrgNameKey is the HTTP query key for the Org Name to search for in
	// the Convert API call
	ConvertOrgNameKey = "org_name"
	// ConvertSpaceNameKey is the HTTP query key for the Space Name to search for in the Convert API call
	// call.
	ConvertSpaceNameKey = "space_name"
	// ConvertAppNameKey is the HTTP query key for the App Name to search for in
	// the Convert API call.
	ConvertAppNameKey = "app_name"
)
View Source
const (
	// FindAppGUIDKey is the HTTP query key for the App GUID to the Find API call.
	FindAppGUIDKey = "app_guid"
	// FindOrgNameKey is the HTTP query key for the Org Name to the Find API call.
	FindOrgNameKey = "org_name"
	// FindSpaceNameKey is the HTTP query key for the Space Name to the Find API
	// call.
	FindSpaceNameKey = "space_name"
	// FindAppNameKey is the HTTP query key for the App Name to the Find API call.
	FindAppNameKey = "app_name"
)
View Source
const (
	//FindEndpoint is the URL endpoint corresponding to calling the Find command
	FindEndpoint = "/v1/apps"
	// MetaEndpoint is the URL endpoint corresponding to getting meta information
	// about this cfseeker server
	MetaEndpoint = "/v1/meta"
	// InvalidateBOSHEndpoint is the endpoint corresponding to manipulation of the
	// BOSH VM info cache
	InvalidateBOSHEndpoint = "/v1/cache/bosh"
	//WebEndpoint is the path to the web UI
	WebEndpoint = "/"
	//ConvertEndpoint is the path corresponding to the Convert API call
	ConvertEndpoint = "/v1/convert"
)

Variables

This section is empty.

Functions

func Initialize

func Initialize(conf *config.Config) (err error)

Initialize reads in the given configuration struct and performs the steps necessary to prepare the server for launch

Types

type MetaOutput

type MetaOutput struct {
	Version string `json:"version" yaml:"version"`
}

MetaOutput gives meta information about this cfseeker server.

func (*MetaOutput) ReceiveJSON added in v1.1.0

func (m *MetaOutput) ReceiveJSON(j []byte) (err error)

ReceiveJSON makes MetaOutput an implementation of SeekerOutput

type Metadata

type Metadata struct {
	Error   string `json:"error,omitempty"`
	Warning string `json:"warning,omitempty"`
	Message string `json:"message,omitempty"`
}

Metadata has additional information about an API Response, like error messages

type Response

type Response struct {
	Meta     *Metadata     `json:"meta,omitempty"`
	Contents seeker.Output `json:"contents,omitempty"`
	// contains filtered or unexported fields
}

Response is the structured response of the CFSeeker API

func NewResponse

func NewResponse(w http.ResponseWriter) *Response

NewResponse returns a pointer to an empty Response struct

func (*Response) AttachContents

func (r *Response) AttachContents(c seeker.Output) *Response

AttachContents takes the given interface and assigns it as the response contents

func (Response) Bytes

func (r Response) Bytes() []byte

Bytes marshals the Response to JSON and returns the result as a byte array

func (*Response) Code

func (r *Response) Code(code int) *Response

Code sets the HTTP response code, which will be used if write is called.

func (*Response) Err

func (r *Response) Err(e string) *Response

Err takes the receiver Response, attaches the given message as an error, and then returns the Response object.

func (*Response) Message

func (r *Response) Message(m string) *Response

Message takes the receiver Response, attaches the given message as a informational message, and then returns the Response object.

func (Response) String

func (r Response) String() string

String marshals the Response to JSON and returns the result as a string

func (*Response) Warn

func (r *Response) Warn(w string) *Response

Warn takes the receiver Response, attaches the given message as a warning, and then returns the Response object.

func (*Response) Write

func (r *Response) Write()

type SeekerHandler

type SeekerHandler func(http.ResponseWriter, *http.Request, *seeker.Seeker)

SeekerHandler is a modified version of http.HandlerFunc that receives a Seeker struct that can be used to perform operations

Jump to

Keyboard shortcuts

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