client

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 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
}

func CreateClient

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

func (*AppSyncClient) CloseConnection

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

func (*AppSyncClient) GenerateAuthFields

func (client *AppSyncClient) GenerateAuthFields() (string, error)

func (*AppSyncClient) Query

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

func (*AppSyncClient) StartConnection

func (client *AppSyncClient) StartConnection() error

func (*AppSyncClient) Subscribe

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

type AppSyncMessage

type AppSyncMessage struct {
	ID      string `json:"id"`
	Type    string `json:"type"`
	Payload struct {
		Data json.RawMessage
	} `json:"payload"`
}

type DataHandler

type DataHandler func(string) error

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- all headers required to sign websocket requests

type Subscription

type Subscription struct {
	ID      string
	Query   string
	Handler DataHandler
}

type SubscriptionRequest

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

SubscriptionRequest- APpSync template

type SubscriptionRequestExtensions

type SubscriptionRequestExtensions struct {
	Authorization IamHeaders `json:"authorization"`
}

type SubscriptionRequestPayload

type SubscriptionRequestPayload struct {
	Data       string                        `json:"data"`
	Extensions SubscriptionRequestExtensions `json:"extensions"`
}

Jump to

Keyboard shortcuts

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