lambda

package
v0.6.1-0...-4003236 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2015 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package lambda provides a client for AWS Lambda.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AddPermissionInput

type AddPermissionInput struct {
	// The AWS Lambda action you want to allow in this statement. Each Lambda action
	// is a string starting with "lambda:" followed by the API name (see Operations).
	// For example, "lambda:CreateFunction". You can use wildcard ("lambda:*") to
	// grant permission for all AWS Lambda actions.
	Action *string `type:"string" required:"true"`

	// Name of the Lambda function whose access policy you are updating by adding
	// a new permission.
	//
	//  You can specify an unqualified function name (for example, "Thumbnail")
	// or you can specify Amazon Resource Name (ARN) of the function (for example,
	// "arn:aws:lambda:us-west-2:account-id:function:ThumbNail"). AWS Lambda also
	// allows you to specify only the account ID qualifier (for example, "account-id:Thumbnail").
	// Note that the length constraint applies only to the ARN. If you specify only
	// the function name, it is limited to 64 character in length.
	FunctionName *string `location:"uri" locationName:"FunctionName" type:"string" required:"true"`

	// The principal who is getting this permission. It can be Amazon S3 service
	// Principal ("s3.amazonaws.com") if you want Amazon S3 to invoke the function,
	// an AWS account ID if you are granting cross-account permission, or any valid
	// AWS service principal such as "sns.amazonaws.com". For example, you might
	// want to allow a custom application in another AWS account to push events
	// to AWS Lambda by invoking your function.
	Principal *string `type:"string" required:"true"`

	// This is optional; however, when granting Amazon S3 permission to invoke your
	// function, you should specify this field with the bucket Amazon Resource Name
	// (ARN) as its value. This ensures that only events generated from the specified
	// bucket can invoke the function.
	//
	// If you add a permission for the Amazon S3 principal without providing the
	// source ARN, any AWS account that creates a mapping to your function ARN can
	// send events to invoke your Lambda function from Amazon S3.
	SourceARN *string `locationName:"SourceArn" type:"string"`

	// The AWS account ID (without a hyphen) of the source owner. If the SourceArn
	// identifies a bucket, then this is the bucket owner's account ID. You can
	// use this additional condition to ensure the bucket you specify is owned by
	// a specific account (it is possible the bucket owner deleted the bucket and
	// some other AWS account created the bucket). You can also use this condition
	// to specify all sources (that is, you don't specify the SourceArn) owned by
	// a specific account.
	SourceAccount *string `type:"string"`

	// A unique statement identifier.
	StatementID *string `locationName:"StatementId" type:"string" required:"true"`
	// contains filtered or unexported fields
}

type AddPermissionOutput

type AddPermissionOutput struct {
	// The permission statement you specified in the request. The response returns
	// the same as a string using "\" as an escape character in the JSON.
	Statement *string `type:"string"`
	// contains filtered or unexported fields
}

type CreateEventSourceMappingInput

type CreateEventSourceMappingInput struct {
	// The largest number of records that AWS Lambda will retrieve from your event
	// source at the time of invoking your function. Your function receives an event
	// with all the retrieved records. The default is 100 records.
	BatchSize *int64 `type:"integer"`

	// Indicates whether AWS Lambda should begin polling the event source.
	Enabled *bool `type:"boolean"`

	// The Amazon Resource Name (ARN) of the Amazon Kinesis or the Amazon DynamoDB
	// stream that is the event source. Any record added to this stream could cause
	// AWS Lambda to invoke your Lambda function, it depends on the BatchSize. AWS
	// Lambda POSTs the Amazon Kinesis event, containing records, to your Lambda
	// function as JSON.
	EventSourceARN *string `locationName:"EventSourceArn" type:"string" required:"true"`

	// The Lambda function to invoke when AWS Lambda detects an event on the stream.
	//
	//  You can specify an unqualified function name (for example, "Thumbnail")
	// or you can specify Amazon Resource Name (ARN) of the function (for example,
	// "arn:aws:lambda:us-west-2:account-id:function:ThumbNail"). AWS Lambda also
	// allows you to specify only the account ID qualifier (for example, "account-id:Thumbnail").
	// Note that the length constraint applies only to the ARN. If you specify only
	// the function name, it is limited to 64 character in length.
	FunctionName *string `type:"string" required:"true"`

	// The position in the stream where AWS Lambda should start reading. For more
	// information, go to ShardIteratorType (http://docs.aws.amazon.com/kinesis/latest/APIReference/API_GetShardIterator.html#Kinesis-GetShardIterator-request-ShardIteratorType)
	// in the Amazon Kinesis API Reference.
	StartingPosition *string `type:"string" required:"true"`
	// contains filtered or unexported fields
}

type CreateFunctionInput

type CreateFunctionInput struct {
	// The code for the Lambda function.
	Code *FunctionCode `type:"structure" required:"true"`

	// A short, user-defined function description. Lambda does not use this value.
	// Assign a meaningful description as you see fit.
	Description *string `type:"string"`

	// The name you want to assign to the function you are uploading. You can specify
	// an unqualified function name (for example, "Thumbnail") or you can specify
	// Amazon Resource Name (ARN) of the function (for example, "arn:aws:lambda:us-west-2:account-id:function:ThumbNail").
	// AWS Lambda also allows you to specify only the account ID qualifier (for
	// example, "account-id:Thumbnail"). Note that the length constraint applies
	// only to the ARN. If you specify only the function name, it is limited to
	// 64 character in length. The function names appear in the console and are
	// returned in the ListFunctions API. Function names are used to specify functions
	// to other AWS Lambda APIs, such as Invoke.
	FunctionName *string `type:"string" required:"true"`

	// The function within your code that Lambda calls to begin execution. For Node.js,
	// it is the module-name.export value in your function.
	Handler *string `type:"string" required:"true"`

	// The amount of memory, in MB, your Lambda function is given. Lambda uses this
	// memory size to infer the amount of CPU and memory allocated to your function.
	// Your function use-case determines your CPU and memory requirements. For example,
	// a database operation might need less memory compared to an image processing
	// function. The default value is 128 MB. The value must be a multiple of 64
	// MB.
	MemorySize *int64 `type:"integer"`

	// The Amazon Resource Name (ARN) of the IAM role that Lambda assumes when it
	// executes your function to access any other Amazon Web Services (AWS) resources.
	// For more information, see AWS Lambda: How it Works (http://docs.aws.amazon.com/lambda/latest/dg/lambda-introduction.html)
	Role *string `type:"string" required:"true"`

	// The runtime environment for the Lambda function you are uploading. Currently,
	// Lambda supports only "nodejs" as the runtime.
	Runtime *string `type:"string" required:"true"`

	// The function execution time at which Lambda should terminate the function.
	// Because the execution time has cost implications, we recommend you set this
	// value based on your expected execution time. The default is 3 seconds.
	Timeout *int64 `type:"integer"`
	// contains filtered or unexported fields
}

type DeleteEventSourceMappingInput

type DeleteEventSourceMappingInput struct {
	// The event source mapping ID.
	UUID *string `location:"uri" locationName:"UUID" type:"string" required:"true"`
	// contains filtered or unexported fields
}

type DeleteFunctionInput

type DeleteFunctionInput struct {
	// The Lambda function to delete.
	//
	//  You can specify an unqualified function name (for example, "Thumbnail")
	// or you can specify Amazon Resource Name (ARN) of the function (for example,
	// "arn:aws:lambda:us-west-2:account-id:function:ThumbNail"). AWS Lambda also
	// allows you to specify only the account ID qualifier (for example, "account-id:Thumbnail").
	// Note that the length constraint applies only to the ARN. If you specify only
	// the function name, it is limited to 64 character in length.
	FunctionName *string `location:"uri" locationName:"FunctionName" type:"string" required:"true"`
	// contains filtered or unexported fields
}

type DeleteFunctionOutput

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

type EventSourceMappingConfiguration

type EventSourceMappingConfiguration struct {
	// The largest number of records that AWS Lambda will retrieve from your event
	// source at the time of invoking your function. Your function receives an event
	// with all the retrieved records.
	BatchSize *int64 `type:"integer"`

	// The Amazon Resource Name (ARN) of the Amazon Kinesis stream that is the source
	// of events.
	EventSourceARN *string `locationName:"EventSourceArn" type:"string"`

	// The Lambda function to invoke when AWS Lambda detects an event on the stream.
	FunctionARN *string `locationName:"FunctionArn" type:"string"`

	// The UTC time string indicating the last time the event mapping was updated.
	LastModified *time.Time `type:"timestamp" timestampFormat:"unix"`

	// The result of the last AWS Lambda invocation of your Lambda function.
	LastProcessingResult *string `type:"string"`

	// The state of the event source mapping. It can be "Creating", "Enabled", "Disabled",
	// "Enabling", "Disabling", "Updating", or "Deleting".
	State *string `type:"string"`

	// The reason the event source mapping is in its current state. It is either
	// user-requested or an AWS Lambda-initiated state transition.
	StateTransitionReason *string `type:"string"`

	// The AWS Lambda assigned opaque identifier for the mapping.
	UUID *string `type:"string"`
	// contains filtered or unexported fields
}

Describes mapping between an Amazon Kinesis stream and a Lambda function.

type FunctionCode

type FunctionCode struct {
	// Amazon S3 bucket name where the .zip file containing your deployment package
	// is stored. This bucket must reside in the same AWS region where you are creating
	// the Lambda function.
	S3Bucket *string `type:"string"`

	// The Amazon S3 object (the deployment package) key name you want to upload.
	S3Key *string `type:"string"`

	// The Amazon S3 object (the deployment package) version you want to upload.
	S3ObjectVersion *string `type:"string"`

	// A base64-encoded .zip file containing your deployment package. For more information
	// about creating a .zip file, go to Execution Permissions (http://docs.aws.amazon.com/lambda/latest/dg/intro-permission-model.html#lambda-intro-execution-role.html)
	// in the AWS Lambda Developer Guide.
	ZipFile []byte `type:"blob"`
	// contains filtered or unexported fields
}

The code for the Lambda function.

type FunctionCodeLocation

type FunctionCodeLocation struct {
	// The presigned URL you can use to download the function's .zip file that you
	// previously uploaded. The URL is valid for up to 10 minutes.
	Location *string `type:"string"`

	// The repository from which you can download the function.
	RepositoryType *string `type:"string"`
	// contains filtered or unexported fields
}

The object for the Lambda function location.

type FunctionConfiguration

type FunctionConfiguration struct {
	// The size, in bytes, of the function .zip file you uploaded.
	CodeSize *int64 `type:"long"`

	// The user-provided description.
	Description *string `type:"string"`

	// The Amazon Resource Name (ARN) assigned to the function.
	FunctionARN *string `locationName:"FunctionArn" type:"string"`

	// The name of the function.
	FunctionName *string `type:"string"`

	// The function Lambda calls to begin executing your function.
	Handler *string `type:"string"`

	// The timestamp of the last time you updated the function.
	LastModified *string `type:"string"`

	// The memory size, in MB, you configured for the function. Must be a multiple
	// of 64 MB.
	MemorySize *int64 `type:"integer"`

	// The Amazon Resource Name (ARN) of the IAM role that Lambda assumes when it
	// executes your function to access any other Amazon Web Services (AWS) resources.
	Role *string `type:"string"`

	// The runtime environment for the Lambda function.
	Runtime *string `type:"string"`

	// The function execution time at which Lambda should terminate the function.
	// Because the execution time has cost implications, we recommend you set this
	// value based on your expected execution time. The default is 3 seconds.
	Timeout *int64 `type:"integer"`
	// contains filtered or unexported fields
}

A complex type that describes function metadata.

type GetEventSourceMappingInput

type GetEventSourceMappingInput struct {
	// The AWS Lambda assigned ID of the event source mapping.
	UUID *string `location:"uri" locationName:"UUID" type:"string" required:"true"`
	// contains filtered or unexported fields
}

type GetFunctionConfigurationInput

type GetFunctionConfigurationInput struct {
	// The name of the Lambda function for which you want to retrieve the configuration
	// information.
	//
	//  You can specify an unqualified function name (for example, "Thumbnail")
	// or you can specify Amazon Resource Name (ARN) of the function (for example,
	// "arn:aws:lambda:us-west-2:account-id:function:ThumbNail"). AWS Lambda also
	// allows you to specify only the account ID qualifier (for example, "account-id:Thumbnail").
	// Note that the length constraint applies only to the ARN. If you specify only
	// the function name, it is limited to 64 character in length.
	FunctionName *string `location:"uri" locationName:"FunctionName" type:"string" required:"true"`
	// contains filtered or unexported fields
}

type GetFunctionInput

type GetFunctionInput struct {
	// The Lambda function name.
	//
	//  You can specify an unqualified function name (for example, "Thumbnail")
	// or you can specify Amazon Resource Name (ARN) of the function (for example,
	// "arn:aws:lambda:us-west-2:account-id:function:ThumbNail"). AWS Lambda also
	// allows you to specify only the account ID qualifier (for example, "account-id:Thumbnail").
	// Note that the length constraint applies only to the ARN. If you specify only
	// the function name, it is limited to 64 character in length.
	FunctionName *string `location:"uri" locationName:"FunctionName" type:"string" required:"true"`
	// contains filtered or unexported fields
}

type GetFunctionOutput

type GetFunctionOutput struct {
	// The object for the Lambda function location.
	Code *FunctionCodeLocation `type:"structure"`

	// A complex type that describes function metadata.
	Configuration *FunctionConfiguration `type:"structure"`
	// contains filtered or unexported fields
}

This response contains the object for the Lambda function location (see API_FunctionCodeLocation

type GetPolicyInput

type GetPolicyInput struct {
	// Function name whose access policy you want to retrieve.
	//
	//  You can specify an unqualified function name (for example, "Thumbnail")
	// or you can specify Amazon Resource Name (ARN) of the function (for example,
	// "arn:aws:lambda:us-west-2:account-id:function:ThumbNail"). AWS Lambda also
	// allows you to specify only the account ID qualifier (for example, "account-id:Thumbnail").
	// Note that the length constraint applies only to the ARN. If you specify only
	// the function name, it is limited to 64 character in length.
	FunctionName *string `location:"uri" locationName:"FunctionName" type:"string" required:"true"`
	// contains filtered or unexported fields
}

type GetPolicyOutput

type GetPolicyOutput struct {
	// The access policy associated with the specified function. The response returns
	// the same as a string using "\" as an escape character in the JSON.
	Policy *string `type:"string"`
	// contains filtered or unexported fields
}

type InvokeAsyncInput

type InvokeAsyncInput struct {
	// The Lambda function name.
	FunctionName *string `location:"uri" locationName:"FunctionName" type:"string" required:"true"`

	// JSON that you want to provide to your Lambda function as input.
	InvokeArgs io.ReadSeeker `type:"blob" required:"true"`
	// contains filtered or unexported fields
}

type InvokeAsyncOutput

type InvokeAsyncOutput struct {
	// It will be 202 upon success.
	Status *int64 `location:"statusCode" type:"integer"`
	// contains filtered or unexported fields
}

Upon success, it returns empty response. Otherwise, throws an exception.

type InvokeInput

type InvokeInput struct {
	// Using the ClientContext you can pass client-specific information to the Lambda
	// function you are invoking. You can then process the client information in
	// your Lambda function as you choose through the context variable. For an example
	// of a ClientContext JSON, go to PutEvents (http://docs.aws.amazon.com/mobileanalytics/latest/ug/PutEvents.html)
	// in the Amazon Mobile Analytics API Reference and User Guide.
	//
	// The ClientContext JSON must be base64-encoded.
	ClientContext *string `location:"header" locationName:"X-Amz-Client-Context" type:"string"`

	// The Lambda function name.
	//
	//  You can specify an unqualified function name (for example, "Thumbnail")
	// or you can specify Amazon Resource Name (ARN) of the function (for example,
	// "arn:aws:lambda:us-west-2:account-id:function:ThumbNail"). AWS Lambda also
	// allows you to specify only the account ID qualifier (for example, "account-id:Thumbnail").
	// Note that the length constraint applies only to the ARN. If you specify only
	// the function name, it is limited to 64 character in length.
	FunctionName *string `location:"uri" locationName:"FunctionName" type:"string" required:"true"`

	// By default, the Invoke API assumes "RequestResponse" invocation type. You
	// can optionally request asynchronous execution by specifying "Event" as the
	// InvocationType. You can also use this parameter to request AWS Lambda to
	// not execute the function but do some verification, such as if the caller
	// is authorized to invoke the function and if the inputs are valid. You request
	// this by specifying "DryRun" as the InvocationType. This is useful in a cross-account
	// scenario when you want to verify access to a function without running it.
	InvocationType *string `location:"header" locationName:"X-Amz-Invocation-Type" type:"string"`

	// You can set this optional parameter to "Tail" in the request only if you
	// specify the InvocationType parameter with value "RequestResponse". In this
	// case, AWS Lambda returns the base64-encoded last 4 KB of log data produced
	// by your Lambda function in the x-amz-log-results header.
	LogType *string `location:"header" locationName:"X-Amz-Log-Type" type:"string"`

	// JSON that you want to provide to your Lambda function as input.
	Payload []byte `type:"blob"`
	// contains filtered or unexported fields
}

type InvokeOutput

type InvokeOutput struct {
	// Indicates whether an error occurred while executing the Lambda function.
	// If an error occurred this field will have one of two values; Handled or Unhandled.
	// Handled errors are errors that are reported by the function while the Unhandled
	// errors are those detected and reported by AWS Lambda. Unhandled errors include
	// out of memory errors and function timeouts. For information about how to
	// report an Handled error, see Programming Model (http://docs.aws.amazon.com/lambda/latest/dg/programming-model.html).
	FunctionError *string `location:"header" locationName:"X-Amz-Function-Error" type:"string"`

	// It is the base64-encoded logs for the Lambda function invocation. This is
	// present only if the invocation type is "RequestResponse" and the logs were
	// requested.
	LogResult *string `location:"header" locationName:"X-Amz-Log-Result" type:"string"`

	// It is the JSON representation of the object returned by the Lambda function.
	// In This is present only if the invocation type is "RequestResponse".
	//
	// In the event of a function error this field contains a message describing
	// the error. For the Handled errors the Lambda function will report this message.
	// For Unhandled errors AWS Lambda reports the message.
	Payload []byte `type:"blob"`

	// The HTTP status code will be in the 200 range for successful request. For
	// the "RequestResonse" invocation type this status code will be 200. For the
	// "Event" invocation type this status code will be 202. For the "DryRun" invocation
	// type the status code will be 204.
	StatusCode *int64 `location:"statusCode" type:"integer"`
	// contains filtered or unexported fields
}

Upon success, returns an empty response. Otherwise, throws an exception.

type Lambda

type Lambda struct {
	*aws.Service
}

Lambda is a client for AWS Lambda.

func New

func New(config *aws.Config) *Lambda

New returns a new Lambda client.

func (*Lambda) AddPermission

func (c *Lambda) AddPermission(input *AddPermissionInput) (*AddPermissionOutput, error)

Adds a permission to the access policy associated with the specified AWS Lambda function. In a "push event" model, the access policy attached to the Lambda function grants Amazon S3 or a user application permission for the Lambda lambda:Invoke action. For information about the push model, see AWS Lambda: How it Works (http://docs.aws.amazon.com/lambda/latest/dg/lambda-introduction.html). Each Lambda function has one access policy associated with it. You can use the AddPermission API to add a permission to the policy. You have one access policy but it can have multiple permission statements.

This operation requires permission for the lambda:AddPermission action.

Example
package main

import (
	"fmt"

	"github.com/aws/aws-sdk-go/aws"
	"github.com/aws/aws-sdk-go/aws/awserr"
	"github.com/aws/aws-sdk-go/aws/awsutil"
	"github.com/aws/aws-sdk-go/service/lambda"
)

func main() {
	svc := lambda.New(nil)

	params := &lambda.AddPermissionInput{
		Action:        aws.String("Action"),       // Required
		FunctionName:  aws.String("FunctionName"), // Required
		Principal:     aws.String("Principal"),    // Required
		StatementID:   aws.String("StatementId"),  // Required
		SourceARN:     aws.String("Arn"),
		SourceAccount: aws.String("SourceOwner"),
	}
	resp, err := svc.AddPermission(params)

	if err != nil {
		if awsErr, ok := err.(awserr.Error); ok {
			// Generic AWS Error with Code, Message, and original error (if any)
			fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
			if reqErr, ok := err.(awserr.RequestFailure); ok {
				// A service error occurred
				fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
			}
		} else {
			// This case should never be hit, The SDK should alwsy return an
			// error which satisfies the awserr.Error interface.
			fmt.Println(err.Error())
		}
	}

	// Pretty-print the response data.
	fmt.Println(awsutil.StringValue(resp))
}
Output:

func (*Lambda) AddPermissionRequest

func (c *Lambda) AddPermissionRequest(input *AddPermissionInput) (req *aws.Request, output *AddPermissionOutput)

AddPermissionRequest generates a request for the AddPermission operation.

func (*Lambda) CreateEventSourceMapping

func (c *Lambda) CreateEventSourceMapping(input *CreateEventSourceMappingInput) (*EventSourceMappingConfiguration, error)

Identifies a stream as an event source for a Lambda function. It can be either an Amazon Kinesis stream or an Amazon DynamoDB stream. AWS Lambda invokes the specified function when records are posted to the stream.

This is the pull model, where AWS Lambda invokes the function. For more information, go to AWS Lambda: How it Works (http://docs.aws.amazon.com/lambda/latest/dg/lambda-introduction.html) in the AWS Lambda Developer Guide.

This association between an Amazon Kinesis stream and a Lambda function is called the event source mapping. You provide the configuration information (for example, which stream to read from and which Lambda function to invoke) for the event source mapping in the request body.

Each event source, such as an Amazon Kinesis or a DynamoDB stream, can

be associated with multiple AWS Lambda function. A given Lambda function can be associated with multiple AWS event sources.

This operation requires permission for the lambda:CreateEventSourceMapping action.

Example
package main

import (
	"fmt"

	"github.com/aws/aws-sdk-go/aws"
	"github.com/aws/aws-sdk-go/aws/awserr"
	"github.com/aws/aws-sdk-go/aws/awsutil"
	"github.com/aws/aws-sdk-go/service/lambda"
)

func main() {
	svc := lambda.New(nil)

	params := &lambda.CreateEventSourceMappingInput{
		EventSourceARN:   aws.String("Arn"),                 // Required
		FunctionName:     aws.String("FunctionName"),        // Required
		StartingPosition: aws.String("EventSourcePosition"), // Required
		BatchSize:        aws.Long(1),
		Enabled:          aws.Boolean(true),
	}
	resp, err := svc.CreateEventSourceMapping(params)

	if err != nil {
		if awsErr, ok := err.(awserr.Error); ok {
			// Generic AWS Error with Code, Message, and original error (if any)
			fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
			if reqErr, ok := err.(awserr.RequestFailure); ok {
				// A service error occurred
				fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
			}
		} else {
			// This case should never be hit, The SDK should alwsy return an
			// error which satisfies the awserr.Error interface.
			fmt.Println(err.Error())
		}
	}

	// Pretty-print the response data.
	fmt.Println(awsutil.StringValue(resp))
}
Output:

func (*Lambda) CreateEventSourceMappingRequest

func (c *Lambda) CreateEventSourceMappingRequest(input *CreateEventSourceMappingInput) (req *aws.Request, output *EventSourceMappingConfiguration)

CreateEventSourceMappingRequest generates a request for the CreateEventSourceMapping operation.

func (*Lambda) CreateFunction

func (c *Lambda) CreateFunction(input *CreateFunctionInput) (*FunctionConfiguration, error)

Creates a new Lambda function. The function metadata is created from the request parameters, and the code for the function is provided by a .zip file in the request body. If the function name already exists, the operation will fail. Note that the function name is case-sensitive.

This operation requires permission for the lambda:CreateFunction action.

Example
package main

import (
	"fmt"

	"github.com/aws/aws-sdk-go/aws"
	"github.com/aws/aws-sdk-go/aws/awserr"
	"github.com/aws/aws-sdk-go/aws/awsutil"
	"github.com/aws/aws-sdk-go/service/lambda"
)

func main() {
	svc := lambda.New(nil)

	params := &lambda.CreateFunctionInput{
		Code: &lambda.FunctionCode{ // Required
			S3Bucket:        aws.String("S3Bucket"),
			S3Key:           aws.String("S3Key"),
			S3ObjectVersion: aws.String("S3ObjectVersion"),
			ZipFile:         []byte("PAYLOAD"),
		},
		FunctionName: aws.String("FunctionName"), // Required
		Handler:      aws.String("Handler"),      // Required
		Role:         aws.String("RoleArn"),      // Required
		Runtime:      aws.String("Runtime"),      // Required
		Description:  aws.String("Description"),
		MemorySize:   aws.Long(1),
		Timeout:      aws.Long(1),
	}
	resp, err := svc.CreateFunction(params)

	if err != nil {
		if awsErr, ok := err.(awserr.Error); ok {
			// Generic AWS Error with Code, Message, and original error (if any)
			fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
			if reqErr, ok := err.(awserr.RequestFailure); ok {
				// A service error occurred
				fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
			}
		} else {
			// This case should never be hit, The SDK should alwsy return an
			// error which satisfies the awserr.Error interface.
			fmt.Println(err.Error())
		}
	}

	// Pretty-print the response data.
	fmt.Println(awsutil.StringValue(resp))
}
Output:

func (*Lambda) CreateFunctionRequest

func (c *Lambda) CreateFunctionRequest(input *CreateFunctionInput) (req *aws.Request, output *FunctionConfiguration)

CreateFunctionRequest generates a request for the CreateFunction operation.

func (*Lambda) DeleteEventSourceMapping

func (c *Lambda) DeleteEventSourceMapping(input *DeleteEventSourceMappingInput) (*EventSourceMappingConfiguration, error)

Removes an event source mapping. This means AWS Lambda will no longer invoke the function for events in the associated source.

This operation requires permission for the lambda:DeleteEventSourceMapping action.

Example
package main

import (
	"fmt"

	"github.com/aws/aws-sdk-go/aws"
	"github.com/aws/aws-sdk-go/aws/awserr"
	"github.com/aws/aws-sdk-go/aws/awsutil"
	"github.com/aws/aws-sdk-go/service/lambda"
)

func main() {
	svc := lambda.New(nil)

	params := &lambda.DeleteEventSourceMappingInput{
		UUID: aws.String("String"), // Required
	}
	resp, err := svc.DeleteEventSourceMapping(params)

	if err != nil {
		if awsErr, ok := err.(awserr.Error); ok {
			// Generic AWS Error with Code, Message, and original error (if any)
			fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
			if reqErr, ok := err.(awserr.RequestFailure); ok {
				// A service error occurred
				fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
			}
		} else {
			// This case should never be hit, The SDK should alwsy return an
			// error which satisfies the awserr.Error interface.
			fmt.Println(err.Error())
		}
	}

	// Pretty-print the response data.
	fmt.Println(awsutil.StringValue(resp))
}
Output:

func (*Lambda) DeleteEventSourceMappingRequest

func (c *Lambda) DeleteEventSourceMappingRequest(input *DeleteEventSourceMappingInput) (req *aws.Request, output *EventSourceMappingConfiguration)

DeleteEventSourceMappingRequest generates a request for the DeleteEventSourceMapping operation.

func (*Lambda) DeleteFunction

func (c *Lambda) DeleteFunction(input *DeleteFunctionInput) (*DeleteFunctionOutput, error)

Deletes the specified Lambda function code and configuration.

When you delete a function the associated access policy is also deleted. You will need to delete the event source mappings explicitly.

This operation requires permission for the lambda:DeleteFunction action.

Example
package main

import (
	"fmt"

	"github.com/aws/aws-sdk-go/aws"
	"github.com/aws/aws-sdk-go/aws/awserr"
	"github.com/aws/aws-sdk-go/aws/awsutil"
	"github.com/aws/aws-sdk-go/service/lambda"
)

func main() {
	svc := lambda.New(nil)

	params := &lambda.DeleteFunctionInput{
		FunctionName: aws.String("FunctionName"), // Required
	}
	resp, err := svc.DeleteFunction(params)

	if err != nil {
		if awsErr, ok := err.(awserr.Error); ok {
			// Generic AWS Error with Code, Message, and original error (if any)
			fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
			if reqErr, ok := err.(awserr.RequestFailure); ok {
				// A service error occurred
				fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
			}
		} else {
			// This case should never be hit, The SDK should alwsy return an
			// error which satisfies the awserr.Error interface.
			fmt.Println(err.Error())
		}
	}

	// Pretty-print the response data.
	fmt.Println(awsutil.StringValue(resp))
}
Output:

func (*Lambda) DeleteFunctionRequest

func (c *Lambda) DeleteFunctionRequest(input *DeleteFunctionInput) (req *aws.Request, output *DeleteFunctionOutput)

DeleteFunctionRequest generates a request for the DeleteFunction operation.

func (*Lambda) GetEventSourceMapping

func (c *Lambda) GetEventSourceMapping(input *GetEventSourceMappingInput) (*EventSourceMappingConfiguration, error)

Returns configuration information for the specified event source mapping (see CreateEventSourceMapping).

This operation requires permission for the lambda:GetEventSourceMapping action.

Example
package main

import (
	"fmt"

	"github.com/aws/aws-sdk-go/aws"
	"github.com/aws/aws-sdk-go/aws/awserr"
	"github.com/aws/aws-sdk-go/aws/awsutil"
	"github.com/aws/aws-sdk-go/service/lambda"
)

func main() {
	svc := lambda.New(nil)

	params := &lambda.GetEventSourceMappingInput{
		UUID: aws.String("String"), // Required
	}
	resp, err := svc.GetEventSourceMapping(params)

	if err != nil {
		if awsErr, ok := err.(awserr.Error); ok {
			// Generic AWS Error with Code, Message, and original error (if any)
			fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
			if reqErr, ok := err.(awserr.RequestFailure); ok {
				// A service error occurred
				fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
			}
		} else {
			// This case should never be hit, The SDK should alwsy return an
			// error which satisfies the awserr.Error interface.
			fmt.Println(err.Error())
		}
	}

	// Pretty-print the response data.
	fmt.Println(awsutil.StringValue(resp))
}
Output:

func (*Lambda) GetEventSourceMappingRequest

func (c *Lambda) GetEventSourceMappingRequest(input *GetEventSourceMappingInput) (req *aws.Request, output *EventSourceMappingConfiguration)

GetEventSourceMappingRequest generates a request for the GetEventSourceMapping operation.

func (*Lambda) GetFunction

func (c *Lambda) GetFunction(input *GetFunctionInput) (*GetFunctionOutput, error)

Returns the configuration information of the Lambda function and a presigned URL link to the .zip file you uploaded with CreateFunction so you can download the .zip file. Note that the URL is valid for up to 10 minutes. The configuration information is the same information you provided as parameters when uploading the function.

This operation requires permission for the lambda:GetFunction action.

Example
package main

import (
	"fmt"

	"github.com/aws/aws-sdk-go/aws"
	"github.com/aws/aws-sdk-go/aws/awserr"
	"github.com/aws/aws-sdk-go/aws/awsutil"
	"github.com/aws/aws-sdk-go/service/lambda"
)

func main() {
	svc := lambda.New(nil)

	params := &lambda.GetFunctionInput{
		FunctionName: aws.String("FunctionName"), // Required
	}
	resp, err := svc.GetFunction(params)

	if err != nil {
		if awsErr, ok := err.(awserr.Error); ok {
			// Generic AWS Error with Code, Message, and original error (if any)
			fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
			if reqErr, ok := err.(awserr.RequestFailure); ok {
				// A service error occurred
				fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
			}
		} else {
			// This case should never be hit, The SDK should alwsy return an
			// error which satisfies the awserr.Error interface.
			fmt.Println(err.Error())
		}
	}

	// Pretty-print the response data.
	fmt.Println(awsutil.StringValue(resp))
}
Output:

func (*Lambda) GetFunctionConfiguration

func (c *Lambda) GetFunctionConfiguration(input *GetFunctionConfigurationInput) (*FunctionConfiguration, error)

Returns the configuration information of the Lambda function. This the same information you provided as parameters when uploading the function by using CreateFunction.

This operation requires permission for the lambda:GetFunctionConfiguration operation.

Example
package main

import (
	"fmt"

	"github.com/aws/aws-sdk-go/aws"
	"github.com/aws/aws-sdk-go/aws/awserr"
	"github.com/aws/aws-sdk-go/aws/awsutil"
	"github.com/aws/aws-sdk-go/service/lambda"
)

func main() {
	svc := lambda.New(nil)

	params := &lambda.GetFunctionConfigurationInput{
		FunctionName: aws.String("FunctionName"), // Required
	}
	resp, err := svc.GetFunctionConfiguration(params)

	if err != nil {
		if awsErr, ok := err.(awserr.Error); ok {
			// Generic AWS Error with Code, Message, and original error (if any)
			fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
			if reqErr, ok := err.(awserr.RequestFailure); ok {
				// A service error occurred
				fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
			}
		} else {
			// This case should never be hit, The SDK should alwsy return an
			// error which satisfies the awserr.Error interface.
			fmt.Println(err.Error())
		}
	}

	// Pretty-print the response data.
	fmt.Println(awsutil.StringValue(resp))
}
Output:

func (*Lambda) GetFunctionConfigurationRequest

func (c *Lambda) GetFunctionConfigurationRequest(input *GetFunctionConfigurationInput) (req *aws.Request, output *FunctionConfiguration)

GetFunctionConfigurationRequest generates a request for the GetFunctionConfiguration operation.

func (*Lambda) GetFunctionRequest

func (c *Lambda) GetFunctionRequest(input *GetFunctionInput) (req *aws.Request, output *GetFunctionOutput)

GetFunctionRequest generates a request for the GetFunction operation.

func (*Lambda) GetPolicy

func (c *Lambda) GetPolicy(input *GetPolicyInput) (*GetPolicyOutput, error)

Returns the access policy, containing a list of permissions granted via the AddPermission API, associated with the specified bucket.

You need permission for the lambda:GetPolicy action.

Example
package main

import (
	"fmt"

	"github.com/aws/aws-sdk-go/aws"
	"github.com/aws/aws-sdk-go/aws/awserr"
	"github.com/aws/aws-sdk-go/aws/awsutil"
	"github.com/aws/aws-sdk-go/service/lambda"
)

func main() {
	svc := lambda.New(nil)

	params := &lambda.GetPolicyInput{
		FunctionName: aws.String("FunctionName"), // Required
	}
	resp, err := svc.GetPolicy(params)

	if err != nil {
		if awsErr, ok := err.(awserr.Error); ok {
			// Generic AWS Error with Code, Message, and original error (if any)
			fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
			if reqErr, ok := err.(awserr.RequestFailure); ok {
				// A service error occurred
				fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
			}
		} else {
			// This case should never be hit, The SDK should alwsy return an
			// error which satisfies the awserr.Error interface.
			fmt.Println(err.Error())
		}
	}

	// Pretty-print the response data.
	fmt.Println(awsutil.StringValue(resp))
}
Output:

func (*Lambda) GetPolicyRequest

func (c *Lambda) GetPolicyRequest(input *GetPolicyInput) (req *aws.Request, output *GetPolicyOutput)

GetPolicyRequest generates a request for the GetPolicy operation.

func (*Lambda) Invoke

func (c *Lambda) Invoke(input *InvokeInput) (*InvokeOutput, error)

Invokes a specified Lambda function.

This operation requires permission for the lambda:InvokeFunction action.

Example
package main

import (
	"fmt"

	"github.com/aws/aws-sdk-go/aws"
	"github.com/aws/aws-sdk-go/aws/awserr"
	"github.com/aws/aws-sdk-go/aws/awsutil"
	"github.com/aws/aws-sdk-go/service/lambda"
)

func main() {
	svc := lambda.New(nil)

	params := &lambda.InvokeInput{
		FunctionName:   aws.String("FunctionName"), // Required
		ClientContext:  aws.String("String"),
		InvocationType: aws.String("InvocationType"),
		LogType:        aws.String("LogType"),
		Payload:        []byte("PAYLOAD"),
	}
	resp, err := svc.Invoke(params)

	if err != nil {
		if awsErr, ok := err.(awserr.Error); ok {
			// Generic AWS Error with Code, Message, and original error (if any)
			fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
			if reqErr, ok := err.(awserr.RequestFailure); ok {
				// A service error occurred
				fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
			}
		} else {
			// This case should never be hit, The SDK should alwsy return an
			// error which satisfies the awserr.Error interface.
			fmt.Println(err.Error())
		}
	}

	// Pretty-print the response data.
	fmt.Println(awsutil.StringValue(resp))
}
Output:

func (*Lambda) InvokeAsync

func (c *Lambda) InvokeAsync(input *InvokeAsyncInput) (*InvokeAsyncOutput, error)

This API is deprecated. We recommend you use Invoke API (see Invoke). Submits an invocation request to AWS Lambda. Upon receiving the request, Lambda executes the specified function asynchronously. To see the logs generated by the Lambda function execution, see the CloudWatch logs console.

This operation requires permission for the lambda:InvokeFunction action.

Example
package main

import (
	"bytes"
	"fmt"

	"github.com/aws/aws-sdk-go/aws"
	"github.com/aws/aws-sdk-go/aws/awserr"
	"github.com/aws/aws-sdk-go/aws/awsutil"
	"github.com/aws/aws-sdk-go/service/lambda"
)

func main() {
	svc := lambda.New(nil)

	params := &lambda.InvokeAsyncInput{
		FunctionName: aws.String("FunctionName"),         // Required
		InvokeArgs:   bytes.NewReader([]byte("PAYLOAD")), // Required
	}
	resp, err := svc.InvokeAsync(params)

	if err != nil {
		if awsErr, ok := err.(awserr.Error); ok {
			// Generic AWS Error with Code, Message, and original error (if any)
			fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
			if reqErr, ok := err.(awserr.RequestFailure); ok {
				// A service error occurred
				fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
			}
		} else {
			// This case should never be hit, The SDK should alwsy return an
			// error which satisfies the awserr.Error interface.
			fmt.Println(err.Error())
		}
	}

	// Pretty-print the response data.
	fmt.Println(awsutil.StringValue(resp))
}
Output:

func (*Lambda) InvokeAsyncRequest

func (c *Lambda) InvokeAsyncRequest(input *InvokeAsyncInput) (req *aws.Request, output *InvokeAsyncOutput)

InvokeAsyncRequest generates a request for the InvokeAsync operation.

func (*Lambda) InvokeRequest

func (c *Lambda) InvokeRequest(input *InvokeInput) (req *aws.Request, output *InvokeOutput)

InvokeRequest generates a request for the Invoke operation.

func (*Lambda) ListEventSourceMappings

func (c *Lambda) ListEventSourceMappings(input *ListEventSourceMappingsInput) (*ListEventSourceMappingsOutput, error)

Returns a list of event source mappings you created using the CreateEventSourceMapping (see CreateEventSourceMapping), where you identify a stream as an event source. This list does not include Amazon S3 event sources.

For each mapping, the API returns configuration information. You can optionally specify filters to retrieve specific event source mappings.

This operation requires permission for the lambda:ListEventSourceMappings action.

Example
package main

import (
	"fmt"

	"github.com/aws/aws-sdk-go/aws"
	"github.com/aws/aws-sdk-go/aws/awserr"
	"github.com/aws/aws-sdk-go/aws/awsutil"
	"github.com/aws/aws-sdk-go/service/lambda"
)

func main() {
	svc := lambda.New(nil)

	params := &lambda.ListEventSourceMappingsInput{
		EventSourceARN: aws.String("Arn"),
		FunctionName:   aws.String("FunctionName"),
		Marker:         aws.String("String"),
		MaxItems:       aws.Long(1),
	}
	resp, err := svc.ListEventSourceMappings(params)

	if err != nil {
		if awsErr, ok := err.(awserr.Error); ok {
			// Generic AWS Error with Code, Message, and original error (if any)
			fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
			if reqErr, ok := err.(awserr.RequestFailure); ok {
				// A service error occurred
				fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
			}
		} else {
			// This case should never be hit, The SDK should alwsy return an
			// error which satisfies the awserr.Error interface.
			fmt.Println(err.Error())
		}
	}

	// Pretty-print the response data.
	fmt.Println(awsutil.StringValue(resp))
}
Output:

func (*Lambda) ListEventSourceMappingsPages

func (c *Lambda) ListEventSourceMappingsPages(input *ListEventSourceMappingsInput, fn func(p *ListEventSourceMappingsOutput, lastPage bool) (shouldContinue bool)) error

func (*Lambda) ListEventSourceMappingsRequest

func (c *Lambda) ListEventSourceMappingsRequest(input *ListEventSourceMappingsInput) (req *aws.Request, output *ListEventSourceMappingsOutput)

ListEventSourceMappingsRequest generates a request for the ListEventSourceMappings operation.

func (*Lambda) ListFunctions

func (c *Lambda) ListFunctions(input *ListFunctionsInput) (*ListFunctionsOutput, error)

Returns a list of your Lambda functions. For each function, the response includes the function configuration information. You must use GetFunction to retrieve the code for your function.

This operation requires permission for the lambda:ListFunctions action.

Example
package main

import (
	"fmt"

	"github.com/aws/aws-sdk-go/aws"
	"github.com/aws/aws-sdk-go/aws/awserr"
	"github.com/aws/aws-sdk-go/aws/awsutil"
	"github.com/aws/aws-sdk-go/service/lambda"
)

func main() {
	svc := lambda.New(nil)

	params := &lambda.ListFunctionsInput{
		Marker:   aws.String("String"),
		MaxItems: aws.Long(1),
	}
	resp, err := svc.ListFunctions(params)

	if err != nil {
		if awsErr, ok := err.(awserr.Error); ok {
			// Generic AWS Error with Code, Message, and original error (if any)
			fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
			if reqErr, ok := err.(awserr.RequestFailure); ok {
				// A service error occurred
				fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
			}
		} else {
			// This case should never be hit, The SDK should alwsy return an
			// error which satisfies the awserr.Error interface.
			fmt.Println(err.Error())
		}
	}

	// Pretty-print the response data.
	fmt.Println(awsutil.StringValue(resp))
}
Output:

func (*Lambda) ListFunctionsPages

func (c *Lambda) ListFunctionsPages(input *ListFunctionsInput, fn func(p *ListFunctionsOutput, lastPage bool) (shouldContinue bool)) error

func (*Lambda) ListFunctionsRequest

func (c *Lambda) ListFunctionsRequest(input *ListFunctionsInput) (req *aws.Request, output *ListFunctionsOutput)

ListFunctionsRequest generates a request for the ListFunctions operation.

func (*Lambda) RemovePermission

func (c *Lambda) RemovePermission(input *RemovePermissionInput) (*RemovePermissionOutput, error)

You can remove individual permissions from an access policy associated with a Lambda function by providing a Statement ID.

Note that removal of a permission will cause an active event source to lose permission to the function.

You need permission for the lambda:RemovePermission action.

Example
package main

import (
	"fmt"

	"github.com/aws/aws-sdk-go/aws"
	"github.com/aws/aws-sdk-go/aws/awserr"
	"github.com/aws/aws-sdk-go/aws/awsutil"
	"github.com/aws/aws-sdk-go/service/lambda"
)

func main() {
	svc := lambda.New(nil)

	params := &lambda.RemovePermissionInput{
		FunctionName: aws.String("FunctionName"), // Required
		StatementID:  aws.String("StatementId"),  // Required
	}
	resp, err := svc.RemovePermission(params)

	if err != nil {
		if awsErr, ok := err.(awserr.Error); ok {
			// Generic AWS Error with Code, Message, and original error (if any)
			fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
			if reqErr, ok := err.(awserr.RequestFailure); ok {
				// A service error occurred
				fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
			}
		} else {
			// This case should never be hit, The SDK should alwsy return an
			// error which satisfies the awserr.Error interface.
			fmt.Println(err.Error())
		}
	}

	// Pretty-print the response data.
	fmt.Println(awsutil.StringValue(resp))
}
Output:

func (*Lambda) RemovePermissionRequest

func (c *Lambda) RemovePermissionRequest(input *RemovePermissionInput) (req *aws.Request, output *RemovePermissionOutput)

RemovePermissionRequest generates a request for the RemovePermission operation.

func (*Lambda) UpdateEventSourceMapping

func (c *Lambda) UpdateEventSourceMapping(input *UpdateEventSourceMappingInput) (*EventSourceMappingConfiguration, error)

You can update an event source mapping. This is useful if you want to change the parameters of the existing mapping without losing your position in the stream. You can change which function will receive the stream records, but to change the stream itself, you must create a new mapping.

This operation requires permission for the lambda:UpdateEventSourceMapping action.

Example
package main

import (
	"fmt"

	"github.com/aws/aws-sdk-go/aws"
	"github.com/aws/aws-sdk-go/aws/awserr"
	"github.com/aws/aws-sdk-go/aws/awsutil"
	"github.com/aws/aws-sdk-go/service/lambda"
)

func main() {
	svc := lambda.New(nil)

	params := &lambda.UpdateEventSourceMappingInput{
		UUID:         aws.String("String"), // Required
		BatchSize:    aws.Long(1),
		Enabled:      aws.Boolean(true),
		FunctionName: aws.String("FunctionName"),
	}
	resp, err := svc.UpdateEventSourceMapping(params)

	if err != nil {
		if awsErr, ok := err.(awserr.Error); ok {
			// Generic AWS Error with Code, Message, and original error (if any)
			fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
			if reqErr, ok := err.(awserr.RequestFailure); ok {
				// A service error occurred
				fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
			}
		} else {
			// This case should never be hit, The SDK should alwsy return an
			// error which satisfies the awserr.Error interface.
			fmt.Println(err.Error())
		}
	}

	// Pretty-print the response data.
	fmt.Println(awsutil.StringValue(resp))
}
Output:

func (*Lambda) UpdateEventSourceMappingRequest

func (c *Lambda) UpdateEventSourceMappingRequest(input *UpdateEventSourceMappingInput) (req *aws.Request, output *EventSourceMappingConfiguration)

UpdateEventSourceMappingRequest generates a request for the UpdateEventSourceMapping operation.

func (*Lambda) UpdateFunctionCode

func (c *Lambda) UpdateFunctionCode(input *UpdateFunctionCodeInput) (*FunctionConfiguration, error)

Updates the code for the specified Lambda function. This operation must only be used on an existing Lambda function and cannot be used to update the function configuration.

This operation requires permission for the lambda:UpdateFunctionCode action.

Example
package main

import (
	"fmt"

	"github.com/aws/aws-sdk-go/aws"
	"github.com/aws/aws-sdk-go/aws/awserr"
	"github.com/aws/aws-sdk-go/aws/awsutil"
	"github.com/aws/aws-sdk-go/service/lambda"
)

func main() {
	svc := lambda.New(nil)

	params := &lambda.UpdateFunctionCodeInput{
		FunctionName:    aws.String("FunctionName"), // Required
		S3Bucket:        aws.String("S3Bucket"),
		S3Key:           aws.String("S3Key"),
		S3ObjectVersion: aws.String("S3ObjectVersion"),
		ZipFile:         []byte("PAYLOAD"),
	}
	resp, err := svc.UpdateFunctionCode(params)

	if err != nil {
		if awsErr, ok := err.(awserr.Error); ok {
			// Generic AWS Error with Code, Message, and original error (if any)
			fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
			if reqErr, ok := err.(awserr.RequestFailure); ok {
				// A service error occurred
				fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
			}
		} else {
			// This case should never be hit, The SDK should alwsy return an
			// error which satisfies the awserr.Error interface.
			fmt.Println(err.Error())
		}
	}

	// Pretty-print the response data.
	fmt.Println(awsutil.StringValue(resp))
}
Output:

func (*Lambda) UpdateFunctionCodeRequest

func (c *Lambda) UpdateFunctionCodeRequest(input *UpdateFunctionCodeInput) (req *aws.Request, output *FunctionConfiguration)

UpdateFunctionCodeRequest generates a request for the UpdateFunctionCode operation.

func (*Lambda) UpdateFunctionConfiguration

func (c *Lambda) UpdateFunctionConfiguration(input *UpdateFunctionConfigurationInput) (*FunctionConfiguration, error)

Updates the configuration parameters for the specified Lambda function by using the values provided in the request. You provide only the parameters you want to change. This operation must only be used on an existing Lambda function and cannot be used to update the function's code.

This operation requires permission for the lambda:UpdateFunctionConfiguration action.

Example
package main

import (
	"fmt"

	"github.com/aws/aws-sdk-go/aws"
	"github.com/aws/aws-sdk-go/aws/awserr"
	"github.com/aws/aws-sdk-go/aws/awsutil"
	"github.com/aws/aws-sdk-go/service/lambda"
)

func main() {
	svc := lambda.New(nil)

	params := &lambda.UpdateFunctionConfigurationInput{
		FunctionName: aws.String("FunctionName"), // Required
		Description:  aws.String("Description"),
		Handler:      aws.String("Handler"),
		MemorySize:   aws.Long(1),
		Role:         aws.String("RoleArn"),
		Timeout:      aws.Long(1),
	}
	resp, err := svc.UpdateFunctionConfiguration(params)

	if err != nil {
		if awsErr, ok := err.(awserr.Error); ok {
			// Generic AWS Error with Code, Message, and original error (if any)
			fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
			if reqErr, ok := err.(awserr.RequestFailure); ok {
				// A service error occurred
				fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
			}
		} else {
			// This case should never be hit, The SDK should alwsy return an
			// error which satisfies the awserr.Error interface.
			fmt.Println(err.Error())
		}
	}

	// Pretty-print the response data.
	fmt.Println(awsutil.StringValue(resp))
}
Output:

func (*Lambda) UpdateFunctionConfigurationRequest

func (c *Lambda) UpdateFunctionConfigurationRequest(input *UpdateFunctionConfigurationInput) (req *aws.Request, output *FunctionConfiguration)

UpdateFunctionConfigurationRequest generates a request for the UpdateFunctionConfiguration operation.

type ListEventSourceMappingsInput

type ListEventSourceMappingsInput struct {
	// The Amazon Resource Name (ARN) of the Amazon Kinesis stream.
	EventSourceARN *string `location:"querystring" locationName:"EventSourceArn" type:"string"`

	// The name of the Lambda function.
	//
	//  You can specify an unqualified function name (for example, "Thumbnail")
	// or you can specify Amazon Resource Name (ARN) of the function (for example,
	// "arn:aws:lambda:us-west-2:account-id:function:ThumbNail"). AWS Lambda also
	// allows you to specify only the account ID qualifier (for example, "account-id:Thumbnail").
	// Note that the length constraint applies only to the ARN. If you specify only
	// the function name, it is limited to 64 character in length.
	FunctionName *string `location:"querystring" locationName:"FunctionName" type:"string"`

	// Optional string. An opaque pagination token returned from a previous ListEventSourceMappings
	// operation. If present, specifies to continue the list from where the returning
	// call left off.
	Marker *string `location:"querystring" locationName:"Marker" type:"string"`

	// Optional integer. Specifies the maximum number of event sources to return
	// in response. This value must be greater than 0.
	MaxItems *int64 `location:"querystring" locationName:"MaxItems" type:"integer"`
	// contains filtered or unexported fields
}

type ListEventSourceMappingsOutput

type ListEventSourceMappingsOutput struct {
	// An array of EventSourceMappingConfiguration objects.
	EventSourceMappings []*EventSourceMappingConfiguration `type:"list"`

	// A string, present if there are more event source mappings.
	NextMarker *string `type:"string"`
	// contains filtered or unexported fields
}

Contains a list of event sources (see API_EventSourceMappingConfiguration)

type ListFunctionsInput

type ListFunctionsInput struct {
	// Optional string. An opaque pagination token returned from a previous ListFunctions
	// operation. If present, indicates where to continue the listing.
	Marker *string `location:"querystring" locationName:"Marker" type:"string"`

	// Optional integer. Specifies the maximum number of AWS Lambda functions to
	// return in response. This parameter value must be greater than 0.
	MaxItems *int64 `location:"querystring" locationName:"MaxItems" type:"integer"`
	// contains filtered or unexported fields
}

type ListFunctionsOutput

type ListFunctionsOutput struct {
	// A list of Lambda functions.
	Functions []*FunctionConfiguration `type:"list"`

	// A string, present if there are more functions.
	NextMarker *string `type:"string"`
	// contains filtered or unexported fields
}

Contains a list of AWS Lambda function configurations (see FunctionConfiguration.

type RemovePermissionInput

type RemovePermissionInput struct {
	// Lambda function whose access policy you want to remove a permission from.
	//
	//  You can specify an unqualified function name (for example, "Thumbnail")
	// or you can specify Amazon Resource Name (ARN) of the function (for example,
	// "arn:aws:lambda:us-west-2:account-id:function:ThumbNail"). AWS Lambda also
	// allows you to specify only the account ID qualifier (for example, "account-id:Thumbnail").
	// Note that the length constraint applies only to the ARN. If you specify only
	// the function name, it is limited to 64 character in length.
	FunctionName *string `location:"uri" locationName:"FunctionName" type:"string" required:"true"`

	// Statement ID of the permission to remove.
	StatementID *string `location:"uri" locationName:"StatementId" type:"string" required:"true"`
	// contains filtered or unexported fields
}

type RemovePermissionOutput

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

type UpdateEventSourceMappingInput

type UpdateEventSourceMappingInput struct {
	// The maximum number of stream records that can be sent to your Lambda function
	// for a single invocation.
	BatchSize *int64 `type:"integer"`

	// Specifies whether AWS Lambda should actively poll the stream or not. If disabled,
	// AWS Lambda will not poll the stream.
	Enabled *bool `type:"boolean"`

	// The Lambda function to which you want the stream records sent.
	//
	//  You can specify an unqualified function name (for example, "Thumbnail")
	// or you can specify Amazon Resource Name (ARN) of the function (for example,
	// "arn:aws:lambda:us-west-2:account-id:function:ThumbNail"). AWS Lambda also
	// allows you to specify only the account ID qualifier (for example, "account-id:Thumbnail").
	// Note that the length constraint applies only to the ARN. If you specify only
	// the function name, it is limited to 64 character in length.
	FunctionName *string `type:"string"`

	// The event source mapping identifier.
	UUID *string `location:"uri" locationName:"UUID" type:"string" required:"true"`
	// contains filtered or unexported fields
}

type UpdateFunctionCodeInput

type UpdateFunctionCodeInput struct {
	// The existing Lambda function name whose code you want to replace.
	//
	//  You can specify an unqualified function name (for example, "Thumbnail")
	// or you can specify Amazon Resource Name (ARN) of the function (for example,
	// "arn:aws:lambda:us-west-2:account-id:function:ThumbNail"). AWS Lambda also
	// allows you to specify only the account ID qualifier (for example, "account-id:Thumbnail").
	// Note that the length constraint applies only to the ARN. If you specify only
	// the function name, it is limited to 64 character in length.
	FunctionName *string `location:"uri" locationName:"FunctionName" type:"string" required:"true"`

	// Amazon S3 bucket name where the .zip file containing your deployment package
	// is stored. This bucket must reside in the same AWS region where you are creating
	// the Lambda function.
	S3Bucket *string `type:"string"`

	// The Amazon S3 object (the deployment package) key name you want to upload.
	S3Key *string `type:"string"`

	// The Amazon S3 object (the deployment package) version you want to upload.
	S3ObjectVersion *string `type:"string"`

	// Based64-encoded .zip file containing your packaged source code.
	ZipFile []byte `type:"blob"`
	// contains filtered or unexported fields
}

type UpdateFunctionConfigurationInput

type UpdateFunctionConfigurationInput struct {
	// A short user-defined function description. AWS Lambda does not use this value.
	// Assign a meaningful description as you see fit.
	Description *string `type:"string"`

	// The name of the Lambda function.
	//
	//  You can specify an unqualified function name (for example, "Thumbnail")
	// or you can specify Amazon Resource Name (ARN) of the function (for example,
	// "arn:aws:lambda:us-west-2:account-id:function:ThumbNail"). AWS Lambda also
	// allows you to specify only the account ID qualifier (for example, "account-id:Thumbnail").
	// Note that the length constraint applies only to the ARN. If you specify only
	// the function name, it is limited to 64 character in length.
	FunctionName *string `location:"uri" locationName:"FunctionName" type:"string" required:"true"`

	// The function that Lambda calls to begin executing your function. For Node.js,
	// it is the module-name.export value in your function.
	Handler *string `type:"string"`

	// The amount of memory, in MB, your Lambda function is given. AWS Lambda uses
	// this memory size to infer the amount of CPU allocated to your function. Your
	// function use-case determines your CPU and memory requirements. For example,
	// a database operation might need less memory compared to an image processing
	// function. The default value is 128 MB. The value must be a multiple of 64
	// MB.
	MemorySize *int64 `type:"integer"`

	// The Amazon Resource Name (ARN) of the IAM role that Lambda will assume when
	// it executes your function.
	Role *string `type:"string"`

	// The function execution time at which AWS Lambda should terminate the function.
	// Because the execution time has cost implications, we recommend you set this
	// value based on your expected execution time. The default is 3 seconds.
	Timeout *int64 `type:"integer"`
	// contains filtered or unexported fields
}

Directories

Path Synopsis
Package lambdaiface provides an interface for the AWS Lambda.
Package lambdaiface provides an interface for the AWS Lambda.

Jump to

Keyboard shortcuts

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