clients

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: May 21, 2020 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MasterWorkspace = "master"
	HeaderETag      = "ETag"
)
View Source
const (
	AppClient = iota
	InfraClient
	PlatformClient
	ExternalClient
)

Variables

This section is empty.

Functions

func CreateAppClient

func CreateAppClient(service *Service, major int, config *Config) *gentleman.Client

func CreateExternalClient

func CreateExternalClient(url string, config *Config) *gentleman.Client

func CreateGenericClient

func CreateGenericClient(url string, service *Service, config *Config, clientType ClientType) *gentleman.Client

func CreateInfraClient

func CreateInfraClient(service *Service, config *Config) *gentleman.Client

func CreatePlatformClient

func CreatePlatformClient(config *Config) *gentleman.Client

func GetCredential

func GetCredential(request *http.Request) string

func UserAgentName

func UserAgentName(config *Config) string

Types

type CallTree

type CallTree struct {
	Call     string      `json:"call"`
	Status   int         `json:"status"`
	Cache    string      `json:"cache"`
	Time     int64       `json:"time"`
	Children []*CallTree `json:"children,omitempty"`
}

type ClientType

type ClientType int

type Config

type Config struct {
	Account   string
	Workspace string
	Region    string
	AuthToken string
	Endpoint  string
	AuthFunc  func() string
	UserAgent string
	Recorder  RequestRecorder
	Context   goContext.Context
	Timeout   time.Duration
	Transport http.RoundTripper
}

type ErrorDescriptor

type ErrorDescriptor struct {
	Code    string `json:"code"`
	Message string `json:"message"`
}

type IOHeadersRecorder

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

func NewIOHeadersRecorder

func NewIOHeadersRecorder(parent *http.Request) *IOHeadersRecorder

func (*IOHeadersRecorder) AddResponseHeaders

func (r *IOHeadersRecorder) AddResponseHeaders(out http.Header)

AddResponseHeaders writes accumulated headers to an outgoing response

func (*IOHeadersRecorder) BeforeDial

func (r *IOHeadersRecorder) BeforeDial(req *http.Request)

func (*IOHeadersRecorder) ClearSmartCacheHeaders

func (r *IOHeadersRecorder) ClearSmartCacheHeaders()

func (*IOHeadersRecorder) CopyFrom

func (r *IOHeadersRecorder) CopyFrom(other *IOHeadersRecorder)

func (*IOHeadersRecorder) Record

func (r *IOHeadersRecorder) Record(req *http.Request, res *http.Response, responseTime time.Duration)

Record records a request made in order to accumulate headers

type NoUserAgentError

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

func NewNoUserAgentError

func NewNoUserAgentError(message string) *NoUserAgentError

func (*NoUserAgentError) Error

func (e *NoUserAgentError) Error() string

type RequestRecorder

type RequestRecorder interface {
	BeforeDial(req *http.Request)
	Record(req *http.Request, res *http.Response, responseTime time.Duration)
}

type ResponseError

type ResponseError struct {
	Response   *http.Response
	StatusCode int
	Code       string
	Message    string
}

func (ResponseError) Error

func (err ResponseError) Error() string

type Service

type Service struct {
	Name   string
	Vendor string
	Major  int
}

Jump to

Keyboard shortcuts

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