Title: | AWS Lambda Client Package |
---|---|
Description: | A simple client package for the Amazon Web Services ('AWS') Lambda API <https://aws.amazon.com/lambda/>. |
Authors: | Thomas J. Leeper [aut] , Jon Harmon [ctb, cre] |
Maintainer: | Jon Harmon <[email protected]> |
License: | GPL-3 |
Version: | 0.2.0.9000 |
Built: | 2024-10-31 22:10:46 UTC |
Source: | https://github.com/cloudyr/aws.lambda |
Create, update, and version AWS Lambda functions
create_function( name, func, handler, role, runtime = c("nodejs12.x", "nodejs10.x", "java11", "java8", "python3.8", "python3.7", "python3.6", "python2.7", "dotnetcore3.1", "dotnetcore2.1", "go1.x", "ruby2.7", "ruby2.5", "provided"), timeout = 3L, description, layers, memory_size = 128L, ... ) update_function_code(name, func, ...) update_function_config( name, description, handler, role, runtime = c("nodejs12.x", "nodejs10.x", "java11", "java8", "python3.8", "python3.7", "python3.6", "python2.7", "dotnetcore3.1", "dotnetcore2.1", "go1.x", "ruby2.7", "ruby2.5", "provided"), timeout = 3L, ... ) update_function( name, func, description, handler, role, runtime = c("nodejs12.x", "nodejs10.x", "java11", "java8", "python3.8", "python3.7", "python3.6", "python2.7", "dotnetcore3.1", "dotnetcore2.1", "go1.x", "ruby2.7", "ruby2.5", "provided"), timeout = 3L, ... ) publish_function_version(name, description, ...) make_function_version(name, description, ...)
create_function( name, func, handler, role, runtime = c("nodejs12.x", "nodejs10.x", "java11", "java8", "python3.8", "python3.7", "python3.6", "python2.7", "dotnetcore3.1", "dotnetcore2.1", "go1.x", "ruby2.7", "ruby2.5", "provided"), timeout = 3L, description, layers, memory_size = 128L, ... ) update_function_code(name, func, ...) update_function_config( name, description, handler, role, runtime = c("nodejs12.x", "nodejs10.x", "java11", "java8", "python3.8", "python3.7", "python3.6", "python2.7", "dotnetcore3.1", "dotnetcore2.1", "go1.x", "ruby2.7", "ruby2.5", "provided"), timeout = 3L, ... ) update_function( name, func, description, handler, role, runtime = c("nodejs12.x", "nodejs10.x", "java11", "java8", "python3.8", "python3.7", "python3.6", "python2.7", "dotnetcore3.1", "dotnetcore2.1", "go1.x", "ruby2.7", "ruby2.5", "provided"), timeout = 3L, ... ) publish_function_version(name, description, ...) make_function_version(name, description, ...)
name |
A character string specifying the function name (either a full ARN or a max 64-character string). For functions other than |
func |
Either (1) a character string containing a url-style AWS S3
bucket and object key (e.g., |
handler |
A character string specifying the function within your code that Lambda calls to begin execution. |
role |
A character string containing an IAM role or an object of class “iam_role”. This is the role that is used when the function is invoked, so it must have permissions over any AWS resources needed by the function. |
runtime |
A character string specifying the runtime environment for the function. |
timeout |
An integer specifying the timeout for the function, in seconds. |
description |
Optionally, a max 256-character description of the function for your own use. |
layers |
A character vector of pre-built layers to be used by your function
when runtime is |
memory_size |
An integer specifying the amount of RAM that's allocated to the function. Unenforced minimum value of 128, maximum value of 3008 (will be enforced on the API side). |
... |
Additional arguments passed to |
create_function
creates a new function from a deployment
package. update_function_code
updates the code within a function.
update_function_config
updates the configuration settings of a
function. publish_function_version
records a function version (see
list_function_versions
; changes made between versioning are
not recorded.
A list of class “aws_lambda_function”.
API Reference: CreateFunction API Reference: UpdateFunctionCode API Reference: PublishVersion
invoke_function
, create_function_alias
,
list_functions
, delete_function
## Not run: # 'hello world!' example code hello <- system.file("templates", "helloworld.js", package = "aws.lambda") # get IAM role for Lambda execution library("aws.iam") id <- get_caller_identity()[["Account"]] # Note: This role may not work. We recommend copying the ARN of a # Lambda-capable role from the console once until we're able to more # smoothly integrate with aws.iam. role <- paste0("arn:aws:iam::", id, ":role/lambda_basic_execution") lambda_func <- create_function("helloworld", func = hello, handler = "helloworld.handler", role = role ) # invoke function invoke_function(lambda_func) # delete function delete_function(lambda_func) ## End(Not run)
## Not run: # 'hello world!' example code hello <- system.file("templates", "helloworld.js", package = "aws.lambda") # get IAM role for Lambda execution library("aws.iam") id <- get_caller_identity()[["Account"]] # Note: This role may not work. We recommend copying the ARN of a # Lambda-capable role from the console once until we're able to more # smoothly integrate with aws.iam. role <- paste0("arn:aws:iam::", id, ":role/lambda_basic_execution") lambda_func <- create_function("helloworld", func = hello, handler = "helloworld.handler", role = role ) # invoke function invoke_function(lambda_func) # delete function delete_function(lambda_func) ## End(Not run)
List, create, update, and delete function aliases
create_function_alias(name, alias, version, description, ...) update_function_alias(name, alias, version, description, ...) delete_function_alias(name, alias, ...) get_function_alias(name, alias, ...) list_function_aliases(name, version, marker, n, ...)
create_function_alias(name, alias, version, description, ...) update_function_alias(name, alias, version, description, ...) delete_function_alias(name, alias, ...) get_function_alias(name, alias, ...) list_function_aliases(name, version, marker, n, ...)
name |
A character string specifying the function name (either a full ARN or a max 64-character string). For functions other than |
alias |
A character string specifying a function alias |
version |
A character string specifying a function version to associate with this alias. |
description |
Optionally, a max 256-character description of the function for your own use. |
... |
Additional arguments passed to |
marker |
A pagination marker from a previous request. |
n |
An integer specifying the number of results to return. |
create_function_alias
creates a new function alias for a
given version of a function. update_function_alias
updates the
association between a function alias and the function version.
list_function_aliases
lists all function aliases.
get_function_alias
retrieves a specific function alias.
delete_function_alias
deletes a function alias, but not the
associated function version.
An object of class “aws_lambda_function”.
API Reference: GetAlias API Reference: CreateAlias API Reference: UpdateAlias API Reference: DeleteAlias API Reference: ListAliases
create_function
, list_functions
List functions, function versions, and function policies
get_function(name, qualifier, ...) list_functions(marker, n, ...) list_function_versions(name, marker, n, ...) delete_function(name, qualifier, ...) get_function_policy(name, qualifier, ...)
get_function(name, qualifier, ...) list_functions(marker, n, ...) list_function_versions(name, marker, n, ...) delete_function(name, qualifier, ...) get_function_policy(name, qualifier, ...)
name |
A character string specifying the function name (either a full ARN or a max 64-character string). For functions other than |
qualifier |
Optionally, either a function version or alias. If omitted, information about the latest version is returned. |
... |
Additional arguments passed to |
marker |
A pagination marker from a previous request. |
n |
An integer specifying the number of results to return. |
list_functions
lists all functions. get_function
retrieves a specific function and list_function_versions
retrieves
all versions of that function. get_function_policy
returns the
resource-based IAM policy for a function. delete_function
deletes a
function, if you have permission to do so.
An object of class “aws_lambda_function”.
API Reference: GetFunction API Reference: ListVersionsByFunction API Reference: ListFunctions API Reference: GetPolicy
create_function
, update_function_code
,
update_function_config
Extracts an AWS Lambda function's name
get_function_name(x, ...) ## S3 method for class 'character' get_function_name(x, ...) ## S3 method for class 'aws_lambda_function' get_function_name(x, ...)
get_function_name(x, ...) ## S3 method for class 'character' get_function_name(x, ...) ## S3 method for class 'aws_lambda_function' get_function_name(x, ...)
x |
An object of class “aws_lambda_function”. |
... |
Additional arguments passed to methods |
Get account settings
get_lambda_account(...)
get_lambda_account(...)
... |
Additional arguments passed to |
A list.
## Not run: get_lambda_account() ## End(Not run)
## Not run: get_lambda_account() ## End(Not run)
Invoke a lambda function
invoke_function( name, qualifier, payload = NULL, type = c("RequestResponse", "Event", "DryRun"), log = c("None", "Tail"), ... )
invoke_function( name, qualifier, payload = NULL, type = c("RequestResponse", "Event", "DryRun"), log = c("None", "Tail"), ... )
name |
A character string specifying the function name (either a full ARN or a max 64-character string). For functions other than |
qualifier |
Optionally, either a function version or alias. If omitted, information about the latest version is returned. |
payload |
Optionally, a list of parameters to send in the JSON body to the function. |
type |
A character string specifying one of: (1) “Event” (asynchronous execution), (2) “RequestResponse” (the default), or (3) “DryRun” to test the function without executing it. |
log |
A character string to control log response. |
... |
Additional arguments passed to |
create_function
, list_functions
,
This is the workhorse function to execute calls to the Lambda API.
lambdaHTTP( verb = "GET", action, query = NULL, headers = list(), body = NULL, verbose = getOption("verbose", FALSE), region = Sys.getenv("AWS_DEFAULT_REGION", "us-east-1"), key = NULL, secret = NULL, session_token = NULL, ... )
lambdaHTTP( verb = "GET", action, query = NULL, headers = list(), body = NULL, verbose = getOption("verbose", FALSE), region = Sys.getenv("AWS_DEFAULT_REGION", "us-east-1"), key = NULL, secret = NULL, session_token = NULL, ... )
verb |
A character string specifying the HTTP verb to use. |
action |
A character string specifying the API version and endpoint. |
query |
An optional named list containing query string parameters and their character values. |
headers |
A list of headers to pass to the HTTP request. |
body |
The HTTP request body. |
verbose |
A logical indicating whether to be verbose. Default is given
by |
region |
A character string specifying an AWS region. See
|
key |
A character string specifying an AWS Access Key. See
|
secret |
A character string specifying an AWS Secret Key. See
|
session_token |
Optionally, a character string specifying an AWS
temporary Session Token to use in signing a request. See
|
... |
Additional arguments passed to |
This function constructs and signs an AWS Lambda API request and returns the results thereof, or relevant debugging information in the case of error.
If successful, a named list. Otherwise, a data structure of class “aws-error” containing any error message(s) from AWS and information about the request attempt.
Thomas J. Leeper
get_lambda_account
, which works well as a hello world
for the package