lambroll

package module
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: MIT Imports: 49 Imported by: 0

README

lambroll

lambroll is a simple deployment tool for AWS Lambda.

lambroll does,

  • Create a function.
  • Create a Zip archive from local directory.
  • Deploy function code / configuration / tags / aliases / function URLs.
  • Rollback a function to previous version.
  • Invoke a function with payloads.
  • Manage function versions.
  • Show status of a function.
  • Show function logs.
  • Show diff of function code / configuration.
  • Delete a function.

lambroll does not,

  • Manage resources related to the Lambda function.
    • For example, IAM Role, function triggers, API Gateway, and etc.
    • Only the function URLs can be managed by lambroll if you want.
  • Build native binaries or extensions for Linux (AWS Lambda running environment).

When you hope to manage these resources, we recommend other deployment tools (AWS SAM, Serverless Framework, etc.).

Differences of lambroll v0 and v1.

See docs/v0-v1.md.

Install

Homebrew (macOS and Linux)
$ brew install fujiwara/tap/lambroll
aqua

aqua is a declarative CLI Version Manager.

$ aqua g -i fujiwara/lambroll
Binary packages

Releases

CircleCI Orb

https://circleci.com/orbs/registry/orb/fujiwara/lambroll

version: 2.1
orbs:
  lambroll: fujiwara/lambroll@2.0.1
jobs:
  deploy:
    docker:
      - image: cimg/base
    steps:
      - checkout
      - lambroll/install:
          version: v1.0.1
      - run:
          command: |
            lambroll deploy
GitHub Actions

Action fujiwara/lambroll@v0 installs lambroll binary for Linux into /usr/local/bin. This action runs install only.

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: fujiwara/lambroll@v1
        with:
          version: v1.0.1
      - run: |
          lambroll deploy

Quick start

Try migrate your existing Lambda function hello.

$ mkdir hello
$ cd hello
$ lambroll init --function-name hello --download
2019/10/26 01:19:23 [info] function hello found
2019/10/26 01:19:23 [info] downloading function.zip
2019/10/26 01:19:23 [info] creating function.json
2019/10/26 01:19:23 [info] completed

$ unzip -l function.zip
Archive:  function.zip
  Length      Date    Time    Name
---------  ---------- -----   ----
      408  10-26-2019 00:30   index.js
---------                     -------
      408                     1 file

$ unzip function.zip
Archive:  function.zip
 extracting: index.js

$ rm function.zip

See or edit function.json or index.js.

Now you can deploy hello function using lambroll deploy.

$ lambroll deploy
2019/10/26 01:24:52 [info] starting deploy function hello
2019/10/26 01:24:53 [info] creating zip archive from .
2019/10/26 01:24:53 [info] zip archive wrote 1042 bytes
2019/10/26 01:24:53 [info] updating function configuration
2019/10/26 01:24:53 [info] updating function code hello
2019/10/26 01:24:53 [info] completed

Usage

Usage: lambroll <command>

Flags:
  -h, --help                              Show context-sensitive help.
      --function=STRING                   Function file path ($LAMBROLL_FUNCTION)
      --log-level="info"                  log level (trace, debug, info, warn, error) ($LAMBROLL_LOGLEVEL)
      --color                             enable colored output ($LAMBROLL_COLOR)
      --region=REGION                     AWS region ($AWS_REGION)
      --profile=PROFILE                   AWS credential profile name ($AWS_PROFILE)
      --tfstate=TFSTATE                   URL to terraform.tfstate ($LAMBROLL_TFSTATE)
      --prefixed-tfstate=KEY=VALUE;...    key value pair of the prefix for template function name and URL to
                                          terraform.tfstate ($LAMBROLL_PREFIXED_TFSTATE)
      --endpoint=ENDPOINT                 AWS API Lambda Endpoint ($AWS_LAMBDA_ENDPOINT)
      --envfile=ENVFILE,...               environment files ($LAMBROLL_ENVFILE)
      --ext-str=KEY=VALUE;...             external string values for Jsonnet ($LAMBROLL_EXTSTR)
      --ext-code=KEY=VALUE;...            external code values for Jsonnet ($LAMBROLL_EXTCODE)

Commands:
  deploy
    deploy or create function

  init --function-name=
    init function.json

  list
    list functions

  rollback
    rollback function

  invoke
    invoke function

  archive
    archive function

  logs
    show logs of function

  diff
    show diff of function

  render
    render function.json

  status
    show status of function

  delete
    delete function

  versions
    show versions of function

  version
    show version

Run "lambroll <command> --help" for more information on a command.
Init

lambroll init initialize function.json by existing function.

Usage: lambroll init --function-name=

init function.json

Flags:
      --function-name=                    Function name for init
      --download                          Download function.zip
      --jsonnet                           render function.json as jsonnet
      --qualifier=QUALIFIER               function version or alias
      --function-url                      create function url definition file

init creates function.json as a configuration file of the function.

Deploy
Usage: lambroll deploy

deploy or create function

Flags:
      --src="."                           function zip archive or src dir
      --publish                           publish function
      --alias="current"                   alias name for publish
      --alias-to-latest                   set alias to unpublished $LATEST version
      --dry-run                           dry run
      --skip-archive                      skip to create zip archive. requires Code.S3Bucket and Code.S3Key in function
                                          definition
      --keep-versions=0                   Number of latest versions to keep. Older versions will be deleted. (Optional
                                          value: default 0).
      --function-url=""                   path to function-url definition
      --skip-function                     skip to deploy a function. deploy function-url only
      --exclude-file=".lambdaignore"      exclude file

deploy works as below.

  • Create a zip archive from --src directory.
    • Excludes files matched (wildcard pattern) in --exclude-file.
  • Create / Update Lambda function
  • Create an alias to the published version when --publish (default).
Deploy container image

lambroll also support to deploy a container image for Lambda.

PackageType=Image and Code.ImageUri are required in function.json. ImageConfig is optional.

{
  "FunctionName": "container",
  "MemorySize": 128,
  "Role": "arn:aws:iam::012345678912:role/test_lambda_function",
  "PackageType": "Image",
  "Code": {
    "ImageUri": "012345678912.dkr.ecr.ap-northeast-1.amazonaws.com/lambda/test:latest"
  },
  "ImageConfig": {
    "Command": [
      "/path/to/bootstrap"
    ],
    "WorkingDirectory": "/var/task",
    "EntryPoint": [
      "/path/to/entrypoint"
    ],
  }
}
Rollback
Usage: lambroll rollback

rollback function

Flags:
      --dry-run                   dry run
      --alias="current"           alias to rollback
      --version=""                version to rollback (default: previous version auto detected)
      --delete-version            delete rolled back version

lambroll deploy create/update alias to the published function version on deploy.

lambroll rollback works as below.

  1. Find the previous version from the alias with no other aliases.
  2. Update the alias to the previous version.
    • If --version is specified, update the alias to the specified version.
  3. When --delete-version is specified, delete the old version of the function.

If you add multiple aliases to the function, lambroll rollback --alias={some-alias} may not work as expected. Because the previous version that auto-detected may be the older version of other aliases.

So you should specify the version to rollback with --version flag to clear the ambiguity.

Invoke
Usage: lambroll invoke

invoke function

Flags:
      --async                             invocation type async
      --log-tail                          output tail of log to STDERR
      --qualifier=QUALIFIER               version or alias to invoke
      --payload=PAYLOAD                   payload to invoke. if not specified, read from STDIN

lambroll invoke accepts multiple JSON payloads for invocations from --payload flag or STDIN.

If the payload is a concatenation of multiple JSON payloads, lambroll invoke will invoke the function for each JSON payload.

Outputs from the function invoked are printed to STDOUT.

$ lambroll invoke --payload='{"foo":1} --log-tail'
{"success": true, "payload": {"foo":1}}
2019/10/28 23:16:43 [info] StatusCode:200 ExecutionVersion:$LATEST
START RequestId: aa38233f-a179-4192-8469-c86414fe463c Version: $LATEST
END RequestId: aa38233f-a179-4192-8469-c86414fe463c
REPORT RequestId: 60140e16-018e-41b1-bb46-3f021d4960c0	Duration: 561.77 ms	Billed Duration: 600 ms	Memory Size: 128 MB	Max Memory Used: 50 MB

$ echo '{"foo":1}{"foo":2}' | lambroll invoke --log-tail
{"success": true, payload{"foo":1}}
2019/10/28 23:16:43 [info] StatusCode:200 ExecutionVersion:$LATEST
START RequestId: 60140e16-018e-41b1-bb46-3f021d4960c0 Version: $LATEST
END RequestId: 60140e16-018e-41b1-bb46-3f021d4960c0
REPORT RequestId: 60140e16-018e-41b1-bb46-3f021d4960c0	Duration: 561.77 ms	Billed Duration: 600 ms	Memory Size: 128 MB	Max Memory Used: 50 MB
{"success": true, payload:{"foo":2}}
2019/10/28 23:16:43 [info] StatusCode:200 ExecutionVersion:$LATEST
START RequestId: dcc584f5-ceaf-4109-b405-8e59ca7ae92f Version: $LATEST
END RequestId: dcc584f5-ceaf-4109-b405-8e59ca7ae92f
REPORT RequestId: dcc584f5-ceaf-4109-b405-8e59ca7ae92f	Duration: 597.87 ms	Billed Duration: 600 ms	Memory Size: 128 MB	Max Memory Used: 50 MB
2019/10/28 23:16:43 [info] completed
function.json

function.json is a definition for Lambda function. JSON structure is based from CreateFunction for Lambda API.

{
  "Architectures": [
    "arm64"
  ],
  "Description": "hello function for {{ must_env `ENV` }}",
  "EphemeralStorage": {
    "Size": 1024
  },
  "Environment": {
    "Variables": {
      "BAR": "baz",
      "FOO": "{{ env `FOO` `default for FOO` }}"
    }
  },
  "FunctionName": "{{ must_env `ENV` }}-hello",
  "FileSystemConfigs": [
    {
      "Arn": "arn:aws:elasticfilesystem:ap-northeast-1:123456789012:access-point/fsap-04fc0858274e7dd9a",
      "LocalMountPath": "/mnt/lambda"
    }
  ],
  "Handler": "index.js",
  "MemorySize": 128,
  "Role": "arn:aws:iam::123456789012:role/hello_lambda_function",
  "Runtime": "nodejs18.x",
  "Tags": {
    "Env": "dev"
  },
  "Timeout": 5,
  "TracingConfig": {
    "Mode": "PassThrough"
  }
}
Tags

When "Tags" key exists in function.json, lambroll set / remove tags to the lambda function at deploy.

{
  // ...
  "Tags": {
    "Env": "dev",
    "Foo": "Bar"
  }
}

When "Tags" key does not exist, lambroll doesn't manage tags. If you hope to remove all tags, set "Tags": {} expressly.

Expand SSM parameter values

At reading the file, lambroll evaluates {{ ssm }} syntax in JSON.

For example,

{{ ssm `/path/to/param` }}

SSM parameter value of /path/to/param is expanded here.

Expand environment variables

At reading the file, lambroll evaluates {{ env }} and {{ must_env }} syntax in JSON.

For example,

{{ env `FOO` `default for FOO` }}

Environment variable FOO is expanded here. When FOO is not defined, use default value.

{{ must_env `FOO` }}

Environment variable FOO is expanded. When FOO is not defined, lambroll will panic and abort.

json_escape template function escapes JSON meta characters in string values. This is useful for inject structured values into environment variables.

{
    "Environment": {
        "Variables": {
            "JSON": "{{ env `JSON` | json_escape }}"
        }
    }
}
Environment variables from envfile

lambroll --envfile .env1 .env2 reads files named .env1 and .env2 as environment files and export variables in these files.

These files are parsed by hashicorp/go-envparse.

FOO=foo
export BAR="bar"
Lookup resource attributes in tfstate (Terraform state)

When --tfstate option set to an URL to terraform.tfstate, tfstate template function enabled.

For example, define your AWS resources by terraform.

data "aws_iam_role" "lambda" {
  name = "hello_lambda_function"
}

terraform apply creates a terraform.tfstate file.

lambroll --tfstate URL ... enables to lookup resource attributes in the tfstate URL.

{
  "Description": "hello function",
  "FunctionName": "hello",
  "Handler": "index.js",
  "MemorySize": 128,
  "Role": "{{ tfstate `data.aws_iam_role.lambda.arn` }}",
  "Runtime": "nodejs12.x",
  "Timeout": 5,
  "TracingConfig": {
    "Mode": "PassThrough"
  },
  "VpcConfig": {
    "SubnetIds": [
      "{{ tfstate `aws_subnet.lambda['az-a'].id` }}",
      "{{ tfstate `aws_subnet.lambda['az-b'].id` }}"
    ],
    "SecurityGroupIds": [
      "{{ tfstatef `aws_security_group.internal['%s'].id` (must_env `WORLD`) }}"
    ]
  }
}

Likewise, if you have AWS resource definitions spread across multiple tfstate files, you can utilize --prefixed-tfstate option:

e.g.

lambroll --prefixed-tfstate="my_first_=s3://my-bucket/first.tfstate" --prefixed-tfstate="my_second_=s3://my-bucket/second.tfstate" ...

which then exposes additional template functions available like:

{
  "Description": "hello function",
  "Environment": {
    "Variables": {
      "FIRST_VALUE": "{{ my_first_tfstate `data.aws_iam_role.lambda.arn` }}",
      "SECOND_VALUE": "{{ my_second_tfstate `data.aws_iam_role.lambda.arn` }}"
    }
  },
  "rest of the parameters": "..."
}
Jsonnet support for function configuration

lambroll also can read function.jsonnet as Jsonnet format instead of plain JSON.

{
  FunctionName: 'hello',
  Handler: 'index.handler',
  MemorySize: std.extVar('memorySize'),
  Role: 'arn:aws:iam::%s:role/lambda_role' % [ std.extVar('accountID') ],
  Runtime: 'nodejs20.x',
}
$ lambroll \
    --function function.jsonnet \
    --ext-str accountID=0123456789012 \
    --ext-code memorySize="128 * 4" \
    deploy
.lambdaignore

lambroll will ignore files defined in .lambdaignore file at creating a zip archive.

For example,

# comment

*.zip
*~

For each line in .lambdaignore are evaluated as Go's path/filepath#Match.

Lambda@Edge support

lambroll can deploy Lambda@Edge functions.

Edge functions require two preconditions:

  • --region must set to us-east-1.
  • The IAM Role must be assumed by lambda.amazonaws.com and edgelambda.amazonaws.com both.

Otherwise, it works as usual.

Lambda function URLs support

lambroll can deploy Lambda function URLs.

lambroll deploy --function-url=function_url.json deploys a function URL after the function deploied.

Even if your Lambda function already has a function URL, lambroll deploy without --function-url option does not touch the function URLs resources.

When you want to deploy a public (without authentication) function URL, function_url.json is shown below.

{
  "Config": {
    "AuthType": "NONE"
  }
}

When you want to deploy a private (requires AWS IAM authentication) function URL, function_url.json is shown below.

{
  "Config": {
    "AuthType": "AWS_IAM",
    "Cors": {
      "AllowOrigins": [
        "*"
      ],
      "AllowMethods": [
        "GET",
        "POST"
      ]
    },
  },
  "Permissions": [
    {
      "Principal": "0123456789012"
    },
    {
      "PrincipalOrgID": "o-123456789",
      "Principal": "*"
    }
  ]
}
  • Config maps to CreateFunctionUrlConfigInput in AWS SDK Go v2.
    • Config.AuthType must be AWS_IAM or NONE.
    • Config.Qualifier is optional. Default is $LATEST.
  • Permissions is optional.
    • If Permissions is not defined and AuthType is NONE, Principal is set to * automatically.
    • When AuthType is AWS_IAM, you must define Permissions to specify allowed principals.
    • Each elements of Permissions maps to AddPermissionInput in AWS SDK Go v2.
  • function_url.jsonnet is also supported like function.jsonnet.
CloudFront origin access control (OAC) support

CloudFront provides origin access control (OAC) for restricting access to a Lambda function URL origin.

When you want to restrict access to a Lambda function URL origin by CloudFront, you can specify Principal as cloudfront.amazonaws.com and SourceArn as the ARN of the CloudFront distribution.

See also Restricting access to an AWS Lambda function URL origin.

{
  "Config": {
    "AuthType": "AWS_IAM",
  },
  "Permissions": [
    {
      "Principal": "cloudfront.amazonaws.com",
      "SourceArn": "arn:aws:cloudfront::123456789012:distribution/EXXXXXXXX"
    }
  ]
}

If you need to allow access from any CloudFront distributions in your account, you can specify SourceArn as arn:aws:cloudfront::123456789012:distribution/*.

Specifying SourceArn as * is not recommended because it allows access from any CloudFront distribution in any AWS account.

LICENSE

MIT License

Copyright (c) 2019 FUJIWARA Shunichiro

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	SidPattern = regexp.MustCompile("^lambroll-[0-9a-f]+$")
	SidFormat  = "lambroll-%x"
)
View Source
var (
	// IgnoreFilename defines file name includes ignore patterns at creating zip archive.
	IgnoreFilename = ".lambdaignore"

	// DefaultFunctionFilename defines file name for function definition.
	DefaultFunctionFilenames = []string{
		"function.json",
		"function.jsonnet",
	}

	DefaultFunctionURLFilenames = []string{
		"function_url.json",
		"function_url.jsonnet",
	}

	// FunctionZipFilename defines file name for zip archive downloaded at init.
	FunctionZipFilename = "function.zip"

	// DefaultExcludes is a preset excludes file list
	DefaultExcludes = []string{
		IgnoreFilename,
		DefaultFunctionFilenames[0],
		DefaultFunctionFilenames[1],
		DefaultFunctionURLFilenames[0],
		DefaultFunctionURLFilenames[1],
		FunctionZipFilename,
		".git/*",
		".terraform/*",
		"terraform.tfstate",
	}

	// CurrentAliasName is alias name for current deployed function
	CurrentAliasName = "current"
)
View Source
var Version string

Functions

func CLI added in v1.0.0

func CLI(ctx context.Context, parse CLIParseFunc) (int, error)

func ToJSONString added in v1.0.0

func ToJSONString(v interface{}) string

Types

type App

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

App represents lambroll application

func New

func New(ctx context.Context, opt *Option) (*App, error)

New creates an application

func (*App) AWSAccountID

func (app *App) AWSAccountID(ctx context.Context) string

AWSAccountID returns AWS account ID in current session

func (*App) Archive added in v0.2.0

func (app *App) Archive(ctx context.Context, opt *ArchiveOption) error

Archive archives zip

func (*App) Delete added in v0.1.0

func (app *App) Delete(ctx context.Context, opt *DeleteOption) error

Delete deletes function

func (*App) Deploy

func (app *App) Deploy(ctx context.Context, opt *DeployOption) error

Deploy deploys a new lambda function code

func (*App) Diff added in v0.8.0

func (app *App) Diff(ctx context.Context, opt *DiffOption) error

Diff prints diff of function.json compared with latest function

func (*App) Init

func (app *App) Init(ctx context.Context, opt *InitOption) error

Init initializes function.json

func (*App) Invoke added in v0.1.0

func (app *App) Invoke(ctx context.Context, opt *InvokeOption) error

Invoke invokes function

func (*App) List

func (app *App) List(ctx context.Context, opt *ListOption) error

List lists lambda functions

func (*App) Logs added in v0.4.0

func (app *App) Logs(ctx context.Context, opt *LogsOption) error

func (*App) Render added in v1.0.0

func (app *App) Render(ctx context.Context, opt *RenderOption) error

Invoke invokes function

func (*App) Rollback added in v0.1.0

func (app *App) Rollback(ctx context.Context, opt *RollbackOption) error

Rollback rollbacks function

func (*App) Status added in v1.0.0

func (app *App) Status(ctx context.Context, opt *StatusOption) error

Status prints status of function

func (*App) Versions added in v0.12.0

func (app *App) Versions(ctx context.Context, opt *VersionsOption) error

Versions manages the versions of a Lambda function

type ArchiveOption added in v1.0.0

type ArchiveOption struct {
	Src  string `help:"function zip archive or src dir" default:"."`
	Dest string `help:"destination file path" default:"function.zip"`

	ExcludeFileOption
}

type CLIOptions added in v1.0.0

type CLIOptions struct {
	Option

	Deploy   *DeployOption   `cmd:"deploy" help:"deploy or create function"`
	Init     *InitOption     `cmd:"init" help:"init function.json"`
	List     *ListOption     `cmd:"list" help:"list functions"`
	Rollback *RollbackOption `cmd:"rollback" help:"rollback function"`
	Invoke   *InvokeOption   `cmd:"invoke" help:"invoke function"`
	Archive  *ArchiveOption  `cmd:"archive" help:"archive function"`
	Logs     *LogsOption     `cmd:"logs" help:"show logs of function"`
	Diff     *DiffOption     `cmd:"diff" help:"show diff of function"`
	Render   *RenderOption   `cmd:"render" help:"render function.json"`
	Status   *StatusOption   `cmd:"status" help:"show status of function"`
	Delete   *DeleteOption   `cmd:"delete" help:"delete function"`
	Versions *VersionsOption `cmd:"versions" help:"show versions of function"`

	Version struct{} `cmd:"version" help:"show version"`
}

func ParseCLI added in v1.0.0

func ParseCLI(args []string) (string, *CLIOptions, func(), error)

type CLIParseFunc added in v1.0.0

type CLIParseFunc func([]string) (string, *CLIOptions, func(), error)

type DeleteOption added in v0.1.0

type DeleteOption struct {
	DryRun bool `help:"dry run" default:"false" negatable:""`
	Force  bool `help:"delete without confirmation" default:"false"`
}

DeleteOption represents options for Delete()

type DeployOption

type DeployOption struct {
	Src           string `help:"function zip archive or src dir" default:"."`
	Publish       bool   `help:"publish function" default:"true"`
	AliasName     string `name:"alias" help:"alias name for publish" default:"current"`
	AliasToLatest bool   `help:"set alias to unpublished $LATEST version" default:"false"`
	DryRun        bool   `help:"dry run" default:"false"`
	SkipArchive   bool   `help:"skip to create zip archive. requires Code.S3Bucket and Code.S3Key in function definition" default:"false"`
	KeepVersions  int    `help:"Number of latest versions to keep. Older versions will be deleted. (Optional value: default 0)." default:"0"`
	Ignore        string `help:"ignore fields by jq queries in function.json" default:""`
	FunctionURL   string `help:"path to function-url definition" default:"" env:"LAMBROLL_FUNCTION_URL"`
	SkipFunction  bool   `help:"skip to deploy a function. deploy function-url only" default:"false"`

	ExcludeFileOption
}

DeployOption represents an option for Deploy()

func (*DeployOption) String added in v0.2.0

func (opt *DeployOption) String() string

type DiffOption added in v0.8.0

type DiffOption struct {
	Src         string  `help:"function zip archive or src dir" default:"."`
	CodeSha256  bool    `name:"code" help:"diff of code sha256" default:"false"`
	Qualifier   *string `help:"the qualifier to compare"`
	FunctionURL string  `help:"path to function-url definition" default:"" env:"LAMBROLL_FUNCTION_URL"`
	Ignore      string  `help:"ignore diff by jq query" default:""`

	ExcludeFileOption
}

DiffOption represents options for Diff()

type ExcludeFileOption added in v1.0.0

type ExcludeFileOption struct {
	ExcludeFile string `help:"exclude file" default:".lambdaignore"`
	// contains filtered or unexported fields
}

func (*ExcludeFileOption) Expand added in v1.0.0

func (opt *ExcludeFileOption) Expand() error

type Function added in v0.1.0

type Function = lambda.CreateFunctionInput

type FunctionURL added in v1.0.0

type FunctionURL struct {
	Config      *FunctionURLConfig     `json:"Config"`
	Permissions FunctionURLPermissions `json:"Permissions"`
}

func (*FunctionURL) AddPermissionInput added in v1.0.4

func (fc *FunctionURL) AddPermissionInput(p *FunctionURLPermission) *lambda.AddPermissionInput

func (*FunctionURL) RemovePermissionInput added in v1.0.4

func (fc *FunctionURL) RemovePermissionInput(sid string) *lambda.RemovePermissionInput

func (*FunctionURL) Validate added in v1.0.0

func (f *FunctionURL) Validate(functionName string) error

type FunctionURLConfig added in v1.0.0

type FunctionURLConfig = lambda.CreateFunctionUrlConfigInput

type FunctionURLPermission added in v1.0.0

type FunctionURLPermission struct {
	lambda.AddPermissionInput
	// contains filtered or unexported fields
}

func (*FunctionURLPermission) Sid added in v1.0.0

func (p *FunctionURLPermission) Sid() string

type FunctionURLPermissions added in v1.0.0

type FunctionURLPermissions []*FunctionURLPermission

func (FunctionURLPermissions) Find added in v1.0.0

func (FunctionURLPermissions) Sids added in v1.0.0

func (ps FunctionURLPermissions) Sids() []string

type InitOption

type InitOption struct {
	FunctionName   *string `help:"Function name for init" required:"true" default:""`
	DownloadZip    bool    `name:"download" help:"Download function.zip" default:"false"`
	Jsonnet        bool    `help:"render function.json as jsonnet" default:"false"`
	Qualifier      *string `help:"function version or alias"`
	FunctionURL    bool    `help:"create function url definition file" default:"false"`
	ForceOverwrite bool    `help:"Overwrite existing files without prompting" default:"false"`
}

InitOption represents options for Init()

type InvokeOption added in v0.1.0

type InvokeOption struct {
	Async     bool    `default:"false" help:"invocation type async"`
	LogTail   bool    `default:"false" help:"output tail of log to STDERR"`
	Qualifier *string `help:"version or alias to invoke"`
	Payload   *string `help:"payload to invoke. if not specified, read from STDIN"`
}

InvokeOption represents option for Invoke()

type ListOption

type ListOption struct {
}

ListOption represents options for List()

type LogsOption added in v0.4.0

type LogsOption struct {
	Since         *string `help:"From what time to begin displaying logs" default:"10m"`
	Follow        *bool   `help:"follow new logs" default:"false"`
	Format        *string `help:"The format to display the logs" default:"detailed" enum:"detailed,short,json"`
	FilterPattern *string `help:"The filter pattern to use"`
}

type Option added in v0.5.0

type Option struct {
	Function string `help:"Function file path" env:"LAMBROLL_FUNCTION"`
	LogLevel string `help:"log level (trace, debug, info, warn, error)" default:"info" enum:"trace,debug,info,warn,error" env:"LAMBROLL_LOGLEVEL"`
	Color    bool   `help:"enable colored output" default:"false" env:"LAMBROLL_COLOR"`

	Region          *string           `help:"AWS region" env:"AWS_REGION"`
	Profile         *string           `help:"AWS credential profile name" env:"AWS_PROFILE"`
	TFState         *string           `name:"tfstate" help:"URL to terraform.tfstate" env:"LAMBROLL_TFSTATE"`
	PrefixedTFState map[string]string `` /* 147-byte string literal not displayed */
	Endpoint        *string           `help:"AWS API Lambda Endpoint" env:"AWS_LAMBDA_ENDPOINT"`
	Envfile         []string          `help:"environment files" env:"LAMBROLL_ENVFILE"`
	ExtStr          map[string]string `help:"external string values for Jsonnet" env:"LAMBROLL_EXTSTR"`
	ExtCode         map[string]string `help:"external code values for Jsonnet" env:"LAMBROLL_EXTCODE"`
}

type PolicyOutput added in v1.0.0

type PolicyOutput struct {
	Id        string            `json:"Id"`
	Version   string            `json:"Version"`
	Statement []PolicyStatement `json:"Statement"`
}

type PolicyStatement added in v1.0.0

type PolicyStatement struct {
	Sid       string `json:"Sid"`
	Effect    string `json:"Effect"`
	Principal any    `json:"Principal"`
	Action    string `json:"Action"`
	Resource  any    `json:"Resource"`
	Condition any    `json:"Condition"`
}

func (*PolicyStatement) PrincipalOrgID added in v1.0.0

func (ps *PolicyStatement) PrincipalOrgID() *string

func (*PolicyStatement) PrincipalString added in v1.0.4

func (ps *PolicyStatement) PrincipalString() *string

func (*PolicyStatement) SourceArn added in v1.0.4

func (ps *PolicyStatement) SourceArn() *string

type RenderOption added in v1.0.0

type RenderOption struct {
	Jsonnet     bool   `default:"false" help:"render function.json as jsonnet"`
	FunctionURL string `help:"render function-url definition file" default:"" env:"LAMBROLL_FUNCTION_URL"`
}

type RollbackOption added in v0.1.0

type RollbackOption struct {
	DryRun        bool   `default:"false" help:"dry run"`
	Alias         string `default:"current" help:"alias to rollback"`
	Version       string `default:"" help:"version to rollback (default: previous version auto detected)"`
	DeleteVersion bool   `default:"false" help:"delete rolled back version"`
}

RollbackOption represents option for Rollback()

type StatusOption added in v1.0.0

type StatusOption struct {
	Qualifier *string `help:"compare with"`
	Output    string  `help:"output format" default:"table" enum:"table,json"`
}

StatusOption represents options for Status()

type StatusOutput added in v1.0.0

type StatusOutput struct {
	FunctionName    string `json:"FunctionName"`
	FunctionArn     string `json:"FunctionArn"`
	Version         string `json:"Version"`
	Runtime         string `json:"Runtime,omitempty"`
	PackageType     string `json:"PackageType"`
	State           string `json:"State"`
	LastUpdateState string `json:"LastUpdateState"`
	FunctionURL     string `json:"FunctionURL,omitempty"`
}

func (*StatusOutput) String added in v1.0.0

func (o *StatusOutput) String() string

type Tags added in v0.2.2

type Tags map[string]string

Tags represents tags of function

type VersionsOption added in v0.12.0

type VersionsOption struct {
	Output       string `default:"table" enum:"table,json,tsv" help:"output format (table,json,tsv)"`
	Delete       bool   `default:"false" help:"delete older versions"`
	KeepVersions int    `default:"0" help:"Number of latest versions to keep. Older versions will be deleted with --delete."`
}

VersionsOption represents options for Versions()

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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