Documentation
¶
Overview ¶
Package lambda provides a client for AWS Lambda.
Index ¶
- type AddEventSourceInput
- type DeleteFunctionInput
- type DeleteFunctionOutput
- type EventSourceConfiguration
- type FunctionCodeLocation
- type FunctionConfiguration
- type GetEventSourceInput
- type GetFunctionConfigurationInput
- type GetFunctionInput
- type GetFunctionOutput
- type InvokeAsyncInput
- type InvokeAsyncOutput
- type Lambda
- func (c *Lambda) AddEventSource(input *AddEventSourceInput) (output *EventSourceConfiguration, err error)
- func (c *Lambda) AddEventSourceRequest(input *AddEventSourceInput) (req *aws.Request, output *EventSourceConfiguration)
- func (c *Lambda) DeleteFunction(input *DeleteFunctionInput) (output *DeleteFunctionOutput, err error)
- func (c *Lambda) DeleteFunctionRequest(input *DeleteFunctionInput) (req *aws.Request, output *DeleteFunctionOutput)
- func (c *Lambda) GetEventSource(input *GetEventSourceInput) (output *EventSourceConfiguration, err error)
- func (c *Lambda) GetEventSourceRequest(input *GetEventSourceInput) (req *aws.Request, output *EventSourceConfiguration)
- func (c *Lambda) GetFunction(input *GetFunctionInput) (output *GetFunctionOutput, err error)
- func (c *Lambda) GetFunctionConfiguration(input *GetFunctionConfigurationInput) (output *FunctionConfiguration, err error)
- func (c *Lambda) GetFunctionConfigurationRequest(input *GetFunctionConfigurationInput) (req *aws.Request, output *FunctionConfiguration)
- func (c *Lambda) GetFunctionRequest(input *GetFunctionInput) (req *aws.Request, output *GetFunctionOutput)
- func (c *Lambda) InvokeAsync(input *InvokeAsyncInput) (output *InvokeAsyncOutput, err error)
- func (c *Lambda) InvokeAsyncRequest(input *InvokeAsyncInput) (req *aws.Request, output *InvokeAsyncOutput)
- func (c *Lambda) ListEventSources(input *ListEventSourcesInput) (output *ListEventSourcesOutput, err error)
- func (c *Lambda) ListEventSourcesRequest(input *ListEventSourcesInput) (req *aws.Request, output *ListEventSourcesOutput)
- func (c *Lambda) ListFunctions(input *ListFunctionsInput) (output *ListFunctionsOutput, err error)
- func (c *Lambda) ListFunctionsRequest(input *ListFunctionsInput) (req *aws.Request, output *ListFunctionsOutput)
- func (c *Lambda) RemoveEventSource(input *RemoveEventSourceInput) (output *RemoveEventSourceOutput, err error)
- func (c *Lambda) RemoveEventSourceRequest(input *RemoveEventSourceInput) (req *aws.Request, output *RemoveEventSourceOutput)
- func (c *Lambda) UpdateFunctionConfiguration(input *UpdateFunctionConfigurationInput) (output *FunctionConfiguration, err error)
- func (c *Lambda) UpdateFunctionConfigurationRequest(input *UpdateFunctionConfigurationInput) (req *aws.Request, output *FunctionConfiguration)
- func (c *Lambda) UploadFunction(input *UploadFunctionInput) (output *FunctionConfiguration, err error)
- func (c *Lambda) UploadFunctionRequest(input *UploadFunctionInput) (req *aws.Request, output *FunctionConfiguration)
- type ListEventSourcesInput
- type ListEventSourcesOutput
- type ListFunctionsInput
- type ListFunctionsOutput
- type RemoveEventSourceInput
- type RemoveEventSourceOutput
- type UpdateFunctionConfigurationInput
- type UploadFunctionInput
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AddEventSourceInput ¶
type AddEventSourceInput struct { // The largest number of records that AWS Lambda will give to your function // in a single event. The default is 100 records. BatchSize *int64 `type:"integer"` // The Amazon Resource Name (ARN) of the Amazon Kinesis stream that is the event // source. Any record added to this stream causes AWS Lambda to invoke your // Lambda function. AWS Lambda POSTs the Amazon Kinesis event, containing records, // to your Lambda function as JSON. EventSource *string `type:"string" required:"true"` // The Lambda function to invoke when AWS Lambda detects an event on the stream. FunctionName *string `type:"string" required:"true"` // A map (key-value pairs) defining the configuration for AWS Lambda to use // when reading the event source. Currently, AWS Lambda supports only the InitialPositionInStream // key. The valid values are: "TRIM_HORIZON" and "LATEST". The default value // is "TRIM_HORIZON". 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 Service API Reference. Parameters *map[string]*string `type:"map"` // The ARN of the IAM role (invocation role) that AWS Lambda can assume to read // from the stream and invoke the function. Role *string `type:"string" required:"true"` // contains filtered or unexported fields }
type DeleteFunctionInput ¶
type DeleteFunctionInput struct { // The Lambda function to delete. 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 EventSourceConfiguration ¶
type EventSourceConfiguration struct { // The largest number of records that AWS Lambda will POST in the invocation // request to your function. BatchSize *int64 `type:"integer"` // The Amazon Resource Name (ARN) of the Amazon Kinesis stream that is the source // of events. EventSource *string `type:"string"` // The Lambda function to invoke when AWS Lambda detects an event on the stream. FunctionName *string `type:"string"` // Indicates whether the event source mapping is currently honored. Events are // only processes if IsActive is true. IsActive *bool `type:"boolean"` // The UTC time string indicating the last time the event mapping was updated. LastModified *string `type:"string"` // The map (key-value pairs) defining the configuration for AWS Lambda to use // when reading the event source. Parameters *map[string]*string `type:"map"` // The ARN of the IAM role (invocation role) that AWS Lambda can assume to read // from the stream and invoke the function. Role *string `type:"string"` // The description of the health of the event source mapping. Valid values are: // "PENDING", "OK", and "PROBLEM:message". Initially this staus is "PENDING". // When AWS Lambda begins processing events, it changes the status to "OK". Status *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 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"` // A Lambda-assigned unique identifier for the current function code and related // configuration. ConfigurationID *string `locationName:"ConfigurationId" type:"string"` // The user-provided description. Description *string `type:"string"` // The Amazon Resource Name (ARN) assigned to the function. FunctionARN *string `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 type of the Lambda function you uploaded. Mode *string `type:"string"` // 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 GetEventSourceInput ¶
type GetEventSourceInput 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. FunctionName *string `location:"uri" locationName:"FunctionName" type:"string" required:"true"` // contains filtered or unexported fields }
type GetFunctionInput ¶
type GetFunctionInput struct { // The Lambda function name. 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 AWS Lambda function location (see API_FunctionCodeLocation
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 Lambda ¶
Lambda is a client for AWS Lambda.
func (*Lambda) AddEventSource ¶
func (c *Lambda) AddEventSource(input *AddEventSourceInput) (output *EventSourceConfiguration, err error)
Identifies a stream as an event source for an AWS Lambda function. It can be either an Amazon Kinesis stream or a 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 an AWS Lambda function is called the event source mapping. You provide the configuration information (for example, which stream to read from and which AWS Lambda function to invoke) for the event source mapping in the request body.
Each event source, such as a Kinesis stream, can only be associated with
one AWS Lambda function. If you call AddEventSource for an event source that is already mapped to another AWS Lambda function, the existing mapping is updated to call the new function instead of the old one.
This operation requires permission for the iam:PassRole action for the IAM role. It also requires permission for the lambda:AddEventSource action.
Example ¶
package main import ( "fmt" "github.com/datacratic/aws-sdk-go/aws" "github.com/datacratic/aws-sdk-go/aws/awsutil" "github.com/datacratic/aws-sdk-go/service/lambda" ) func main() { svc := lambda.New(nil) params := &lambda.AddEventSourceInput{ EventSource: aws.String("String"), // Required FunctionName: aws.String("FunctionName"), // Required Role: aws.String("RoleArn"), // Required BatchSize: aws.Long(1), Parameters: &map[string]*string{ "Key": aws.String("String"), // Required // More values... }, } resp, err := svc.AddEventSource(params) if awserr := aws.Error(err); awserr != nil { // A service error occurred. fmt.Println("Error:", awserr.Code, awserr.Message) } else if err != nil { // A non-service error occurred. panic(err) } // Pretty-print the response data. fmt.Println(awsutil.StringValue(resp)) }
Output:
func (*Lambda) AddEventSourceRequest ¶
func (c *Lambda) AddEventSourceRequest(input *AddEventSourceInput) (req *aws.Request, output *EventSourceConfiguration)
AddEventSourceRequest generates a request for the AddEventSource operation.
func (*Lambda) DeleteFunction ¶
func (c *Lambda) DeleteFunction(input *DeleteFunctionInput) (output *DeleteFunctionOutput, err error)
Deletes the specified Lambda function code and configuration.
This operation requires permission for the lambda:DeleteFunction action.
Example ¶
package main import ( "fmt" "github.com/datacratic/aws-sdk-go/aws" "github.com/datacratic/aws-sdk-go/aws/awsutil" "github.com/datacratic/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 awserr := aws.Error(err); awserr != nil { // A service error occurred. fmt.Println("Error:", awserr.Code, awserr.Message) } else if err != nil { // A non-service error occurred. panic(err) } // 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) GetEventSource ¶
func (c *Lambda) GetEventSource(input *GetEventSourceInput) (output *EventSourceConfiguration, err error)
Returns configuration information for the specified event source mapping (see AddEventSource).
This operation requires permission for the lambda:GetEventSource action.
Example ¶
package main import ( "fmt" "github.com/datacratic/aws-sdk-go/aws" "github.com/datacratic/aws-sdk-go/aws/awsutil" "github.com/datacratic/aws-sdk-go/service/lambda" ) func main() { svc := lambda.New(nil) params := &lambda.GetEventSourceInput{ UUID: aws.String("String"), // Required } resp, err := svc.GetEventSource(params) if awserr := aws.Error(err); awserr != nil { // A service error occurred. fmt.Println("Error:", awserr.Code, awserr.Message) } else if err != nil { // A non-service error occurred. panic(err) } // Pretty-print the response data. fmt.Println(awsutil.StringValue(resp)) }
Output:
func (*Lambda) GetEventSourceRequest ¶
func (c *Lambda) GetEventSourceRequest(input *GetEventSourceInput) (req *aws.Request, output *EventSourceConfiguration)
GetEventSourceRequest generates a request for the GetEventSource operation.
func (*Lambda) GetFunction ¶
func (c *Lambda) GetFunction(input *GetFunctionInput) (output *GetFunctionOutput, err error)
Returns the configuration information of the Lambda function and a presigned URL link to the .zip file you uploaded with UploadFunction 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/datacratic/aws-sdk-go/aws" "github.com/datacratic/aws-sdk-go/aws/awsutil" "github.com/datacratic/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 awserr := aws.Error(err); awserr != nil { // A service error occurred. fmt.Println("Error:", awserr.Code, awserr.Message) } else if err != nil { // A non-service error occurred. panic(err) } // Pretty-print the response data. fmt.Println(awsutil.StringValue(resp)) }
Output:
func (*Lambda) GetFunctionConfiguration ¶
func (c *Lambda) GetFunctionConfiguration(input *GetFunctionConfigurationInput) (output *FunctionConfiguration, err error)
Returns the configuration information of the Lambda function. This the same information you provided as parameters when uploading the function by using UploadFunction.
This operation requires permission for the lambda:GetFunctionConfiguration operation.
Example ¶
package main import ( "fmt" "github.com/datacratic/aws-sdk-go/aws" "github.com/datacratic/aws-sdk-go/aws/awsutil" "github.com/datacratic/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 awserr := aws.Error(err); awserr != nil { // A service error occurred. fmt.Println("Error:", awserr.Code, awserr.Message) } else if err != nil { // A non-service error occurred. panic(err) } // 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) InvokeAsync ¶
func (c *Lambda) InvokeAsync(input *InvokeAsyncInput) (output *InvokeAsyncOutput, err error)
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:InvokeAsync action.
Example ¶
package main import ( "bytes" "fmt" "github.com/datacratic/aws-sdk-go/aws" "github.com/datacratic/aws-sdk-go/aws/awsutil" "github.com/datacratic/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 awserr := aws.Error(err); awserr != nil { // A service error occurred. fmt.Println("Error:", awserr.Code, awserr.Message) } else if err != nil { // A non-service error occurred. panic(err) } // 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) ListEventSources ¶
func (c *Lambda) ListEventSources(input *ListEventSourcesInput) (output *ListEventSourcesOutput, err error)
Returns a list of event source mappings you created using the AddEventSource (see AddEventSource), where you identify a stream as 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:ListEventSources action.
Example ¶
package main import ( "fmt" "github.com/datacratic/aws-sdk-go/aws" "github.com/datacratic/aws-sdk-go/aws/awsutil" "github.com/datacratic/aws-sdk-go/service/lambda" ) func main() { svc := lambda.New(nil) params := &lambda.ListEventSourcesInput{ EventSourceARN: aws.String("String"), FunctionName: aws.String("FunctionName"), Marker: aws.String("String"), MaxItems: aws.Long(1), } resp, err := svc.ListEventSources(params) if awserr := aws.Error(err); awserr != nil { // A service error occurred. fmt.Println("Error:", awserr.Code, awserr.Message) } else if err != nil { // A non-service error occurred. panic(err) } // Pretty-print the response data. fmt.Println(awsutil.StringValue(resp)) }
Output:
func (*Lambda) ListEventSourcesRequest ¶
func (c *Lambda) ListEventSourcesRequest(input *ListEventSourcesInput) (req *aws.Request, output *ListEventSourcesOutput)
ListEventSourcesRequest generates a request for the ListEventSources operation.
func (*Lambda) ListFunctions ¶
func (c *Lambda) ListFunctions(input *ListFunctionsInput) (output *ListFunctionsOutput, err 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/datacratic/aws-sdk-go/aws" "github.com/datacratic/aws-sdk-go/aws/awsutil" "github.com/datacratic/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 awserr := aws.Error(err); awserr != nil { // A service error occurred. fmt.Println("Error:", awserr.Code, awserr.Message) } else if err != nil { // A non-service error occurred. panic(err) } // Pretty-print the response data. fmt.Println(awsutil.StringValue(resp)) }
Output:
func (*Lambda) ListFunctionsRequest ¶
func (c *Lambda) ListFunctionsRequest(input *ListFunctionsInput) (req *aws.Request, output *ListFunctionsOutput)
ListFunctionsRequest generates a request for the ListFunctions operation.
func (*Lambda) RemoveEventSource ¶
func (c *Lambda) RemoveEventSource(input *RemoveEventSourceInput) (output *RemoveEventSourceOutput, err 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:RemoveEventSource action.
Example ¶
package main import ( "fmt" "github.com/datacratic/aws-sdk-go/aws" "github.com/datacratic/aws-sdk-go/aws/awsutil" "github.com/datacratic/aws-sdk-go/service/lambda" ) func main() { svc := lambda.New(nil) params := &lambda.RemoveEventSourceInput{ UUID: aws.String("String"), // Required } resp, err := svc.RemoveEventSource(params) if awserr := aws.Error(err); awserr != nil { // A service error occurred. fmt.Println("Error:", awserr.Code, awserr.Message) } else if err != nil { // A non-service error occurred. panic(err) } // Pretty-print the response data. fmt.Println(awsutil.StringValue(resp)) }
Output:
func (*Lambda) RemoveEventSourceRequest ¶
func (c *Lambda) RemoveEventSourceRequest(input *RemoveEventSourceInput) (req *aws.Request, output *RemoveEventSourceOutput)
RemoveEventSourceRequest generates a request for the RemoveEventSource operation.
func (*Lambda) UpdateFunctionConfiguration ¶
func (c *Lambda) UpdateFunctionConfiguration(input *UpdateFunctionConfigurationInput) (output *FunctionConfiguration, err 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/datacratic/aws-sdk-go/aws" "github.com/datacratic/aws-sdk-go/aws/awsutil" "github.com/datacratic/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 awserr := aws.Error(err); awserr != nil { // A service error occurred. fmt.Println("Error:", awserr.Code, awserr.Message) } else if err != nil { // A non-service error occurred. panic(err) } // 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.
func (*Lambda) UploadFunction ¶
func (c *Lambda) UploadFunction(input *UploadFunctionInput) (output *FunctionConfiguration, err error)
Creates a new Lambda function or updates an existing 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 existing Lambda function is updated with the new code and metadata.
This operation requires permission for the lambda:UploadFunction action.
Example ¶
package main import ( "bytes" "fmt" "github.com/datacratic/aws-sdk-go/aws" "github.com/datacratic/aws-sdk-go/aws/awsutil" "github.com/datacratic/aws-sdk-go/service/lambda" ) func main() { svc := lambda.New(nil) params := &lambda.UploadFunctionInput{ FunctionName: aws.String("FunctionName"), // Required FunctionZip: bytes.NewReader([]byte("PAYLOAD")), // Required Handler: aws.String("Handler"), // Required Mode: aws.String("Mode"), // 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.UploadFunction(params) if awserr := aws.Error(err); awserr != nil { // A service error occurred. fmt.Println("Error:", awserr.Code, awserr.Message) } else if err != nil { // A non-service error occurred. panic(err) } // Pretty-print the response data. fmt.Println(awsutil.StringValue(resp)) }
Output:
func (*Lambda) UploadFunctionRequest ¶
func (c *Lambda) UploadFunctionRequest(input *UploadFunctionInput) (req *aws.Request, output *FunctionConfiguration)
UploadFunctionRequest generates a request for the UploadFunction operation.
type ListEventSourcesInput ¶
type ListEventSourcesInput struct { // The Amazon Resource Name (ARN) of the Amazon Kinesis stream. EventSourceARN *string `location:"querystring" locationName:"EventSource" type:"string"` // The name of the AWS Lambda function. FunctionName *string `location:"querystring" locationName:"FunctionName" type:"string"` // Optional string. An opaque pagination token returned from a previous ListEventSources // 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 ListEventSourcesOutput ¶
type ListEventSourcesOutput struct { // An arrary of EventSourceConfiguration objects. EventSources []*EventSourceConfiguration `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_EventSourceConfiguration)
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 API_FunctionConfiguration.
type RemoveEventSourceInput ¶
type RemoveEventSourceInput struct { // The event source mapping ID. UUID *string `location:"uri" locationName:"UUID" type:"string" required:"true"` // contains filtered or unexported fields }
type RemoveEventSourceOutput ¶
type RemoveEventSourceOutput struct {
// contains filtered or unexported fields
}
type UpdateFunctionConfigurationInput ¶
type UpdateFunctionConfigurationInput struct { // A short user-defined function description. Lambda does not use this value. // Assign a meaningful description as you see fit. Description *string `location:"querystring" locationName:"Description" type:"string"` // The name of the Lambda function. 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 `location:"querystring" locationName:"Handler" type:"string"` // The amount of memory, in MB, your Lambda function is given. 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 `location:"querystring" locationName:"MemorySize" type:"integer"` // The Amazon Resource Name (ARN) of the IAM role that Lambda will assume when // it executes your function. Role *string `location:"querystring" locationName:"Role" 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 `location:"querystring" locationName:"Timeout" type:"integer"` // contains filtered or unexported fields }
type UploadFunctionInput ¶
type UploadFunctionInput struct { // A short, user-defined function description. Lambda does not use this value. // Assign a meaningful description as you see fit. Description *string `location:"querystring" locationName:"Description" type:"string"` // The name you want to assign to the function you are uploading. 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 InvokeAsync. FunctionName *string `location:"uri" locationName:"FunctionName" type:"string" required:"true"` // A .zip file containing your packaged source code. For more information about // creating a .zip file, go to AWS LambdaL How it Works (http://docs.aws.amazon.com/lambda/latest/dg/walkthrough-custom-events.html) // in the AWS Lambda Developer Guide. FunctionZip io.ReadSeeker `type:"blob" required:"true"` // The function that Lambda calls to begin execution. For Node.js, it is the // module-name.export value in your function. Handler *string `location:"querystring" locationName:"Handler" 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 allocated to your function. Your function // use-case determines your CPU and memory requirements. For example, database // operation might need less memory compared to image processing function. The // default value is 128 MB. The value must be a multiple of 64 MB. MemorySize *int64 `location:"querystring" locationName:"MemorySize" type:"integer"` // How the Lambda function will be invoked. Lambda supports only the "event" // mode. Mode *string `location:"querystring" locationName:"Mode" type:"string" required:"true"` // 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 `location:"querystring" locationName:"Role" type:"string" required:"true"` // The runtime environment for the Lambda function you are uploading. Currently, // Lambda supports only "nodejs" as the runtime. Runtime *string `location:"querystring" locationName:"Runtime" 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 `location:"querystring" locationName:"Timeout" type:"integer"` // contains filtered or unexported fields }