client

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2016 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func JoinByFormat

func JoinByFormat(data []string, format string) string

JoinByFormat joins a string array by a known format:

csv: comma separated value (default)
ssv: space separated value
tsv: tab separated value
pipes: pipe (|) separated value

func WithRetries

func WithRetries(ctx context.Context, retries int) context.Context

WithRetries returns a new context that overrides the number of retries to do for a particular request.

Types

type Client

type Client interface {

	// Wagpatch makes a PATCH request to /wagpatch.
	// Special wag patch type
	Wagpatch(ctx context.Context, i *models.PatchData) (*models.Data, error)

	// Wagpatch2 makes a PATCH request to /wagpatch2.
	// Wag patch with another argument
	Wagpatch2(ctx context.Context, i *models.Wagpatch2Input) (*models.Data, error)
}

Client defines the methods available to clients of the wag-patch service.

type MockClient

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

Mock of Client interface

func NewMockClient

func NewMockClient(ctrl *gomock.Controller) *MockClient

func (*MockClient) EXPECT

func (_m *MockClient) EXPECT() *_MockClientRecorder

func (*MockClient) Wagpatch

func (_m *MockClient) Wagpatch(ctx context.Context, i *models.PatchData) (*models.Data, error)

func (*MockClient) Wagpatch2

func (_m *MockClient) Wagpatch2(ctx context.Context, i *models.Wagpatch2Input) (*models.Data, error)

type WagClient

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

WagClient is used to make requests to the wag-patch service.

func New

func New(basePath string) *WagClient

New creates a new client. The base path and http transport are configurable.

func NewFromDiscovery

func NewFromDiscovery() (*WagClient, error)

NewFromDiscovery creates a client from the discovery environment variables. This method requires the three env vars: SERVICE_WAG_PATCH_HTTP_(HOST/PORT/PROTO) to be set. Otherwise it returns an error.

func (*WagClient) Wagpatch

func (c *WagClient) Wagpatch(ctx context.Context, i *models.PatchData) (*models.Data, error)

Wagpatch makes a PATCH request to /wagpatch. Special wag patch type

func (*WagClient) Wagpatch2

func (c *WagClient) Wagpatch2(ctx context.Context, i *models.Wagpatch2Input) (*models.Data, error)

Wagpatch2 makes a PATCH request to /wagpatch2. Wag patch with another argument

func (*WagClient) WithRetries

func (c *WagClient) WithRetries(retries int) *WagClient

WithRetries returns a new client that retries all GET operations until they either succeed or fail the number of times specified.

func (*WagClient) WithTimeout

func (c *WagClient) WithTimeout(timeout time.Duration) *WagClient

WithTimeout returns a new client that has the specified timeout on all operations. To make a single request have a timeout use context.WithTimeout as described here: https://godoc.org/golang.org/x/net/context#WithTimeout.

Jump to

Keyboard shortcuts

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