api

package
v1.2.4 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2017 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NotLoggedInError = errors.New("You must be logged in")

Functions

func NewHttpClient

func NewHttpClient(cliConnection Connection) (*http.Client, error)

Types

type Client

type Client struct {
	BaseUrl   *url.URL
	AuthToken string
}

func NewClient

func NewClient(connection Connection) (*Client, error)

func (*Client) Authorize

func (c *Client) Authorize(next func() (*http.Request, error)) func() (*http.Request, error)

func (*Client) HandleFiltersAndParameters

func (c *Client) HandleFiltersAndParameters(next func() (*http.Request, error)) func(filter Filter, params map[string]interface{}) (*http.Request, error)

func (*Client) NewGetAppsRequest

func (c *Client) NewGetAppsRequest() (*http.Request, error)

func (*Client) NewGetSpacesRequest

func (c *Client) NewGetSpacesRequest() (*http.Request, error)

type CloudControllerClient

type CloudControllerClient interface {
	Do(*http.Request) (*http.Response, error)
}

type Connection

type Connection interface {
	IsLoggedIn() (bool, error)
	IsSSLDisabled() (bool, error)
	ApiEndpoint() (string, error)
	AccessToken() (string, error)

	Username() (string, error)

	CliCommandWithoutTerminalOutput(args ...string) ([]string, error)
	GetApp(string) (plugin_models.GetAppModel, error)
	GetOrg(string) (plugin_models.GetOrg_Model, error)
	GetSpace(string) (plugin_models.GetSpace_Model, error)
	GetCurrentSpace() (plugin_models.Space, error)
}

type EqualFilter

type EqualFilter struct {
	Name  string
	Value interface{}
}

func (EqualFilter) ToFilterQueryParam

func (f EqualFilter) ToFilterQueryParam() string

type Filter

type Filter interface {
	ToFilterQueryParam() string
}

type Filters

type Filters []Filter

func (Filters) ToFilterQueryParam

func (f Filters) ToFilterQueryParam() string

type InclusionFilter

type InclusionFilter struct {
	Name   string
	Values []interface{}
}

func (InclusionFilter) ToFilterQueryParam

func (f InclusionFilter) ToFilterQueryParam() string

type PageParser

type PageParser struct{}

func (PageParser) Parse

func (p PageParser) Parse(body []byte) (PaginatedResponse, error)

type PaginatedParser

type PaginatedParser interface {
	Parse([]byte) (PaginatedResponse, error)
}

type PaginatedRequester

type PaginatedRequester struct {
	RequestFactory RequestFactory
	Client         CloudControllerClient
	PageParser     PaginatedParser
}

func NewPaginatedRequester

func NewPaginatedRequester(cliConnection Connection, requestFactory RequestFactory) (*PaginatedRequester, error)

func (*PaginatedRequester) Do

func (p *PaginatedRequester) Do(filter Filter, params map[string]interface{}) ([][]byte, error)

type PaginatedResponse

type PaginatedResponse struct {
	TotalPages int `json:"total_pages"`
}

type RequestFactory

type RequestFactory func(Filter, map[string]interface{}) (*http.Request, error)

TODO: Fix counterfeiter to find Filter correctly #NoFilter

Directories

Path Synopsis
This file was generated by counterfeiter
This file was generated by counterfeiter

Jump to

Keyboard shortcuts

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