function_url

package
v0.11.4 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2023 License: MPL-2.0 Imports: 25 Imported by: 0

README

AWS Lambda Function URL

The AWS Lambda Function URL plugin releases a function deployed with the AWS Lambda plugin by creating a Lambda function URL.

Components

1.ReleaseManager

  1. AWS Lambda

Resources

  1. Function Permission
  2. Function URL

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// If auth_type is not set we'll default to "NONE", allowing public access to the function URL
	DefaultFunctionUrlAuthType = lambda.FunctionUrlAuthTypeNone
	// If principal is not set we'll allow any authenticated AWS user to invoke the function URL
	DefaultPrincipal = "*"
)
View Source
var File_waypoint_builtin_aws_lambda_function_url_plugin_proto protoreflect.FileDescriptor
View Source
var Options = []sdk.Option{
	sdk.WithComponents(&Releaser{}),
}

Options are the SDK options to use for instantiation for the plugin.

Functions

This section is empty.

Types

type IAMPolicy

type IAMPolicy struct {
	Version   string `json:"Version"`
	ID        string `json:"Id"`
	Statement []struct {
		Sid    string `json:"Sid"`
		Effect string `json:"Effect"`
		// Principal can be either a string, like "*", or a struct
		// like { "AWS": "arn:aws:iam::123456789012:root" }
		Principal interface{} `json:"Principal"`
		Action    string      `json:"Action"`
		Resource  string      `json:"Resource"`
		Condition struct {
			StringEquals struct {
				LambdaFunctionURLAuthType string `json:"lambda:FunctionUrlAuthType"`
			} `json:"StringEquals"`
		} `json:"Condition"`
	} `json:"Statement"`
}

Lambda GetPolicy() returns a JSON string of its IAM policy, so we need to unmarshal it into this struct in order to use it.

See https://github.com/aws/aws-sdk-go/issues/127 and https://github.com/aws/aws-sdk-go-v2/issues/225

type Release

type Release struct {

	// The function's public url
	Url string `protobuf:"bytes,1,opt,name=url,proto3" json:"url,omitempty"`
	// The AWS region the function is deployed in
	Region string `protobuf:"bytes,2,opt,name=region,proto3" json:"region,omitempty"`
	// The ARN for the Lambda function itself.
	FuncArn string `protobuf:"bytes,3,opt,name=func_arn,json=funcArn,proto3" json:"func_arn,omitempty"`
	// The ARN for the version of the Lambda function this deployment uses.
	VerArn        string         `protobuf:"bytes,4,opt,name=ver_arn,json=verArn,proto3" json:"ver_arn,omitempty"`
	ResourceState *opaqueany.Any `protobuf:"bytes,5,opt,name=resource_state,json=resourceState,proto3" json:"resource_state,omitempty"`
	// contains filtered or unexported fields
}

func (*Release) Descriptor deprecated

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

Deprecated: Use Release.ProtoReflect.Descriptor instead.

func (*Release) GetFuncArn

func (x *Release) GetFuncArn() string

func (*Release) GetRegion

func (x *Release) GetRegion() string

func (*Release) GetResourceState

func (x *Release) GetResourceState() *opaqueany.Any

func (*Release) GetUrl

func (x *Release) GetUrl() string

func (*Release) GetVerArn

func (x *Release) GetVerArn() string

func (*Release) ProtoMessage

func (*Release) ProtoMessage()

func (*Release) ProtoReflect

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

func (*Release) Reset

func (x *Release) Reset()

func (*Release) String

func (x *Release) String() string

func (*Release) URL

func (r *Release) URL() string

type Releaser

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

func (*Releaser) Config

func (r *Releaser) Config() (interface{}, error)

Config implements Configurable

func (*Releaser) ConfigSet

func (r *Releaser) ConfigSet(config interface{}) error

ConfigSet is called after a configuration has been decoded we can use this to validate the config

func (*Releaser) Destroy

func (r *Releaser) Destroy(
	ctx context.Context,
	log hclog.Logger,
	release *Release,
	ui terminal.UI,
) error

func (*Releaser) DestroyFunc

func (r *Releaser) DestroyFunc() interface{}

DestroyFunc implements component.Destroyer

func (*Releaser) Documentation

func (r *Releaser) Documentation() (*docs.Documentation, error)

func (*Releaser) Release

func (r *Releaser) Release(
	ctx context.Context,
	log hclog.Logger,
	src *component.Source,
	ui terminal.UI,
	dep *lambdaplugin.Deployment,
) (*Release, error)

func (*Releaser) ReleaseFunc

func (r *Releaser) ReleaseFunc() interface{}

ReleaseFunc implements component.ReleaseManager

func (*Releaser) Status

func (r *Releaser) Status(
	ctx context.Context,
	log hclog.Logger,
	release *Release,
	ui terminal.UI,
) (*sdk.StatusReport, error)

func (*Releaser) StatusFunc

func (r *Releaser) StatusFunc() interface{}

StatusFunc implements component.Status

type ReleaserConfig

type ReleaserConfig struct {
	// "AWS_IAM" or "NONE"
	AuthType string `hcl:"auth_type,optional"`
	// Only permitted if AuthType is "AWS_IAM" otherwise defaults to "*"
	Principal string `hcl:"principal,optional"`
	// Configuration options for function url CORS
	Cors *ReleaserConfigCors `hcl:"cors,block"`
}

ReleaserConfig is the configuration structure for the Releaser.

type ReleaserConfigCors added in v0.11.0

type ReleaserConfigCors struct {
	// Whether to allow cookies or other credentials in requests to your function
	// URL. The default is false.
	AllowCredentials *bool `hcl:"allow_credentials,optional"`

	// The HTTP headers that origins can include in requests to your function URL.
	// For example: Date, Keep-Alive, X-Custom-Header.
	AllowHeaders []*string `hcl:"allow_headers,optional"`

	// The HTTP methods that are allowed when calling your function URL. For example:
	// GET, POST, DELETE, or the wildcard character (*).
	AllowMethods []*string `hcl:"allow_methods,optional"`

	// The origins that can access your function URL. You can list any number of
	// specific origins, separated by a comma. For example: https://www.example.com,
	// http://localhost:60905.
	//
	// Alternatively, you can grant access to all origins using the wildcard character
	// (*).
	AllowOrigins []*string `hcl:"allow_origins,optional"`

	// The HTTP headers in your function response that you want to expose to origins
	// that call your function URL. For example: Date, Keep-Alive, X-Custom-Header.
	ExposeHeaders []*string `hcl:"expose_headers,optional"`

	// The maximum amount of time, in seconds, that web browsers can cache results
	// of a preflight request. By default, this is set to 0, which means that the
	// browser doesn't cache results.
	MaxAge *int64 `hcl:"max_age,optional"`
}

Based on the Cors type from the AWS SDK, but with our HCL mappings. https://pkg.go.dev/github.com/aws/aws-sdk-go/service/lambda#Cors

type Resource

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

Resource contains the internal resource states.

func (*Resource) Descriptor deprecated

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

Deprecated: Use Resource.ProtoReflect.Descriptor instead.

func (*Resource) ProtoMessage

func (*Resource) ProtoMessage()

func (*Resource) ProtoReflect

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

func (*Resource) Reset

func (x *Resource) Reset()

func (*Resource) String

func (x *Resource) String() string

type Resource_FunctionUrl

type Resource_FunctionUrl struct {
	Url string `protobuf:"bytes,1,opt,name=url,proto3" json:"url,omitempty"`
	// contains filtered or unexported fields
}

func (*Resource_FunctionUrl) Descriptor deprecated

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

Deprecated: Use Resource_FunctionUrl.ProtoReflect.Descriptor instead.

func (*Resource_FunctionUrl) GetUrl

func (x *Resource_FunctionUrl) GetUrl() string

func (*Resource_FunctionUrl) ProtoMessage

func (*Resource_FunctionUrl) ProtoMessage()

func (*Resource_FunctionUrl) ProtoReflect

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

func (*Resource_FunctionUrl) Reset

func (x *Resource_FunctionUrl) Reset()

func (*Resource_FunctionUrl) String

func (x *Resource_FunctionUrl) String() string

Jump to

Keyboard shortcuts

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