Switch to using the dep tool and update all the dependencies

This commit is contained in:
Nick Craig-Wood 2017-05-11 15:39:54 +01:00
parent 5135ff73cb
commit 98c2d2c41b
5321 changed files with 4483201 additions and 5922 deletions

6477
vendor/github.com/aws/aws-sdk-go/service/lambda/api.go generated vendored Normal file

File diff suppressed because it is too large Load diff

84
vendor/github.com/aws/aws-sdk-go/service/lambda/doc.go generated vendored Normal file
View file

@ -0,0 +1,84 @@
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
// Package lambda provides the client and types for making API
// requests to AWS Lambda.
//
// Overview
//
// This is the AWS Lambda API Reference. The AWS Lambda Developer Guide provides
// additional information. For the service overview, see What is AWS Lambda
// (http://docs.aws.amazon.com/lambda/latest/dg/welcome.html), and for information
// about how the service works, see AWS Lambda: How it Works (http://docs.aws.amazon.com/lambda/latest/dg/lambda-introduction.html)
// in the AWS Lambda Developer Guide.
//
// See lambda package documentation for more information.
// https://docs.aws.amazon.com/sdk-for-go/api/service/lambda/
//
// Using the Client
//
// To use the client for AWS Lambda you will first need
// to create a new instance of it.
//
// When creating a client for an AWS service you'll first need to have a Session
// already created. The Session provides configuration that can be shared
// between multiple service clients. Additional configuration can be applied to
// the Session and service's client when they are constructed. The aws package's
// Config type contains several fields such as Region for the AWS Region the
// client should make API requests too. The optional Config value can be provided
// as the variadic argument for Sessions and client creation.
//
// Once the service's client is created you can use it to make API requests the
// AWS service. These clients are safe to use concurrently.
//
// // Create a session to share configuration, and load external configuration.
// sess := session.Must(session.NewSession())
//
// // Create the service's client with the session.
// svc := lambda.New(sess)
//
// See the SDK's documentation for more information on how to use service clients.
// https://docs.aws.amazon.com/sdk-for-go/api/
//
// See aws package's Config type for more information on configuration options.
// https://docs.aws.amazon.com/sdk-for-go/api/aws/#Config
//
// See the AWS Lambda client Lambda for more
// information on creating the service's client.
// https://docs.aws.amazon.com/sdk-for-go/api/service/lambda/#New
//
// Once the client is created you can make an API request to the service.
// Each API method takes a input parameter, and returns the service response
// and an error.
//
// The API method will document which error codes the service can be returned
// by the operation if the service models the API operation's errors. These
// errors will also be available as const strings prefixed with "ErrCode".
//
// result, err := svc.AddPermission(params)
// if err != nil {
// // Cast err to awserr.Error to handle specific error codes.
// aerr, ok := err.(awserr.Error)
// if ok && aerr.Code() == <error code to check for> {
// // Specific error code handling
// }
// return err
// }
//
// fmt.Println("AddPermission result:")
// fmt.Println(result)
//
// Using the Client with Context
//
// The service's client also provides methods to make API requests with a Context
// value. This allows you to control the timeout, and cancellation of pending
// requests. These methods also take request Option as variadic parameter to apply
// additional configuration to the API request.
//
// ctx := context.Background()
//
// result, err := svc.AddPermissionWithContext(ctx, params)
//
// See the request package documentation for more information on using Context pattern
// with the SDK.
// https://docs.aws.amazon.com/sdk-for-go/api/aws/request/
package lambda

View file

@ -0,0 +1,148 @@
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
package lambda
const (
// ErrCodeCodeStorageExceededException for service response error code
// "CodeStorageExceededException".
//
// You have exceeded your maximum total code size per account. Limits (http://docs.aws.amazon.com/lambda/latest/dg/limits.html)
ErrCodeCodeStorageExceededException = "CodeStorageExceededException"
// ErrCodeEC2AccessDeniedException for service response error code
// "EC2AccessDeniedException".
ErrCodeEC2AccessDeniedException = "EC2AccessDeniedException"
// ErrCodeEC2ThrottledException for service response error code
// "EC2ThrottledException".
//
// AWS Lambda was throttled by Amazon EC2 during Lambda function initialization
// using the execution role provided for the Lambda function.
ErrCodeEC2ThrottledException = "EC2ThrottledException"
// ErrCodeEC2UnexpectedException for service response error code
// "EC2UnexpectedException".
//
// AWS Lambda received an unexpected EC2 client exception while setting up for
// the Lambda function.
ErrCodeEC2UnexpectedException = "EC2UnexpectedException"
// ErrCodeENILimitReachedException for service response error code
// "ENILimitReachedException".
//
// AWS Lambda was not able to create an Elastic Network Interface (ENI) in the
// VPC, specified as part of Lambda function configuration, because the limit
// for network interfaces has been reached.
ErrCodeENILimitReachedException = "ENILimitReachedException"
// ErrCodeInvalidParameterValueException for service response error code
// "InvalidParameterValueException".
//
// One of the parameters in the request is invalid. For example, if you provided
// an IAM role for AWS Lambda to assume in the CreateFunction or the UpdateFunctionConfiguration
// API, that AWS Lambda is unable to assume you will get this exception.
ErrCodeInvalidParameterValueException = "InvalidParameterValueException"
// ErrCodeInvalidRequestContentException for service response error code
// "InvalidRequestContentException".
//
// The request body could not be parsed as JSON.
ErrCodeInvalidRequestContentException = "InvalidRequestContentException"
// ErrCodeInvalidSecurityGroupIDException for service response error code
// "InvalidSecurityGroupIDException".
//
// The Security Group ID provided in the Lambda function VPC configuration is
// invalid.
ErrCodeInvalidSecurityGroupIDException = "InvalidSecurityGroupIDException"
// ErrCodeInvalidSubnetIDException for service response error code
// "InvalidSubnetIDException".
//
// The Subnet ID provided in the Lambda function VPC configuration is invalid.
ErrCodeInvalidSubnetIDException = "InvalidSubnetIDException"
// ErrCodeInvalidZipFileException for service response error code
// "InvalidZipFileException".
//
// AWS Lambda could not unzip the function zip file.
ErrCodeInvalidZipFileException = "InvalidZipFileException"
// ErrCodeKMSAccessDeniedException for service response error code
// "KMSAccessDeniedException".
//
// Lambda was unable to decrypt the environment variables because KMS access
// was denied. Check the Lambda function's KMS permissions.
ErrCodeKMSAccessDeniedException = "KMSAccessDeniedException"
// ErrCodeKMSDisabledException for service response error code
// "KMSDisabledException".
//
// Lambda was unable to decrypt the environment variables because the KMS key
// used is disabled. Check the Lambda function's KMS key settings.
ErrCodeKMSDisabledException = "KMSDisabledException"
// ErrCodeKMSInvalidStateException for service response error code
// "KMSInvalidStateException".
//
// Lambda was unable to decrypt the environment variables because the KMS key
// used is in an invalid state for Decrypt. Check the function's KMS key settings.
ErrCodeKMSInvalidStateException = "KMSInvalidStateException"
// ErrCodeKMSNotFoundException for service response error code
// "KMSNotFoundException".
//
// Lambda was unable to decrypt the environment variables because the KMS key
// was not found. Check the function's KMS key settings.
ErrCodeKMSNotFoundException = "KMSNotFoundException"
// ErrCodePolicyLengthExceededException for service response error code
// "PolicyLengthExceededException".
//
// Lambda function access policy is limited to 20 KB.
ErrCodePolicyLengthExceededException = "PolicyLengthExceededException"
// ErrCodeRequestTooLargeException for service response error code
// "RequestTooLargeException".
//
// The request payload exceeded the Invoke request body JSON input limit. For
// more information, see Limits (http://docs.aws.amazon.com/lambda/latest/dg/limits.html).
ErrCodeRequestTooLargeException = "RequestTooLargeException"
// ErrCodeResourceConflictException for service response error code
// "ResourceConflictException".
//
// The resource already exists.
ErrCodeResourceConflictException = "ResourceConflictException"
// ErrCodeResourceNotFoundException for service response error code
// "ResourceNotFoundException".
//
// The resource (for example, a Lambda function or access policy statement)
// specified in the request does not exist.
ErrCodeResourceNotFoundException = "ResourceNotFoundException"
// ErrCodeServiceException for service response error code
// "ServiceException".
//
// The AWS Lambda service encountered an internal error.
ErrCodeServiceException = "ServiceException"
// ErrCodeSubnetIPAddressLimitReachedException for service response error code
// "SubnetIPAddressLimitReachedException".
//
// AWS Lambda was not able to set up VPC access for the Lambda function because
// one or more configured subnets has no available IP addresses.
ErrCodeSubnetIPAddressLimitReachedException = "SubnetIPAddressLimitReachedException"
// ErrCodeTooManyRequestsException for service response error code
// "TooManyRequestsException".
ErrCodeTooManyRequestsException = "TooManyRequestsException"
// ErrCodeUnsupportedMediaTypeException for service response error code
// "UnsupportedMediaTypeException".
//
// The content type of the Invoke request body is not JSON.
ErrCodeUnsupportedMediaTypeException = "UnsupportedMediaTypeException"
)

View file

@ -0,0 +1,731 @@
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
package lambda_test
import (
"bytes"
"fmt"
"time"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/lambda"
)
var _ time.Duration
var _ bytes.Buffer
func ExampleLambda_AddPermission() {
sess := session.Must(session.NewSession())
svc := lambda.New(sess)
params := &lambda.AddPermissionInput{
Action: aws.String("Action"), // Required
FunctionName: aws.String("FunctionName"), // Required
Principal: aws.String("Principal"), // Required
StatementId: aws.String("StatementId"), // Required
EventSourceToken: aws.String("EventSourceToken"),
Qualifier: aws.String("Qualifier"),
SourceAccount: aws.String("SourceOwner"),
SourceArn: aws.String("Arn"),
}
resp, err := svc.AddPermission(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleLambda_CreateAlias() {
sess := session.Must(session.NewSession())
svc := lambda.New(sess)
params := &lambda.CreateAliasInput{
FunctionName: aws.String("FunctionName"), // Required
FunctionVersion: aws.String("Version"), // Required
Name: aws.String("Alias"), // Required
Description: aws.String("Description"),
}
resp, err := svc.CreateAlias(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleLambda_CreateEventSourceMapping() {
sess := session.Must(session.NewSession())
svc := lambda.New(sess)
params := &lambda.CreateEventSourceMappingInput{
EventSourceArn: aws.String("Arn"), // Required
FunctionName: aws.String("FunctionName"), // Required
StartingPosition: aws.String("EventSourcePosition"), // Required
BatchSize: aws.Int64(1),
Enabled: aws.Bool(true),
StartingPositionTimestamp: aws.Time(time.Now()),
}
resp, err := svc.CreateEventSourceMapping(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleLambda_CreateFunction() {
sess := session.Must(session.NewSession())
svc := lambda.New(sess)
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
DeadLetterConfig: &lambda.DeadLetterConfig{
TargetArn: aws.String("ResourceArn"),
},
Description: aws.String("Description"),
Environment: &lambda.Environment{
Variables: map[string]*string{
"Key": aws.String("EnvironmentVariableValue"), // Required
// More values...
},
},
KMSKeyArn: aws.String("KMSKeyArn"),
MemorySize: aws.Int64(1),
Publish: aws.Bool(true),
Tags: map[string]*string{
"Key": aws.String("TagValue"), // Required
// More values...
},
Timeout: aws.Int64(1),
TracingConfig: &lambda.TracingConfig{
Mode: aws.String("TracingMode"),
},
VpcConfig: &lambda.VpcConfig{
SecurityGroupIds: []*string{
aws.String("SecurityGroupId"), // Required
// More values...
},
SubnetIds: []*string{
aws.String("SubnetId"), // Required
// More values...
},
},
}
resp, err := svc.CreateFunction(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleLambda_DeleteAlias() {
sess := session.Must(session.NewSession())
svc := lambda.New(sess)
params := &lambda.DeleteAliasInput{
FunctionName: aws.String("FunctionName"), // Required
Name: aws.String("Alias"), // Required
}
resp, err := svc.DeleteAlias(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleLambda_DeleteEventSourceMapping() {
sess := session.Must(session.NewSession())
svc := lambda.New(sess)
params := &lambda.DeleteEventSourceMappingInput{
UUID: aws.String("String"), // Required
}
resp, err := svc.DeleteEventSourceMapping(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleLambda_DeleteFunction() {
sess := session.Must(session.NewSession())
svc := lambda.New(sess)
params := &lambda.DeleteFunctionInput{
FunctionName: aws.String("FunctionName"), // Required
Qualifier: aws.String("Qualifier"),
}
resp, err := svc.DeleteFunction(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleLambda_GetAccountSettings() {
sess := session.Must(session.NewSession())
svc := lambda.New(sess)
var params *lambda.GetAccountSettingsInput
resp, err := svc.GetAccountSettings(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleLambda_GetAlias() {
sess := session.Must(session.NewSession())
svc := lambda.New(sess)
params := &lambda.GetAliasInput{
FunctionName: aws.String("FunctionName"), // Required
Name: aws.String("Alias"), // Required
}
resp, err := svc.GetAlias(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleLambda_GetEventSourceMapping() {
sess := session.Must(session.NewSession())
svc := lambda.New(sess)
params := &lambda.GetEventSourceMappingInput{
UUID: aws.String("String"), // Required
}
resp, err := svc.GetEventSourceMapping(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleLambda_GetFunction() {
sess := session.Must(session.NewSession())
svc := lambda.New(sess)
params := &lambda.GetFunctionInput{
FunctionName: aws.String("FunctionName"), // Required
Qualifier: aws.String("Qualifier"),
}
resp, err := svc.GetFunction(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleLambda_GetFunctionConfiguration() {
sess := session.Must(session.NewSession())
svc := lambda.New(sess)
params := &lambda.GetFunctionConfigurationInput{
FunctionName: aws.String("FunctionName"), // Required
Qualifier: aws.String("Qualifier"),
}
resp, err := svc.GetFunctionConfiguration(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleLambda_GetPolicy() {
sess := session.Must(session.NewSession())
svc := lambda.New(sess)
params := &lambda.GetPolicyInput{
FunctionName: aws.String("FunctionName"), // Required
Qualifier: aws.String("Qualifier"),
}
resp, err := svc.GetPolicy(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleLambda_Invoke() {
sess := session.Must(session.NewSession())
svc := lambda.New(sess)
params := &lambda.InvokeInput{
FunctionName: aws.String("FunctionName"), // Required
ClientContext: aws.String("String"),
InvocationType: aws.String("InvocationType"),
LogType: aws.String("LogType"),
Payload: []byte("PAYLOAD"),
Qualifier: aws.String("Qualifier"),
}
resp, err := svc.Invoke(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleLambda_InvokeAsync() {
sess := session.Must(session.NewSession())
svc := lambda.New(sess)
params := &lambda.InvokeAsyncInput{
FunctionName: aws.String("FunctionName"), // Required
InvokeArgs: bytes.NewReader([]byte("PAYLOAD")), // Required
}
resp, err := svc.InvokeAsync(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleLambda_ListAliases() {
sess := session.Must(session.NewSession())
svc := lambda.New(sess)
params := &lambda.ListAliasesInput{
FunctionName: aws.String("FunctionName"), // Required
FunctionVersion: aws.String("Version"),
Marker: aws.String("String"),
MaxItems: aws.Int64(1),
}
resp, err := svc.ListAliases(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleLambda_ListEventSourceMappings() {
sess := session.Must(session.NewSession())
svc := lambda.New(sess)
params := &lambda.ListEventSourceMappingsInput{
EventSourceArn: aws.String("Arn"),
FunctionName: aws.String("FunctionName"),
Marker: aws.String("String"),
MaxItems: aws.Int64(1),
}
resp, err := svc.ListEventSourceMappings(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleLambda_ListFunctions() {
sess := session.Must(session.NewSession())
svc := lambda.New(sess)
params := &lambda.ListFunctionsInput{
Marker: aws.String("String"),
MaxItems: aws.Int64(1),
}
resp, err := svc.ListFunctions(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleLambda_ListTags() {
sess := session.Must(session.NewSession())
svc := lambda.New(sess)
params := &lambda.ListTagsInput{
Resource: aws.String("FunctionArn"), // Required
}
resp, err := svc.ListTags(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleLambda_ListVersionsByFunction() {
sess := session.Must(session.NewSession())
svc := lambda.New(sess)
params := &lambda.ListVersionsByFunctionInput{
FunctionName: aws.String("FunctionName"), // Required
Marker: aws.String("String"),
MaxItems: aws.Int64(1),
}
resp, err := svc.ListVersionsByFunction(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleLambda_PublishVersion() {
sess := session.Must(session.NewSession())
svc := lambda.New(sess)
params := &lambda.PublishVersionInput{
FunctionName: aws.String("FunctionName"), // Required
CodeSha256: aws.String("String"),
Description: aws.String("Description"),
}
resp, err := svc.PublishVersion(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleLambda_RemovePermission() {
sess := session.Must(session.NewSession())
svc := lambda.New(sess)
params := &lambda.RemovePermissionInput{
FunctionName: aws.String("FunctionName"), // Required
StatementId: aws.String("StatementId"), // Required
Qualifier: aws.String("Qualifier"),
}
resp, err := svc.RemovePermission(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleLambda_TagResource() {
sess := session.Must(session.NewSession())
svc := lambda.New(sess)
params := &lambda.TagResourceInput{
Resource: aws.String("FunctionArn"), // Required
Tags: map[string]*string{ // Required
"Key": aws.String("TagValue"), // Required
// More values...
},
}
resp, err := svc.TagResource(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleLambda_UntagResource() {
sess := session.Must(session.NewSession())
svc := lambda.New(sess)
params := &lambda.UntagResourceInput{
Resource: aws.String("FunctionArn"), // Required
TagKeys: []*string{ // Required
aws.String("TagKey"), // Required
// More values...
},
}
resp, err := svc.UntagResource(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleLambda_UpdateAlias() {
sess := session.Must(session.NewSession())
svc := lambda.New(sess)
params := &lambda.UpdateAliasInput{
FunctionName: aws.String("FunctionName"), // Required
Name: aws.String("Alias"), // Required
Description: aws.String("Description"),
FunctionVersion: aws.String("Version"),
}
resp, err := svc.UpdateAlias(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleLambda_UpdateEventSourceMapping() {
sess := session.Must(session.NewSession())
svc := lambda.New(sess)
params := &lambda.UpdateEventSourceMappingInput{
UUID: aws.String("String"), // Required
BatchSize: aws.Int64(1),
Enabled: aws.Bool(true),
FunctionName: aws.String("FunctionName"),
}
resp, err := svc.UpdateEventSourceMapping(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleLambda_UpdateFunctionCode() {
sess := session.Must(session.NewSession())
svc := lambda.New(sess)
params := &lambda.UpdateFunctionCodeInput{
FunctionName: aws.String("FunctionName"), // Required
DryRun: aws.Bool(true),
Publish: aws.Bool(true),
S3Bucket: aws.String("S3Bucket"),
S3Key: aws.String("S3Key"),
S3ObjectVersion: aws.String("S3ObjectVersion"),
ZipFile: []byte("PAYLOAD"),
}
resp, err := svc.UpdateFunctionCode(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleLambda_UpdateFunctionConfiguration() {
sess := session.Must(session.NewSession())
svc := lambda.New(sess)
params := &lambda.UpdateFunctionConfigurationInput{
FunctionName: aws.String("FunctionName"), // Required
DeadLetterConfig: &lambda.DeadLetterConfig{
TargetArn: aws.String("ResourceArn"),
},
Description: aws.String("Description"),
Environment: &lambda.Environment{
Variables: map[string]*string{
"Key": aws.String("EnvironmentVariableValue"), // Required
// More values...
},
},
Handler: aws.String("Handler"),
KMSKeyArn: aws.String("KMSKeyArn"),
MemorySize: aws.Int64(1),
Role: aws.String("RoleArn"),
Runtime: aws.String("Runtime"),
Timeout: aws.Int64(1),
TracingConfig: &lambda.TracingConfig{
Mode: aws.String("TracingMode"),
},
VpcConfig: &lambda.VpcConfig{
SecurityGroupIds: []*string{
aws.String("SecurityGroupId"), // Required
// More values...
},
SubnetIds: []*string{
aws.String("SubnetId"), // Required
// More values...
},
},
}
resp, err := svc.UpdateFunctionConfiguration(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}

View file

@ -0,0 +1,182 @@
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
// Package lambdaiface provides an interface to enable mocking the AWS Lambda service client
// for testing your code.
//
// It is important to note that this interface will have breaking changes
// when the service model is updated and adds new API operations, paginators,
// and waiters.
package lambdaiface
import (
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/request"
"github.com/aws/aws-sdk-go/service/lambda"
)
// LambdaAPI provides an interface to enable mocking the
// lambda.Lambda service client's API operation,
// paginators, and waiters. This make unit testing your code that calls out
// to the SDK's service client's calls easier.
//
// The best way to use this interface is so the SDK's service client's calls
// can be stubbed out for unit testing your code with the SDK without needing
// to inject custom request handlers into the the SDK's request pipeline.
//
// // myFunc uses an SDK service client to make a request to
// // AWS Lambda.
// func myFunc(svc lambdaiface.LambdaAPI) bool {
// // Make svc.AddPermission request
// }
//
// func main() {
// sess := session.New()
// svc := lambda.New(sess)
//
// myFunc(svc)
// }
//
// In your _test.go file:
//
// // Define a mock struct to be used in your unit tests of myFunc.
// type mockLambdaClient struct {
// lambdaiface.LambdaAPI
// }
// func (m *mockLambdaClient) AddPermission(input *lambda.AddPermissionInput) (*lambda.AddPermissionOutput, error) {
// // mock response/functionality
// }
//
// func TestMyFunc(t *testing.T) {
// // Setup Test
// mockSvc := &mockLambdaClient{}
//
// myfunc(mockSvc)
//
// // Verify myFunc's functionality
// }
//
// It is important to note that this interface will have breaking changes
// when the service model is updated and adds new API operations, paginators,
// and waiters. Its suggested to use the pattern above for testing, or using
// tooling to generate mocks to satisfy the interfaces.
type LambdaAPI interface {
AddPermission(*lambda.AddPermissionInput) (*lambda.AddPermissionOutput, error)
AddPermissionWithContext(aws.Context, *lambda.AddPermissionInput, ...request.Option) (*lambda.AddPermissionOutput, error)
AddPermissionRequest(*lambda.AddPermissionInput) (*request.Request, *lambda.AddPermissionOutput)
CreateAlias(*lambda.CreateAliasInput) (*lambda.AliasConfiguration, error)
CreateAliasWithContext(aws.Context, *lambda.CreateAliasInput, ...request.Option) (*lambda.AliasConfiguration, error)
CreateAliasRequest(*lambda.CreateAliasInput) (*request.Request, *lambda.AliasConfiguration)
CreateEventSourceMapping(*lambda.CreateEventSourceMappingInput) (*lambda.EventSourceMappingConfiguration, error)
CreateEventSourceMappingWithContext(aws.Context, *lambda.CreateEventSourceMappingInput, ...request.Option) (*lambda.EventSourceMappingConfiguration, error)
CreateEventSourceMappingRequest(*lambda.CreateEventSourceMappingInput) (*request.Request, *lambda.EventSourceMappingConfiguration)
CreateFunction(*lambda.CreateFunctionInput) (*lambda.FunctionConfiguration, error)
CreateFunctionWithContext(aws.Context, *lambda.CreateFunctionInput, ...request.Option) (*lambda.FunctionConfiguration, error)
CreateFunctionRequest(*lambda.CreateFunctionInput) (*request.Request, *lambda.FunctionConfiguration)
DeleteAlias(*lambda.DeleteAliasInput) (*lambda.DeleteAliasOutput, error)
DeleteAliasWithContext(aws.Context, *lambda.DeleteAliasInput, ...request.Option) (*lambda.DeleteAliasOutput, error)
DeleteAliasRequest(*lambda.DeleteAliasInput) (*request.Request, *lambda.DeleteAliasOutput)
DeleteEventSourceMapping(*lambda.DeleteEventSourceMappingInput) (*lambda.EventSourceMappingConfiguration, error)
DeleteEventSourceMappingWithContext(aws.Context, *lambda.DeleteEventSourceMappingInput, ...request.Option) (*lambda.EventSourceMappingConfiguration, error)
DeleteEventSourceMappingRequest(*lambda.DeleteEventSourceMappingInput) (*request.Request, *lambda.EventSourceMappingConfiguration)
DeleteFunction(*lambda.DeleteFunctionInput) (*lambda.DeleteFunctionOutput, error)
DeleteFunctionWithContext(aws.Context, *lambda.DeleteFunctionInput, ...request.Option) (*lambda.DeleteFunctionOutput, error)
DeleteFunctionRequest(*lambda.DeleteFunctionInput) (*request.Request, *lambda.DeleteFunctionOutput)
GetAccountSettings(*lambda.GetAccountSettingsInput) (*lambda.GetAccountSettingsOutput, error)
GetAccountSettingsWithContext(aws.Context, *lambda.GetAccountSettingsInput, ...request.Option) (*lambda.GetAccountSettingsOutput, error)
GetAccountSettingsRequest(*lambda.GetAccountSettingsInput) (*request.Request, *lambda.GetAccountSettingsOutput)
GetAlias(*lambda.GetAliasInput) (*lambda.AliasConfiguration, error)
GetAliasWithContext(aws.Context, *lambda.GetAliasInput, ...request.Option) (*lambda.AliasConfiguration, error)
GetAliasRequest(*lambda.GetAliasInput) (*request.Request, *lambda.AliasConfiguration)
GetEventSourceMapping(*lambda.GetEventSourceMappingInput) (*lambda.EventSourceMappingConfiguration, error)
GetEventSourceMappingWithContext(aws.Context, *lambda.GetEventSourceMappingInput, ...request.Option) (*lambda.EventSourceMappingConfiguration, error)
GetEventSourceMappingRequest(*lambda.GetEventSourceMappingInput) (*request.Request, *lambda.EventSourceMappingConfiguration)
GetFunction(*lambda.GetFunctionInput) (*lambda.GetFunctionOutput, error)
GetFunctionWithContext(aws.Context, *lambda.GetFunctionInput, ...request.Option) (*lambda.GetFunctionOutput, error)
GetFunctionRequest(*lambda.GetFunctionInput) (*request.Request, *lambda.GetFunctionOutput)
GetFunctionConfiguration(*lambda.GetFunctionConfigurationInput) (*lambda.FunctionConfiguration, error)
GetFunctionConfigurationWithContext(aws.Context, *lambda.GetFunctionConfigurationInput, ...request.Option) (*lambda.FunctionConfiguration, error)
GetFunctionConfigurationRequest(*lambda.GetFunctionConfigurationInput) (*request.Request, *lambda.FunctionConfiguration)
GetPolicy(*lambda.GetPolicyInput) (*lambda.GetPolicyOutput, error)
GetPolicyWithContext(aws.Context, *lambda.GetPolicyInput, ...request.Option) (*lambda.GetPolicyOutput, error)
GetPolicyRequest(*lambda.GetPolicyInput) (*request.Request, *lambda.GetPolicyOutput)
Invoke(*lambda.InvokeInput) (*lambda.InvokeOutput, error)
InvokeWithContext(aws.Context, *lambda.InvokeInput, ...request.Option) (*lambda.InvokeOutput, error)
InvokeRequest(*lambda.InvokeInput) (*request.Request, *lambda.InvokeOutput)
InvokeAsync(*lambda.InvokeAsyncInput) (*lambda.InvokeAsyncOutput, error)
InvokeAsyncWithContext(aws.Context, *lambda.InvokeAsyncInput, ...request.Option) (*lambda.InvokeAsyncOutput, error)
InvokeAsyncRequest(*lambda.InvokeAsyncInput) (*request.Request, *lambda.InvokeAsyncOutput)
ListAliases(*lambda.ListAliasesInput) (*lambda.ListAliasesOutput, error)
ListAliasesWithContext(aws.Context, *lambda.ListAliasesInput, ...request.Option) (*lambda.ListAliasesOutput, error)
ListAliasesRequest(*lambda.ListAliasesInput) (*request.Request, *lambda.ListAliasesOutput)
ListEventSourceMappings(*lambda.ListEventSourceMappingsInput) (*lambda.ListEventSourceMappingsOutput, error)
ListEventSourceMappingsWithContext(aws.Context, *lambda.ListEventSourceMappingsInput, ...request.Option) (*lambda.ListEventSourceMappingsOutput, error)
ListEventSourceMappingsRequest(*lambda.ListEventSourceMappingsInput) (*request.Request, *lambda.ListEventSourceMappingsOutput)
ListEventSourceMappingsPages(*lambda.ListEventSourceMappingsInput, func(*lambda.ListEventSourceMappingsOutput, bool) bool) error
ListEventSourceMappingsPagesWithContext(aws.Context, *lambda.ListEventSourceMappingsInput, func(*lambda.ListEventSourceMappingsOutput, bool) bool, ...request.Option) error
ListFunctions(*lambda.ListFunctionsInput) (*lambda.ListFunctionsOutput, error)
ListFunctionsWithContext(aws.Context, *lambda.ListFunctionsInput, ...request.Option) (*lambda.ListFunctionsOutput, error)
ListFunctionsRequest(*lambda.ListFunctionsInput) (*request.Request, *lambda.ListFunctionsOutput)
ListFunctionsPages(*lambda.ListFunctionsInput, func(*lambda.ListFunctionsOutput, bool) bool) error
ListFunctionsPagesWithContext(aws.Context, *lambda.ListFunctionsInput, func(*lambda.ListFunctionsOutput, bool) bool, ...request.Option) error
ListTags(*lambda.ListTagsInput) (*lambda.ListTagsOutput, error)
ListTagsWithContext(aws.Context, *lambda.ListTagsInput, ...request.Option) (*lambda.ListTagsOutput, error)
ListTagsRequest(*lambda.ListTagsInput) (*request.Request, *lambda.ListTagsOutput)
ListVersionsByFunction(*lambda.ListVersionsByFunctionInput) (*lambda.ListVersionsByFunctionOutput, error)
ListVersionsByFunctionWithContext(aws.Context, *lambda.ListVersionsByFunctionInput, ...request.Option) (*lambda.ListVersionsByFunctionOutput, error)
ListVersionsByFunctionRequest(*lambda.ListVersionsByFunctionInput) (*request.Request, *lambda.ListVersionsByFunctionOutput)
PublishVersion(*lambda.PublishVersionInput) (*lambda.FunctionConfiguration, error)
PublishVersionWithContext(aws.Context, *lambda.PublishVersionInput, ...request.Option) (*lambda.FunctionConfiguration, error)
PublishVersionRequest(*lambda.PublishVersionInput) (*request.Request, *lambda.FunctionConfiguration)
RemovePermission(*lambda.RemovePermissionInput) (*lambda.RemovePermissionOutput, error)
RemovePermissionWithContext(aws.Context, *lambda.RemovePermissionInput, ...request.Option) (*lambda.RemovePermissionOutput, error)
RemovePermissionRequest(*lambda.RemovePermissionInput) (*request.Request, *lambda.RemovePermissionOutput)
TagResource(*lambda.TagResourceInput) (*lambda.TagResourceOutput, error)
TagResourceWithContext(aws.Context, *lambda.TagResourceInput, ...request.Option) (*lambda.TagResourceOutput, error)
TagResourceRequest(*lambda.TagResourceInput) (*request.Request, *lambda.TagResourceOutput)
UntagResource(*lambda.UntagResourceInput) (*lambda.UntagResourceOutput, error)
UntagResourceWithContext(aws.Context, *lambda.UntagResourceInput, ...request.Option) (*lambda.UntagResourceOutput, error)
UntagResourceRequest(*lambda.UntagResourceInput) (*request.Request, *lambda.UntagResourceOutput)
UpdateAlias(*lambda.UpdateAliasInput) (*lambda.AliasConfiguration, error)
UpdateAliasWithContext(aws.Context, *lambda.UpdateAliasInput, ...request.Option) (*lambda.AliasConfiguration, error)
UpdateAliasRequest(*lambda.UpdateAliasInput) (*request.Request, *lambda.AliasConfiguration)
UpdateEventSourceMapping(*lambda.UpdateEventSourceMappingInput) (*lambda.EventSourceMappingConfiguration, error)
UpdateEventSourceMappingWithContext(aws.Context, *lambda.UpdateEventSourceMappingInput, ...request.Option) (*lambda.EventSourceMappingConfiguration, error)
UpdateEventSourceMappingRequest(*lambda.UpdateEventSourceMappingInput) (*request.Request, *lambda.EventSourceMappingConfiguration)
UpdateFunctionCode(*lambda.UpdateFunctionCodeInput) (*lambda.FunctionConfiguration, error)
UpdateFunctionCodeWithContext(aws.Context, *lambda.UpdateFunctionCodeInput, ...request.Option) (*lambda.FunctionConfiguration, error)
UpdateFunctionCodeRequest(*lambda.UpdateFunctionCodeInput) (*request.Request, *lambda.FunctionConfiguration)
UpdateFunctionConfiguration(*lambda.UpdateFunctionConfigurationInput) (*lambda.FunctionConfiguration, error)
UpdateFunctionConfigurationWithContext(aws.Context, *lambda.UpdateFunctionConfigurationInput, ...request.Option) (*lambda.FunctionConfiguration, error)
UpdateFunctionConfigurationRequest(*lambda.UpdateFunctionConfigurationInput) (*request.Request, *lambda.FunctionConfiguration)
}
var _ LambdaAPI = (*lambda.Lambda)(nil)

View file

@ -0,0 +1,93 @@
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
package lambda
import (
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/client"
"github.com/aws/aws-sdk-go/aws/client/metadata"
"github.com/aws/aws-sdk-go/aws/request"
"github.com/aws/aws-sdk-go/aws/signer/v4"
"github.com/aws/aws-sdk-go/private/protocol/restjson"
)
// Lambda provides the API operation methods for making requests to
// AWS Lambda. See this package's package overview docs
// for details on the service.
//
// Lambda methods are safe to use concurrently. It is not safe to
// modify mutate any of the struct's properties though.
type Lambda struct {
*client.Client
}
// Used for custom client initialization logic
var initClient func(*client.Client)
// Used for custom request initialization logic
var initRequest func(*request.Request)
// Service information constants
const (
ServiceName = "lambda" // Service endpoint prefix API calls made to.
EndpointsID = ServiceName // Service ID for Regions and Endpoints metadata.
)
// New creates a new instance of the Lambda client with a session.
// If additional configuration is needed for the client instance use the optional
// aws.Config parameter to add your extra config.
//
// Example:
// // Create a Lambda client from just a session.
// svc := lambda.New(mySession)
//
// // Create a Lambda client with additional configuration
// svc := lambda.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
func New(p client.ConfigProvider, cfgs ...*aws.Config) *Lambda {
c := p.ClientConfig(EndpointsID, cfgs...)
return newClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName)
}
// newClient creates, initializes and returns a new service client instance.
func newClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *Lambda {
svc := &Lambda{
Client: client.New(
cfg,
metadata.ClientInfo{
ServiceName: ServiceName,
SigningName: signingName,
SigningRegion: signingRegion,
Endpoint: endpoint,
APIVersion: "2015-03-31",
},
handlers,
),
}
// Handlers
svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
svc.Handlers.Build.PushBackNamed(restjson.BuildHandler)
svc.Handlers.Unmarshal.PushBackNamed(restjson.UnmarshalHandler)
svc.Handlers.UnmarshalMeta.PushBackNamed(restjson.UnmarshalMetaHandler)
svc.Handlers.UnmarshalError.PushBackNamed(restjson.UnmarshalErrorHandler)
// Run custom client initialization if present
if initClient != nil {
initClient(svc.Client)
}
return svc
}
// newRequest creates a new request for a Lambda operation and runs any
// custom request initialization.
func (c *Lambda) newRequest(op *request.Operation, params, data interface{}) *request.Request {
req := c.NewRequest(op, params, data)
// Run custom request initialization if present
if initRequest != nil {
initRequest(req)
}
return req
}