http

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2020 License: Apache-2.0 Imports: 14 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client interacts with 3scale Service Management API and implements a threescale client

func NewClient

func NewClient(backendURL string, httpClient *http.Client) (*Client, error)

NewClient returns a pointer to a Client providing some verification and sanity checking of the backendURL input. backendURL should take one of the following formats:

func NewDefaultClient

func NewDefaultClient() (*Client, error)

NewDefaultClient returns a pointer to Client which is configured for 3scale SaaS platform.

func (*Client) AuthRep

func (c *Client) AuthRep(apiCall threescale.Request) (*threescale.AuthorizeResult, error)

AuthRep should be used to authorize and report, in a single transaction for an application with the authentication provided in the transaction params

func (*Client) AuthRepWithOptions

func (c *Client) AuthRepWithOptions(apiCall threescale.Request, options ...Option) (*threescale.AuthorizeResult, error)

AuthRepWithOptions provides the same behaviour as AuthRep with additional functionality provided by Option(s)

func (*Client) Authorize

func (c *Client) Authorize(apiCall threescale.Request) (*threescale.AuthorizeResult, error)

Authorize is a read-only operation to authorize an application with the authentication provided in the transaction params

func (*Client) AuthorizeWithOptions

func (c *Client) AuthorizeWithOptions(apiCall threescale.Request, options ...Option) (*threescale.AuthorizeResult, error)

AuthorizeWithOptions provides the same behaviour as Authorize with additional functionality provided by Option(s)

func (*Client) GetPeer

func (c *Client) GetPeer() string

GetPeer returns the hostname of the backend for the client

func (*Client) GetVersion

func (c *Client) GetVersion() (string, error)

GetVersion returns the version of the backend for this client (remote call)

func (*Client) Report

func (c *Client) Report(apiCall threescale.Request) (*threescale.ReportResult, error)

func (*Client) ReportWithOptions

func (c *Client) ReportWithOptions(apiCall threescale.Request, options ...Option) (*threescale.ReportResult, error)

ReportWithOptions provides the same behaviour as Report with additional functionality provided by Option(s)

type InstrumentationCB

type InstrumentationCB func(ctx context.Context, hostName string, statusCode int, requestDuration time.Duration)

InstrumentationCB provides a callback hook into the client at response time to provide information about the underlying request to the remote host

type Option

type Option func(*Options)

Option defines a callback function which is used to provide functional options to a request

func WithContext

func WithContext(ctx context.Context) Option

WithContext wraps the http transaction to 3scale backend with the provided context

func WithInstrumentationCallback

func WithInstrumentationCallback(callback InstrumentationCB) Option

WithInstrumentationCallback allows the caller to provide an optional callback function that will be called in a separate goroutine, with the details of the underlying request to 3scale if present as an option

type Options

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

Options to provide optional behaviour to the standard APIs for Authorize, AuthRep and Report

Jump to

Keyboard shortcuts

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