router

package
v7.0.0-beta.29+incompa... Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2020 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package router is a GoLang library that interacts with CloudFoundry Go Router

Package router contains utilities to make call to the router API

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is a client that can be used to talk to a Cloud Controller's V2 Endpoints.

func NewClient

func NewClient(config Config) *Client

NewClient returns a new Router Client.

func (*Client) GetRouterGroupByName

func (client *Client) GetRouterGroupByName(name string) (RouterGroup, error)

GetRouterGroupByName returns a list of RouterGroups.

func (*Client) WrapConnection

func (client *Client) WrapConnection(wrapper ConnectionWrapper)

WrapConnection wraps the current Client connection in the wrapper.

type Config

type Config struct {
	// AppName is the name of the application/process using the client.
	AppName string

	// AppVersion is the version of the application/process using the client.
	AppVersion string

	// ConnectionConfig is the configuration for the client connection.
	ConnectionConfig

	// RoutingEndpoint is the url of the router API.
	RoutingEndpoint string

	// Wrappers that apply to the client connection.
	Wrappers []ConnectionWrapper
}

Config allows the Client to be configured

type Connection

type Connection interface {
	Make(request *Request, passedResponse *Response) error
}

Connection creates and executes http requests

type ConnectionConfig

type ConnectionConfig struct {
	DialTimeout       time.Duration
	SkipSSLValidation bool
}

ConnectionConfig is for configuring the RouterConnection

type ConnectionWrapper

type ConnectionWrapper interface {
	Connection
	Wrap(innerconnection Connection) Connection
}

ConnectionWrapper can wrap a given connection allowing the wrapper to modify all requests going in and out of the given connection.

type Params

type Params map[string]string

Params represents URI parameters for a request.

type Request

type Request struct {
	*http.Request
	// contains filtered or unexported fields
}

Request represents the request of the router

func NewRequest

func NewRequest(request *http.Request, body io.ReadSeeker) *Request

func (*Request) ResetBody

func (r *Request) ResetBody() error

type Response

type Response struct {
	// Result represents the resource entity type that is expected in the
	// response JSON.
	Result interface{}

	// RawResponse represents the response body.
	RawResponse []byte

	// HTTPResponse represents the HTTP response object.
	HTTPResponse *http.Response
}

Response represents a Router response object.

type RouterConnection

type RouterConnection struct {
	HTTPClient *http.Client
}

RouterConnection represents the connection to Router

func NewConnection

func NewConnection(config ConnectionConfig) *RouterConnection

NewConnection returns a pointer to a new RouterConnection with the provided configuration

func (*RouterConnection) Make

func (connection *RouterConnection) Make(request *Request, responseToPopulate *Response) error

Make performs the request and parses the response.

type RouterGroup

type RouterGroup struct {
	GUID            string `json:"guid"`
	Name            string `json:"name"`
	ReservablePorts string `json:"reservable_ports"`
	Type            string `json:"type"`
}

RouterGroup represents a router group.

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.
wrapperfakes
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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