threescale

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: 1 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthorizeExtensions added in v0.0.4

type AuthorizeExtensions struct {
	// List of children (methods) associated with a parent(metric)
	Hierarchy api.Hierarchy
	// Result from rate limiting extension 'limit_headers' - will be nil if not leveraged or unsupported
	RateLimits *api.RateLimits
	// List of usage reports - list will be empty if no limits set
	UsageReports api.UsageReports
}

AuthorizeExtensions may be returned by a client when the caller leverages the extensions provided by backend. Not all clients will support returning extensions.

type AuthorizeResult added in v0.0.3

type AuthorizeResult struct {
	// Authorized states if the call has been authorized by 3scale
	Authorized bool
	// ErrorCode as returned by backend - see https://github.com/3scale/apisonator/blob/v2.96.2/docs/rfcs/error_responses.md
	ErrorCode string
	AuthorizeExtensions
}

AuthorizeResult is returned by a client for Auth and AuthRep requests

type Client

type Client interface {
	// Authorize is a read-only operation to authorize an application with the authentication
	// provided in the transaction params
	// Where multiple transactions are provided, all but the first should be discarded
	Authorize(request Request) (*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
	// Where multiple transactions are provided, all but the first should be discarded
	AuthRep(request Request) (*AuthorizeResult, error)
	// Report the transactions to 3scale backend with the authentication provided in the transactions params
	Report(request Request) (*ReportResult, error)
	// GetPeer returns the hostname of the connected backend
	GetPeer() string
}

Client specifies the behaviour expected for a 3scale backend client

type ReportResult added in v0.0.3

type ReportResult struct {
	// Accepted notifies us that the report request was accepted for processing in 3scale backend
	Accepted bool
	// ErrorCode as returned by backend - see https://github.com/3scale/apisonator/blob/v2.96.2/docs/rfcs/error_responses.md
	ErrorCode string
}

ReportResult should be returned by client implementations for report requests

type Request added in v0.0.3

type Request struct {
	Auth       api.ClientAuth
	Extensions api.Extensions
	Service    api.Service
	// Transactions must be non nil and non empty
	// For Authorize and AuthRep calls, a single transaction (index 0 will) be accepted, others will be discarded
	Transactions []api.Transaction
}

Request encapsulates the requirements for a successful api call to 3scale backend

func (Request) GetServiceID added in v0.0.4

func (r Request) GetServiceID() api.Service

GetServiceID from Request

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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