web

package
v0.6.3 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2019 License: MIT Imports: 38 Imported by: 0

Documentation

Overview

Package web handles receiving and supplying information within the node.

AccountBalanceController

AccountBalanceController allows for the display of the active accounts ETH and LINK balances.

API

API contains logic for the web interface to display items.

BridgeTypesController

BridgeTypesController allows for the creation of BridgeTypes on the node. BridgeTypes are the external adapters which add functionality not available in the core, from outside the node.

JobRunsController

JobRunsController allows for the creation of JobRuns within a given Job on the node.

JobSpecsController

JobSpecsController allows for the creation of specs to be added to the node, and shows the current specs which have already been added.

Router

Router defines the valid paths for the node and responds to requests.

Index

Constants

View Source
const (
	// PaginationDefault is the number of records to supply from a paginated
	// request when no size param is supplied.
	PaginationDefault = 25

	// MediaType is the response header for JSONAPI documents.
	MediaType = "application/vnd.api+json"

	// KeyNextLink is the name of the key that contains the HREF for the next
	// document in a paginated response.
	KeyNextLink = "next"
	// KeyPreviousLink is the name of the key that contains the HREF for the
	// previous document in a paginated response.
	KeyPreviousLink = "prev"
)
View Source
const (
	// SessionName is the session name
	SessionName = "clsession"
	// SessionIDKey is the session ID key in the session map
	SessionIDKey = "clsession_id"
	// ExternalInitiatorAccessKeyHeader is the header name for the access key
	// used by external initiators to authenticate
	ExternalInitiatorAccessKeyHeader = "X-Chainlink-EA-AccessKey"
	// ExternalInitiatorSecretHeader is the header name for the secret used by
	// external initiators to authenticate
	ExternalInitiatorSecretHeader = "X-Chainlink-EA-Secret"
)

Variables

View Source
var (
	// ErrorAuthFailed is a generic authentication failed - but not because of
	// some system failure on our behalf (i.e. HTTP 5xx), more detail is not
	// given
	ErrorAuthFailed = errors.New("Authentication failed")
)

Functions

func MatchExactBoxPath

func MatchExactBoxPath(boxList []string, path string) (matchedPath string)

MatchExactBoxPath returns the box path when there is an exact match for the resource and an empty string otherwise

func MatchWildcardBoxPath

func MatchWildcardBoxPath(boxList []string, path string, file string) (matchedPath string)

MatchWildcardBoxPath returns the box path when there is a wildcard match and an empty string otherwise

func NewJSONAPIResponse

func NewJSONAPIResponse(resource interface{}) ([]byte, error)

NewJSONAPIResponse returns a JSONAPI response for a single resource.

func NewPaginatedResponse

func NewPaginatedResponse(url url.URL, size, page, count int, resource interface{}) ([]byte, error)

NewPaginatedResponse returns a jsonapi.Document with links to next and previous collection pages

func ParseJSONAPIResponse

func ParseJSONAPIResponse(input []byte, resource interface{}) error

ParseJSONAPIResponse parses the bytes of the root document and unmarshals it into the given resource.

func ParsePaginatedRequest

func ParsePaginatedRequest(sizeParam, pageParam string) (int, int, int, error)

ParsePaginatedRequest parses the parameters that control pagination for a collection request, returning the size and offset if specified, or a sensible default.

func ParsePaginatedResponse

func ParsePaginatedResponse(input []byte, resource interface{}, links *jsonapi.Links) error

ParsePaginatedResponse parse a JSONAPI response for a document with links

func Router

func Router(app services.Application) *gin.Engine

Router listens and responds to requests to the node for valid paths.

func StatusCodeForError

func StatusCodeForError(err interface{}) int

StatusCodeForError returns an http status code for an error type.

Types

type BridgeTypesController

type BridgeTypesController struct {
	App services.Application
}

BridgeTypesController manages BridgeType requests in the node.

func (*BridgeTypesController) Create

func (btc *BridgeTypesController) Create(c *gin.Context)

Create adds the BridgeType to the given context.

func (*BridgeTypesController) Destroy

func (btc *BridgeTypesController) Destroy(c *gin.Context)

Destroy removes a specific Bridge.

func (*BridgeTypesController) Index

func (btc *BridgeTypesController) Index(c *gin.Context, size, page, offset int)

Index lists Bridges, one page at a time.

func (*BridgeTypesController) Show

func (btc *BridgeTypesController) Show(c *gin.Context)

Show returns the details of a specific Bridge.

func (*BridgeTypesController) Update

func (btc *BridgeTypesController) Update(c *gin.Context)

Update can change the restricted attributes for a bridge

type BulkDeletesController

type BulkDeletesController struct {
	App services.Application
}

BulkDeletesController manages background tasks that delete resources given a query

func (*BulkDeletesController) Delete

func (bdc *BulkDeletesController) Delete(c *gin.Context)

Delete removes all runs given a query Example:

"<application>/bulk_delete_runs"

type ConfigController

type ConfigController struct {
	App services.Application
}

ConfigController manages config variables

func (*ConfigController) Show

func (cc *ConfigController) Show(c *gin.Context)

Show returns the whitelist of config variables Example:

"<application>/config"

type ExternalInitiatorsController

type ExternalInitiatorsController struct {
	App services.Application
}

ExternalInitiatorsController manages external initiators

func (*ExternalInitiatorsController) Create

func (eic *ExternalInitiatorsController) Create(c *gin.Context)

Create builds and saves a new service agreement record.

func (*ExternalInitiatorsController) Destroy

func (eic *ExternalInitiatorsController) Destroy(c *gin.Context)

Destroy deletes an ExternalInitiator

type JobRunsController

type JobRunsController struct {
	App services.Application
}

JobRunsController manages JobRun requests in the node.

func (*JobRunsController) Create

func (jrc *JobRunsController) Create(c *gin.Context)

Create starts a new Run for the requested JobSpec. Example:

"<application>/specs/:SpecID/runs"

func (*JobRunsController) Index

func (jrc *JobRunsController) Index(c *gin.Context, size, page, offset int)

Index returns paginated JobRuns for a given JobSpec Example:

"<application>/runs?jobSpecId=:jobSpecId&size=1&page=2"

func (*JobRunsController) Show

func (jrc *JobRunsController) Show(c *gin.Context)

Show returns the details of a JobRun. Example:

"<application>/runs/:RunID"

func (*JobRunsController) Update

func (jrc *JobRunsController) Update(c *gin.Context)

Update allows external adapters to resume a JobRun, reporting the result of the task and marking it no longer pending. Example:

"<application>/runs/:RunID"

type JobSpecsController

type JobSpecsController struct {
	App services.Application
}

JobSpecsController manages JobSpec requests.

func (*JobSpecsController) Create

func (jsc *JobSpecsController) Create(c *gin.Context)

Create adds validates, saves, and starts a new JobSpec. Example:

"<application>/specs"

func (*JobSpecsController) Destroy

func (jsc *JobSpecsController) Destroy(c *gin.Context)

Destroy soft deletes a job spec. Example:

"<application>/specs/:SpecID"

func (*JobSpecsController) Index

func (jsc *JobSpecsController) Index(c *gin.Context, size, page, offset int)

Index lists JobSpecs, one page at a time. Example:

"<application>/specs?size=1&page=2"

func (*JobSpecsController) Show

func (jsc *JobSpecsController) Show(c *gin.Context)

Show returns the details of a JobSpec. Example:

"<application>/specs/:SpecID"

type KeysController

type KeysController struct {
	App services.Application
}

KeysController manages account keys

func (*KeysController) Create

func (kc *KeysController) Create(c *gin.Context)

Create adds a new account Example:

"<application>/keys"

type ServiceAgreementsController

type ServiceAgreementsController struct {
	App services.Application
}

ServiceAgreementsController manages service agreements.

func (*ServiceAgreementsController) Create

func (sac *ServiceAgreementsController) Create(c *gin.Context)

Create builds and saves a new service agreement record.

func (*ServiceAgreementsController) Show

func (sac *ServiceAgreementsController) Show(c *gin.Context)

Show returns the details of a ServiceAgreement. Example:

"<application>/service_agreements/:SAID"

type Session

type Session struct {
	Authenticated bool `json:"authenticated"`
}

func (Session) GetID

func (s Session) GetID() string

GetID returns the jsonapi ID.

func (Session) GetName

func (Session) GetName() string

GetName returns the collection name for jsonapi.

func (*Session) SetID

func (*Session) SetID(string) error

SetID is used to conform to the UnmarshallIdentifier interface for deserializing from jsonapi documents.

type SessionsController

type SessionsController struct {
	App services.Application
}

SessionsController manages session requests.

func (*SessionsController) Create

func (sc *SessionsController) Create(c *gin.Context)

Create creates a session ID for the given user credentials, and returns it in a cookie.

func (*SessionsController) Destroy

func (sc *SessionsController) Destroy(c *gin.Context)

Destroy erases the session ID for the sole API user.

type TransactionsController

type TransactionsController struct {
	App services.Application
}

TransactionsController displays Ethereum transactions requests.

func (*TransactionsController) Index

func (tc *TransactionsController) Index(c *gin.Context, size, page, offset int)

Index returns paginated transaction attempts

func (*TransactionsController) Show

func (tc *TransactionsController) Show(c *gin.Context)

Show returns the details of a Ethereum Transasction details. Example:

"<application>/transactions/:TxHash"

type TransfersController

type TransfersController struct {
	App services.Application
}

TransfersController can send LINK tokens to another address

func (*TransfersController) Create

func (tc *TransfersController) Create(c *gin.Context)

Create sends ETH from the Chainlink's account to a specified address.

Example: "<application>/withdrawals"

type TxAttemptsController

type TxAttemptsController struct {
	App services.Application
}

TxAttemptsController lists TxAttempts requests.

func (*TxAttemptsController) Index

func (tac *TxAttemptsController) Index(c *gin.Context, size, page, offset int)

Index returns paginated transaction attempts

type UserController

type UserController struct {
	App services.Application
}

UserController manages the current Session's User User.

func (*UserController) AccountBalances

func (c *UserController) AccountBalances(ctx *gin.Context)

AccountBalances returns the account balances of ETH & LINK. Example:

"<application>/user/balances"

func (*UserController) UpdatePassword

func (c *UserController) UpdatePassword(ctx *gin.Context)

UpdatePassword changes the password for the current User.

type WithdrawalsController

type WithdrawalsController struct {
	App services.Application
}

WithdrawalsController can send LINK tokens to another address

func (*WithdrawalsController) Create

func (abc *WithdrawalsController) Create(c *gin.Context)

Create sends LINK from the configured oracle contract to the given address See models.WithdrawalRequest for expected inputs. ContractAddress field is optional.

Example: "<application>/withdrawals"

Jump to

Keyboard shortcuts

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