client

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2020 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIAuth

type APIAuth struct {
	AuthType         string // AWS_IAM, API_KEY
	APIKey           string // Only required if Type is API_KEY
	Profile          string // Only required if Type is API_KEY
	AwsAccessKey     string // Only required if Type is AWS_IAM and not using profile
	AwsAccessSecret  string // Only required if Type is AWS_IAM and not using profile
	AwsSecurityToken string // Only required if Type is AWS_IAM and not using profile

}

APIAuth parameters used to authenticate with AppSync

type AppSyncClient

type AppSyncClient struct {
	Connection    *(websocket.Conn)
	URL           string
	Auth          APIAuth
	Subscriptions []subscription
	Data          chan []byte
	Done          chan struct{}
	Interrupt     chan os.Signal
}

AppSyncClient main object containing all of the information about connections to the API

func CreateClient

func CreateClient(urlAppSync, profile string) (*AppSyncClient, error)

CreateClient initialization function that enables users to create a Client object

func (*AppSyncClient) CloseConnection

func (client *AppSyncClient) CloseConnection(restart, timeout bool) error

CloseConnection closes connections and unsubscribes from subscriptions (if necessary)

func (*AppSyncClient) Query

func (client *AppSyncClient) Query(method, variables, query string) (str string, err error)

Query allows user to synchronously interact with API

func (*AppSyncClient) StartConnection

func (client *AppSyncClient) StartConnection() error

StartConnection Starts long running websocket connection to AppSync,

func (*AppSyncClient) Subscribe

func (client *AppSyncClient) Subscribe(Query string, Handler CallbackFn) (string, error)

Subscribe subscribes to a specific websocket. This uses the generic websocket subscriptions

type CallbackFn added in v0.1.3

type CallbackFn func(string) error

CallbackFn is the function that the client invokes upon reciept

type IamHeaders

type IamHeaders struct {
	Accept            string `json:"accept"`
	ContentEncoding   string `json:"content-encoding"`
	ContentType       string `json:"content-type"`
	Host              string `json:"host"`
	XAmzDate          string `json:"x-amz-date"`
	XAmzSecurityToken string `json:"X-Amz-Security-Token"`
	Authorization     string `json:"Authorization"`
}

IamHeaders object contains headers required to sign websocket requests

type SubscriptionRequest

type SubscriptionRequest struct {
	ID      string                     `json:"id"`
	Payload subscriptionRequestPayload `json:"payload"`
	Type    string                     `json:"type"`
	Handler CallbackFn                 `json:"-"`
}

SubscriptionRequest a request submitted to the client object to subscribe and handle data via a subscription

Jump to

Keyboard shortcuts

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