cfclient

package
v0.13.3 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2022 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	Config   Config
	Endpoint Endpoints
}

Client used to communicate with Cloud Foundry

func NewClient

func NewClient(config *Config) (client *Client, err error)

NewClient returns a new client

func (*Client) DoRequest

func (c *Client) DoRequest(r *Request) (*http.Response, error)

DoRequest runs a request with our client

func (*Client) NewRequest

func (c *Client) NewRequest(method, path string) *Request

NewRequest is used to create a new Request

func (*Client) NewRequestWithBody

func (c *Client) NewRequestWithBody(method, path string, body io.Reader) *Request

NewRequestWithBody is used to create a new request with

type CloudFoundryError

type CloudFoundryError struct {
	Code   int    `json:"code"`
	Title  string `json:"title"`
	Detail string `json:"detail"`
}

func CloudFoundryToHttpError

func CloudFoundryToHttpError(cfErrors CloudFoundryErrors) CloudFoundryError

func (CloudFoundryError) Error

func (cfErr CloudFoundryError) Error() string

type CloudFoundryErrors

type CloudFoundryErrors struct {
	Errors []CloudFoundryError `json:"errors"`
}

type CloudFoundryHTTPError

type CloudFoundryHTTPError struct {
	StatusCode int
	Status     string
	Body       []byte
}

func (CloudFoundryHTTPError) Error

func (e CloudFoundryHTTPError) Error() string

type Config

type Config struct {
	ApiAddress        string `json:"api_url"`
	Username          string `json:"user"`
	Password          string `json:"password"`
	ClientID          string `json:"client_id"`
	ClientSecret      string `json:"client_secret"`
	SkipSslValidation bool   `json:"skip_ssl_validation"`
	HttpClient        *http.Client
	Token             string `json:"auth_token"`
	TokenSource       oauth2.TokenSource

	UserAgent string `json:"user_agent"`
	Origin    string `json:"-"`
	// contains filtered or unexported fields
}

Config is used to configure the creation of a client

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig creates a default config object used by CF client

type EndpointUrl

type EndpointUrl struct {
	URL string `json:"href"`
}

type Endpoints

type Endpoints struct {
	Links Links `json:"links"`
}
type Links struct {
	AuthEndpoint  EndpointUrl `json:"login"`
	TokenEndpoint EndpointUrl `json:"uaa"`
}

type LoginHint

type LoginHint struct {
	Origin string `json:"origin"`
}

type Request

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

Request is used to help build up a request

Jump to

Keyboard shortcuts

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