client

package
v0.0.0-...-13fb019 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2018 License: Apache-2.0 Imports: 29 Imported by: 2

Documentation

Overview

Package client implements the Turbine service interface by constructing an HTTP client to a specified backend api server.

In order to configure the desired Turbine service and Endpoint must be specified which then may be passed into the constructor for a HTTP service:

endpoint, err := NewEndpoint(HTTP, "dev.turbinelabs.io", 8080)
if err != nil {
	return err
}

service := NewAll(Endpoint, apiKey)

For a detailed discussion about what each of these values mean see method docs.

Package client is a generated GoMock package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewAccessTokenV1

func NewAccessTokenV1(
	dest apihttp.Endpoint,
) (*httpAccessTokenV1, error)

NewAccessTokenV1 constructs a new HTTP backed AccessToken API implementation.

Parameters:

dest - service handling our HTTP requests; cf. NewService

func NewAdmin

func NewAdmin(
	dest apihttp.Endpoint,
	apiKey string,
	clientApp App,
) (service.Admin, error)

Create a new Admin backed by a Turbine api server at dest. Communication with this server will happen via HTTP (or HTTPS as specified in the Endpoint) and will sign your requests with the provided apiKey. The Endpoint is copied so changes to headers or clients must be made before invoking NewAdmin.

Service creation can not fail but it does not guarantee that the target Endpoint is a valid, or live, Turbine service.

Parameters: See NewAll.

func NewAll

func NewAll(
	dest apihttp.Endpoint,
	apiKey string,
	clientApp App,
) (service.All, error)

Create a new Service backed by a Turbine api server at dest. Communication with this server will happen via HTTP (or HTTPS as specified in the Endpoint) and will sign your requests with the provided apiKey. The Endpoint is copied so changes to headers or clients must be made before invoking NewAdmin.

Service creation can not fail but it does not guarantee that the target Endpoint is a valid, or live, Turbine service.

Parameters:

dest - a server we want to communicate with, construct via apihttp.NewEndpoint
apiKey - an API key assigned to your organization during setup process

func NewBatchingStatsV2Client

func NewBatchingStatsV2Client(
	maxDelay time.Duration,
	maxSize int,
	dest apihttp.Endpoint,
	apiKey string,
	clientApp App,
	exec executor.Executor,
	logger *log.Logger,
) (statsapi.StatsService, error)

NewBatchingStatsV2Client returns a non-blocking implementation of StatsServiceV2. Each invocation of ForwardV2 accepts a single Payload. The client will return immediately, reporting that all stats were successfully sent. Internally, the stats are buffered until the buffer contains at least maxSize stats or maxDelay time has elapsed since the oldest stats in the buffer were added. At that point the buffered stats are forwarded. Failures are logged, but not reported to the caller. Separate buffers and deadlines are maintained for each unique source, node, and zone combination. In addition, the buffering is optimized to assume that the payloads proxy, proxy version and named limits do not vary across payloads. If the proxy, proxy version, or limits (with the same name) vary across payloads, buffers will be flushed prematurely.

func NewClusterV1

func NewClusterV1(
	dest apihttp.Endpoint,
) (*httpClusterV1, error)

Construct a new HTTP backed api.Cluster API implementation.

Parameters:

dest - service handling our HTTP requests; cf. NewService

func NewDomainV1

func NewDomainV1(
	dest apihttp.Endpoint,
) (*httpDomainV1, error)

Construct a new HTTP backed api.Domain API implementation.

Parameters:

dest - service handling our HTTP requests; cf. NewService

func NewHistoryV1

func NewHistoryV1(dest apihttp.Endpoint) (*httpHistoryV1, error)

Construct a new HTTP backed History API implementation.

Parameters:

dest - service handling our HTTP requests; cf. NewService

func NewListenerV1

func NewListenerV1(
	dest apihttp.Endpoint,
) (*httpListenerV1, error)

Construct a new HTTP backed api.Listener API implementation.

Parameters:

dest - service handling our HTTP requests; cf. NewService

func NewProxyV1

func NewProxyV1(
	dest apihttp.Endpoint,
) (*httpProxyV1, error)

Construct a new HTTP backed api.Proxy API implementation.

Parameters:

dest - service handling our HTTP requests; cf. NewService

func NewRouteV1

func NewRouteV1(
	dest apihttp.Endpoint,
) (*httpRouteV1, error)

Construct a new HTTP backed api.Route API implementation.

Parameters:

dest - service handling our HTTP requests; cf. NewService

func NewSharedRulesV1

func NewSharedRulesV1(
	dest apihttp.Endpoint,
) (*httpSharedRulesV1, error)

Construct a new HTTP backed api.SharedRules API implementation.

Parameters:

dest - service handling our HTTP requests; cf. NewService

func NewStatsV2Client

func NewStatsV2Client(
	dest apihttp.Endpoint,
	apiKey string,
	clientApp App,
	exec executor.Executor,
) (statsapi.StatsService, error)

NewStatsV2Client returns a blocking implementation of StatsForwardService and StatsQueryService. Each invocation of ForwardV2 accepts a single Payload, issues a forwarding request to a remote stats-server and awaits a response.

func NewUserV1

func NewUserV1(
	dest apihttp.Endpoint,
) (*httpUserV1, error)

Construct a new HTTP backed api.User API implementation.

Parameters:

dest - service handling our HTTP requests; cf. NewService

func NewZoneV1

func NewZoneV1(
	dest apihttp.Endpoint,
) (*httpZoneV1, error)

Construct a new HTTP backed api.Zone API implementation.

Parameters:

dest - service handling our HTTP requests; cf. NewService

Types

type App

type App string

App is passed in the X-Tbn-Client-App header in API calls

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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