net

package
v6.4.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2014 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	JOB_FINISHED             = "finished"
	JOB_FAILED               = "failed"
	DEFAULT_POLLING_THROTTLE = 5 * time.Second
	ASYNC_REQUEST_TIMEOUT    = 10 * time.Minute
)

Variables

This section is empty.

Functions

func NewTLSConfig

func NewTLSConfig(trustedCerts []tls.Certificate, disableSSL bool) (TLSConfig *tls.Config)

func NewWarningsCollector

func NewWarningsCollector(ui terminal.UI, warning_producers ...WarningProducer) (warnings_collector warningsCollector)

func PrepareRedirect

func PrepareRedirect(req *http.Request, via []*http.Request) error

func WrapNetworkErrors

func WrapNetworkErrors(host string, err error) error

Types

type AsyncResource

type AsyncResource struct {
	Metadata struct {
		URL string
	}
}

type Gateway

type Gateway struct {
	PollingEnabled  bool
	PollingThrottle time.Duration

	Clock func() time.Time
	// contains filtered or unexported fields
}

func NewCloudControllerGateway

func NewCloudControllerGateway(config configuration.Reader, clock func() time.Time) Gateway

func NewUAAGateway

func NewUAAGateway(config configuration.Reader) Gateway

func (*Gateway) AsyncTimeout

func (gateway *Gateway) AsyncTimeout() time.Duration

func (Gateway) CreateResource

func (gateway Gateway) CreateResource(url string, body io.ReadSeeker, resource ...interface{}) (apiErr error)

func (Gateway) CreateResourceFromStruct

func (gateway Gateway) CreateResourceFromStruct(url string, resource interface{}) error

func (Gateway) DeleteResource

func (gateway Gateway) DeleteResource(url string) (apiErr error)

func (Gateway) GetResource

func (gateway Gateway) GetResource(url string, resource interface{}) (err error)

func (Gateway) ListPaginatedResources

func (gateway Gateway) ListPaginatedResources(target string,
	path string,
	resource interface{},
	cb func(interface{}) bool) (apiErr error)

func (Gateway) NewRequest

func (gateway Gateway) NewRequest(method, path, accessToken string, body io.ReadSeeker) (req *Request, apiErr error)

func (Gateway) PerformPollingRequestForJSONResponse

func (gateway Gateway) PerformPollingRequestForJSONResponse(request *Request, response interface{}, timeout time.Duration) (headers http.Header, apiErr error)

func (Gateway) PerformRequest

func (gateway Gateway) PerformRequest(request *Request) (rawResponse *http.Response, apiErr error)

func (Gateway) PerformRequestForJSONResponse

func (gateway Gateway) PerformRequestForJSONResponse(request *Request, response interface{}) (headers http.Header, apiErr error)

func (Gateway) PerformRequestForTextResponse

func (gateway Gateway) PerformRequestForTextResponse(request *Request) (response string, headers http.Header, apiErr error)

func (*Gateway) SetTokenRefresher

func (gateway *Gateway) SetTokenRefresher(auth tokenRefresher)

func (*Gateway) SetTrustedCerts

func (gateway *Gateway) SetTrustedCerts(certificates []tls.Certificate)

func (Gateway) UpdateResource

func (gateway Gateway) UpdateResource(url string, body io.ReadSeeker, resource ...interface{}) (apiErr error)

func (Gateway) UpdateResourceFromStruct

func (gateway Gateway) UpdateResourceFromStruct(url string, resource interface{}) error

func (Gateway) UpdateResourceSync

func (gateway Gateway) UpdateResourceSync(url string, body io.ReadSeeker, resource ...interface{}) (apiErr error)

func (Gateway) Warnings

func (gateway Gateway) Warnings() []string

type JobResource

type JobResource struct {
	Entity struct {
		Status       string
		ErrorDetails struct {
			Description string
		} `json:"error_details"`
	}
}

type PaginatedResources

type PaginatedResources struct {
	NextURL        string          `json:"next_url"`
	ResourcesBytes json.RawMessage `json:"resources"`
	// contains filtered or unexported fields
}

func NewPaginatedResources

func NewPaginatedResources(exampleResource interface{}) PaginatedResources

func (PaginatedResources) Resources

func (this PaginatedResources) Resources() ([]interface{}, error)

type Request

type Request struct {
	HttpReq      *http.Request
	SeekableBody io.ReadSeeker
}

type WarningProducer

type WarningProducer interface {
	Warnings() []string
}

Jump to

Keyboard shortcuts

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