s3

package
v0.37.0 Latest Latest
Warning

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

Go to latest
Published: May 8, 2019 License: Apache-2.0 Imports: 9 Imported by: 0

README

S3 Service

This service is github.com/aws/aws-sdk-go/service/s3.S3 proxy

To check all supported method run

    endly -s="aws/s3"

To check method contract run endly -s="aws/s3" -a=methodName

    endly -s="aws/s3" -a='listObjects'

On top of that service implements the following helper methods:

  • setupBucketNotification
Usage:
Lambda s3 notification deployment and setup
endly -r=deploy

@deploy.yaml

init:
  functionRole: lambda-filemeta-executor
  functionName: FilemetaFn
  codeZip: ${appPath}filemeta/app/filemeta.zip
  privilegePolicy: ${parent.path}/privilege-policy.json
pipeline:
  deploy:
    build:
      action: exec:run
      target: $target
      sleepTimeMs: 1500
      errors:
        - ERROR
      commands:
        - cd ${appPath}filemeta/app
        - unset GOPATH
        - export GOOS=linux
        - export GOARCH=amd64
        - go build -o filemeta
        - zip -j filemeta.zip filemeta

    setupFunction:
      action: aws/lambda:deploy
      credentials: $awsCredentials
      functionname: $functionName
      runtime:  go1.x
      handler: filemeta
      code:
        zipfile: $LoadBinary(${codeZip})
      rolename: lambda-filemeta-executor
      define:
        - policyname: s3-mye2e-bucket-role
          policydocument: $Cat('${privilegePolicy}')
      attach:
        - policyarn: arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole

    notification:
      action: aws/s3:setupBucketNotification
      credentials: $awsCredentials
      sleepTimeMs: 10000
      bucket: mye2e-bucket2
      lambdaFunctionConfigurations:
        - functionName: $functionName
          id: ObjectCreatedEvents
          events:
            - s3:ObjectCreated:*
          filter:
            prefix:
              - folder1
            suffix:
              - .csv

Documentation

Index

Constants

View Source
const (
	//ServiceID aws s3 service id.
	ServiceID = "aws/s3"
)

Variables

This section is empty.

Functions

func GetClient

func GetClient(context *endly.Context) (*s3.S3, error)

GetClient returns s3 client from context

func New

func New() endly.Service

New creates a new AWS S3 service.

Types

type LambdaFunctionConfiguration

type LambdaFunctionConfiguration struct {
	s3.LambdaFunctionConfiguration `yaml:",inline" json:",inline"`
	Filter                         *NotificationFilter
	lambda.SetupPermissionInput
}

func (*LambdaFunctionConfiguration) Init

type NotificationConfiguration

type NotificationConfiguration struct {
	*s3.NotificationConfiguration
	LambdaFunctionConfigurations []*LambdaFunctionConfiguration
}

type NotificationFilter

type NotificationFilter struct {
	Prefix []string
	Suffix []string
}

func (*NotificationFilter) ToNotificationConfigurationFilter

func (f *NotificationFilter) ToNotificationConfigurationFilter() *s3.NotificationConfigurationFilter

type SetupBucketNotificationInput

type SetupBucketNotificationInput struct {
	Bucket                     *string
	*NotificationConfiguration `json:",inline"`
}

SetupBucketNotificationInput setup permission for specified bucket

func (*SetupBucketNotificationInput) Init

func (*SetupBucketNotificationInput) Validate

func (i *SetupBucketNotificationInput) Validate() error

type SetupBucketNotificationOutput

type SetupBucketNotificationOutput struct {
	Bucket                        *string
	*s3.NotificationConfiguration `json:",inline"`
	Permissions                   []*lambda.SetupPermissionInput
}

Jump to

Keyboard shortcuts

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