platform

package
v0.0.0-...-cec44dd Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2021 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var File_platform_output_proto protoreflect.FileDescriptor

Functions

func AddFile

func AddFile(c context.Context, api S3BucketAPI, input *s3.PutObjectInput) (*s3.PutObjectOutput, error)

func BucketExists

func BucketExists(err error) bool

func CreateBucket

func CreateBucket(p *Platform, client *s3.Client) error

func DetectMimeType

func DetectMimeType(fname string, buffer []byte) string

func EmptyBucket

func EmptyBucket(c context.Context, client *s3.Client, bucket string) error

func MakeBucket

MakeBucket creates an Amazon S3 bucket. Inputs:

c is the context of the method call, which includes the AWS Region
api is the interface that defines the method call
input defines the input arguments to the service call.

Output:

If success, a CreateBucketOutput object containing the result of the service call and nil.
Otherwise, nil and an error from the call to CreateBucket.

func PutBucketPolicy

func PutBucketPolicy(b string, client *s3.Client) error

func PutBucketWebsite

func PutBucketWebsite(b string, client *s3.Client) error

func PutObjects

func PutObjects(b, buildDir, subPath string, client *s3.Client, errors *[]string) []string

PutObjects recursively checks for files in build path and uploads to specified s3 bucket. The errors slice keeps track of errors found during upload.

Types

type Deployment

type Deployment struct {
	Bucket string `protobuf:"bytes,1,opt,name=bucket,proto3" json:"bucket,omitempty"`
	Region string `protobuf:"bytes,2,opt,name=region,proto3" json:"region,omitempty"`
	// contains filtered or unexported fields
}

You can customise this message to change the fields for the output value from your Deployment

func (*Deployment) Descriptor deprecated

func (*Deployment) Descriptor() ([]byte, []int)

Deprecated: Use Deployment.ProtoReflect.Descriptor instead.

func (*Deployment) GetBucket

func (x *Deployment) GetBucket() string

func (*Deployment) GetRegion

func (x *Deployment) GetRegion() string

func (*Deployment) ProtoMessage

func (*Deployment) ProtoMessage()

func (*Deployment) ProtoReflect

func (x *Deployment) ProtoReflect() protoreflect.Message

func (*Deployment) Reset

func (x *Deployment) Reset()

func (*Deployment) String

func (x *Deployment) String() string

type Platform

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

func (*Platform) Config

func (p *Platform) Config() (interface{}, error)

Implement Configurable

func (*Platform) ConfigSet

func (p *Platform) ConfigSet(config interface{}) error

Implement ConfigurableNotify

func (*Platform) DeployFunc

func (p *Platform) DeployFunc() interface{}

Implement Platform

func (*Platform) DestroyFunc

func (p *Platform) DestroyFunc() interface{}

Implement the Destroyer interface

type PlatformConfig

type PlatformConfig struct {
	// AWS region to operate in
	Region string `hcl:"region"`

	// Name of S3 bucket to create
	BucketName string `hcl:"bucket"`
	// Where build directory is located
	BuildDir string `hcl:"directory"`
	BaseDir  string `hcl:"base,optional"`
}

type S3BucketAPI

type S3BucketAPI interface {
	CreateBucket(ctx context.Context,
		params *s3.CreateBucketInput,
		optFns ...func(*s3.Options)) (*s3.CreateBucketOutput, error)

	PutBucketPolicy(ctx context.Context,
		params *s3.PutBucketPolicyInput,
		optFns ...func(*s3.Options)) (*s3.PutBucketPolicyOutput, error)

	PutBucketWebsite(ctx context.Context,
		params *s3.PutBucketWebsiteInput,
		optFns ...func(*s3.Options)) (*s3.PutBucketWebsiteOutput, error)

	PutObject(ctx context.Context,
		params *s3.PutObjectInput,
		optFns ...func(*s3.Options)) (*s3.PutObjectOutput, error)

	GetBucketAcl(ctx context.Context,
		params *s3.GetBucketAclInput,
		optFns ...func(*s3.Options)) (*s3.GetBucketAclOutput, error)
	ListObjectsV2(ctx context.Context,
		params *s3.ListObjectsV2Input,
		optFns ...func(*s3.Options)) (*s3.ListObjectsV2Output, error)
	DeleteObject(ctx context.Context,
		params *s3.DeleteObjectInput,
		optFns ...func(*s3.Options)) (*s3.DeleteObjectOutput, error)
	DeleteBucket(ctx context.Context,
		params *s3.DeleteBucketInput,
		optFns ...func(*s3.Options)) (*s3.DeleteBucketOutput, error)
}

S3BucketAPI defines the interface for the CreateBucket function.

Jump to

Keyboard shortcuts

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