aws

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2021 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultRegion describes default region in aws
	DefaultRegion = "us-east-2"
)

Variables

This section is empty.

Functions

func GetAssetFileKey

func GetAssetFileKey(appID apps.AppID, version apps.AppVersion, name string) string

GetAssetFileKey generates key for a specific asset in S3, key can be 1024 characters long.

func NewAWSSessionWithLogger

func NewAWSSessionWithLogger(config *aws.Config, logger log) (*session.Session, error)

NewAWSSessionWithLogger initializes an AWS session instance with logging handler for debuging only.

Types

type Client

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

Client is a client for interacting with AWS resources.

func NewAWSClient

func NewAWSClient(awsAccessKeyID, awsSecretAccessKey string, logger log) *Client

func NewAWSClientWithConfig

func NewAWSClientWithConfig(config *aws.Config, bucket string, logger log) *Client

NewAWSClientWithConfig returns a new instance of Client with a custom configuration.

func (*Client) CheckIfBucketExists

func (c *Client) CheckIfBucketExists(name string) (bool, error)

CheckIfBucketExists return true if a bucket with the given name exists. Otherwise it returns false.

func (*Client) CreateBucket

func (c *Client) CreateBucket(bucket string) error

CreateBucket creates a new s3 bucket.

func (*Client) GetManifest

func (c *Client) GetManifest(appID apps.AppID, version apps.AppVersion) (*apps.Manifest, error)

GetManifest returns a manifest file for an app from the S3.

func (*Client) InvokeLambda

func (c *Client) InvokeLambda(appID apps.AppID, appVersion apps.AppVersion, functionName, invocationType string, payload []byte) ([]byte, error)

InvokeLambda runs a lambda function with specified name and returns a payload

func (*Client) ProvisionApp

func (c *Client) ProvisionApp(b []byte, shouldUpdate bool) error

func (*Client) ProvisionAppFromFile

func (c *Client) ProvisionAppFromFile(path string, shouldUpdate bool) error

func (*Client) ProvisionAppFromURL

func (c *Client) ProvisionAppFromURL(releaseURL string, shouldUpdate bool) error

ProvisionApp gets a release URL parses the release and creates an App in AWS releaseURL should contain a zip with lambda functions' zip files and a `manifest.json` ~/my_app.zip

 |-- manifest.json
 |-- static
		|-- icon.png
		|-- coolFile.txt
 |-- my_nodejs_function.zip
     |-- index.js
     |-- node-modules
         |-- async
         |-- aws-sdk
 |-- my_python_function.zip
     |-- lambda_function.py
     |-- __pycache__
     |-- certifi/

func (*Client) RefreshService

func (c *Client) RefreshService(awsAccessKeyID, awsSecretAccessKey string)

RefreshService refreshes aws session using with new access key and secret.

func (*Client) S3AssetDownload

func (c *Client) S3AssetDownload(item string) ([]byte, error)

S3AssetDownload is used to download app's static assets from the S3.

func (*Client) S3FileDownload

func (c *Client) S3FileDownload(bucket, item string) ([]byte, error)

S3FileDownload is used to download files from the S3.

func (*Client) S3FileUpload

func (c *Client) S3FileUpload(key string, body io.Reader) error

S3FileUpload uploads file to a specific S3 bucket

func (*Client) SaveManifest

func (c *Client) SaveManifest(manifest *apps.Manifest) error

SaveManifest saves manifest file in S3

func (*Client) Service

func (c *Client) Service() *Service

Service contructs an AWS session if not yet successfully done and returns AWS clients.

type Service

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

Service hold AWS clients for each service.

func NewService

func NewService(sess *session.Session) *Service

NewService creates a new instance of Service.

Jump to

Keyboard shortcuts

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