mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-05-06 22:18:28 +00:00
Update Go AWS SDK to the latest version
This commit is contained in:
committed by
Andrey Smirnov
parent
d08be990ef
commit
94a72b23ff
+3096
-979
File diff suppressed because it is too large
Load Diff
+2
-2
@@ -7,8 +7,8 @@
|
||||
//
|
||||
// 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)
|
||||
// (https://docs.aws.amazon.com/lambda/latest/dg/welcome.html), and for information
|
||||
// about how the service works, see AWS Lambda: How it Works (https://docs.aws.amazon.com/lambda/latest/dg/lambda-introduction.html)
|
||||
// in the AWS Lambda Developer Guide.
|
||||
//
|
||||
// See https://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31 for more information on this service.
|
||||
|
||||
+16
-4
@@ -7,11 +7,13 @@ 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)
|
||||
// You have exceeded your maximum total code size per account. Learn more (https://docs.aws.amazon.com/lambda/latest/dg/limits.html)
|
||||
ErrCodeCodeStorageExceededException = "CodeStorageExceededException"
|
||||
|
||||
// ErrCodeEC2AccessDeniedException for service response error code
|
||||
// "EC2AccessDeniedException".
|
||||
//
|
||||
// Need additional permissions to configure VPC settings.
|
||||
ErrCodeEC2AccessDeniedException = "EC2AccessDeniedException"
|
||||
|
||||
// ErrCodeEC2ThrottledException for service response error code
|
||||
@@ -72,7 +74,7 @@ const (
|
||||
// ErrCodeInvalidZipFileException for service response error code
|
||||
// "InvalidZipFileException".
|
||||
//
|
||||
// AWS Lambda could not unzip the function zip file.
|
||||
// AWS Lambda could not unzip the deployment package.
|
||||
ErrCodeInvalidZipFileException = "InvalidZipFileException"
|
||||
|
||||
// ErrCodeKMSAccessDeniedException for service response error code
|
||||
@@ -106,7 +108,7 @@ const (
|
||||
// ErrCodePolicyLengthExceededException for service response error code
|
||||
// "PolicyLengthExceededException".
|
||||
//
|
||||
// Lambda function access policy is limited to 20 KB.
|
||||
// The permissions policy for the resource is too large. Learn more (https://docs.aws.amazon.com/lambda/latest/dg/limits.html)
|
||||
ErrCodePolicyLengthExceededException = "PolicyLengthExceededException"
|
||||
|
||||
// ErrCodePreconditionFailedException for service response error code
|
||||
@@ -121,7 +123,7 @@ const (
|
||||
// "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).
|
||||
// more information, see Limits (https://docs.aws.amazon.com/lambda/latest/dg/limits.html).
|
||||
ErrCodeRequestTooLargeException = "RequestTooLargeException"
|
||||
|
||||
// ErrCodeResourceConflictException for service response error code
|
||||
@@ -130,6 +132,14 @@ const (
|
||||
// The resource already exists.
|
||||
ErrCodeResourceConflictException = "ResourceConflictException"
|
||||
|
||||
// ErrCodeResourceInUseException for service response error code
|
||||
// "ResourceInUseException".
|
||||
//
|
||||
// The operation conflicts with the resource's availability. For example, you
|
||||
// attempted to update an EventSource Mapping in CREATING, or tried to delete
|
||||
// a EventSource mapping currently in the UPDATING state.
|
||||
ErrCodeResourceInUseException = "ResourceInUseException"
|
||||
|
||||
// ErrCodeResourceNotFoundException for service response error code
|
||||
// "ResourceNotFoundException".
|
||||
//
|
||||
@@ -152,6 +162,8 @@ const (
|
||||
|
||||
// ErrCodeTooManyRequestsException for service response error code
|
||||
// "TooManyRequestsException".
|
||||
//
|
||||
// Request throughput limit exceeded.
|
||||
ErrCodeTooManyRequestsException = "TooManyRequestsException"
|
||||
|
||||
// ErrCodeUnsupportedMediaTypeException for service response error code
|
||||
|
||||
+5
-1
@@ -84,7 +84,7 @@ func ExampleLambda_CreateFunction_shared00() {
|
||||
MemorySize: aws.Int64(128),
|
||||
Publish: aws.Bool(true),
|
||||
Role: aws.String("arn:aws:iam::123456789012:role/service-role/role-name"),
|
||||
Runtime: aws.String("nodejs4.3"),
|
||||
Runtime: aws.String("nodejs8.10"),
|
||||
Timeout: aws.Int64(15),
|
||||
VpcConfig: &lambda.VpcConfig{},
|
||||
}
|
||||
@@ -174,6 +174,8 @@ func ExampleLambda_DeleteEventSourceMapping_shared00() {
|
||||
fmt.Println(lambda.ErrCodeInvalidParameterValueException, aerr.Error())
|
||||
case lambda.ErrCodeTooManyRequestsException:
|
||||
fmt.Println(lambda.ErrCodeTooManyRequestsException, aerr.Error())
|
||||
case lambda.ErrCodeResourceInUseException:
|
||||
fmt.Println(lambda.ErrCodeResourceInUseException, aerr.Error())
|
||||
default:
|
||||
fmt.Println(aerr.Error())
|
||||
}
|
||||
@@ -797,6 +799,8 @@ func ExampleLambda_UpdateEventSourceMapping_shared00() {
|
||||
fmt.Println(lambda.ErrCodeTooManyRequestsException, aerr.Error())
|
||||
case lambda.ErrCodeResourceConflictException:
|
||||
fmt.Println(lambda.ErrCodeResourceConflictException, aerr.Error())
|
||||
case lambda.ErrCodeResourceInUseException:
|
||||
fmt.Println(lambda.ErrCodeResourceInUseException, aerr.Error())
|
||||
default:
|
||||
fmt.Println(aerr.Error())
|
||||
}
|
||||
|
||||
+58
@@ -0,0 +1,58 @@
|
||||
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
|
||||
|
||||
// +build go1.10,integration
|
||||
|
||||
package lambda_test
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/aws/aws-sdk-go/aws"
|
||||
"github.com/aws/aws-sdk-go/aws/awserr"
|
||||
"github.com/aws/aws-sdk-go/aws/request"
|
||||
"github.com/aws/aws-sdk-go/awstesting/integration"
|
||||
"github.com/aws/aws-sdk-go/service/lambda"
|
||||
)
|
||||
|
||||
var _ aws.Config
|
||||
var _ awserr.Error
|
||||
var _ request.Request
|
||||
|
||||
func TestInteg_00_ListFunctions(t *testing.T) {
|
||||
ctx, cancelFn := context.WithTimeout(context.Background(), 5*time.Second)
|
||||
defer cancelFn()
|
||||
|
||||
sess := integration.SessionWithDefaultRegion("us-west-2")
|
||||
svc := lambda.New(sess)
|
||||
params := &lambda.ListFunctionsInput{}
|
||||
_, err := svc.ListFunctionsWithContext(ctx, params)
|
||||
if err != nil {
|
||||
t.Errorf("expect no error, got %v", err)
|
||||
}
|
||||
}
|
||||
func TestInteg_01_Invoke(t *testing.T) {
|
||||
ctx, cancelFn := context.WithTimeout(context.Background(), 5*time.Second)
|
||||
defer cancelFn()
|
||||
|
||||
sess := integration.SessionWithDefaultRegion("us-west-2")
|
||||
svc := lambda.New(sess)
|
||||
params := &lambda.InvokeInput{
|
||||
FunctionName: aws.String("bogus-function"),
|
||||
}
|
||||
_, err := svc.InvokeWithContext(ctx, params)
|
||||
if err == nil {
|
||||
t.Fatalf("expect request to fail")
|
||||
}
|
||||
aerr, ok := err.(awserr.RequestFailure)
|
||||
if !ok {
|
||||
t.Fatalf("expect awserr, was %T", err)
|
||||
}
|
||||
if len(aerr.Code()) == 0 {
|
||||
t.Errorf("expect non-empty error code")
|
||||
}
|
||||
if v := aerr.Code(); v == request.ErrCodeSerialization {
|
||||
t.Errorf("expect API error code got serialization failure")
|
||||
}
|
||||
}
|
||||
+41
-2
@@ -26,7 +26,7 @@ import (
|
||||
// // myFunc uses an SDK service client to make a request to
|
||||
// // AWS Lambda.
|
||||
// func myFunc(svc lambdaiface.LambdaAPI) bool {
|
||||
// // Make svc.AddPermission request
|
||||
// // Make svc.AddLayerVersionPermission request
|
||||
// }
|
||||
//
|
||||
// func main() {
|
||||
@@ -42,7 +42,7 @@ import (
|
||||
// type mockLambdaClient struct {
|
||||
// lambdaiface.LambdaAPI
|
||||
// }
|
||||
// func (m *mockLambdaClient) AddPermission(input *lambda.AddPermissionInput) (*lambda.AddPermissionOutput, error) {
|
||||
// func (m *mockLambdaClient) AddLayerVersionPermission(input *lambda.AddLayerVersionPermissionInput) (*lambda.AddLayerVersionPermissionOutput, error) {
|
||||
// // mock response/functionality
|
||||
// }
|
||||
//
|
||||
@@ -60,6 +60,10 @@ import (
|
||||
// and waiters. Its suggested to use the pattern above for testing, or using
|
||||
// tooling to generate mocks to satisfy the interfaces.
|
||||
type LambdaAPI interface {
|
||||
AddLayerVersionPermission(*lambda.AddLayerVersionPermissionInput) (*lambda.AddLayerVersionPermissionOutput, error)
|
||||
AddLayerVersionPermissionWithContext(aws.Context, *lambda.AddLayerVersionPermissionInput, ...request.Option) (*lambda.AddLayerVersionPermissionOutput, error)
|
||||
AddLayerVersionPermissionRequest(*lambda.AddLayerVersionPermissionInput) (*request.Request, *lambda.AddLayerVersionPermissionOutput)
|
||||
|
||||
AddPermission(*lambda.AddPermissionInput) (*lambda.AddPermissionOutput, error)
|
||||
AddPermissionWithContext(aws.Context, *lambda.AddPermissionInput, ...request.Option) (*lambda.AddPermissionOutput, error)
|
||||
AddPermissionRequest(*lambda.AddPermissionInput) (*request.Request, *lambda.AddPermissionOutput)
|
||||
@@ -92,6 +96,10 @@ type LambdaAPI interface {
|
||||
DeleteFunctionConcurrencyWithContext(aws.Context, *lambda.DeleteFunctionConcurrencyInput, ...request.Option) (*lambda.DeleteFunctionConcurrencyOutput, error)
|
||||
DeleteFunctionConcurrencyRequest(*lambda.DeleteFunctionConcurrencyInput) (*request.Request, *lambda.DeleteFunctionConcurrencyOutput)
|
||||
|
||||
DeleteLayerVersion(*lambda.DeleteLayerVersionInput) (*lambda.DeleteLayerVersionOutput, error)
|
||||
DeleteLayerVersionWithContext(aws.Context, *lambda.DeleteLayerVersionInput, ...request.Option) (*lambda.DeleteLayerVersionOutput, error)
|
||||
DeleteLayerVersionRequest(*lambda.DeleteLayerVersionInput) (*request.Request, *lambda.DeleteLayerVersionOutput)
|
||||
|
||||
GetAccountSettings(*lambda.GetAccountSettingsInput) (*lambda.GetAccountSettingsOutput, error)
|
||||
GetAccountSettingsWithContext(aws.Context, *lambda.GetAccountSettingsInput, ...request.Option) (*lambda.GetAccountSettingsOutput, error)
|
||||
GetAccountSettingsRequest(*lambda.GetAccountSettingsInput) (*request.Request, *lambda.GetAccountSettingsOutput)
|
||||
@@ -112,6 +120,18 @@ type LambdaAPI interface {
|
||||
GetFunctionConfigurationWithContext(aws.Context, *lambda.GetFunctionConfigurationInput, ...request.Option) (*lambda.FunctionConfiguration, error)
|
||||
GetFunctionConfigurationRequest(*lambda.GetFunctionConfigurationInput) (*request.Request, *lambda.FunctionConfiguration)
|
||||
|
||||
GetLayerVersion(*lambda.GetLayerVersionInput) (*lambda.GetLayerVersionOutput, error)
|
||||
GetLayerVersionWithContext(aws.Context, *lambda.GetLayerVersionInput, ...request.Option) (*lambda.GetLayerVersionOutput, error)
|
||||
GetLayerVersionRequest(*lambda.GetLayerVersionInput) (*request.Request, *lambda.GetLayerVersionOutput)
|
||||
|
||||
GetLayerVersionByArn(*lambda.GetLayerVersionByArnInput) (*lambda.GetLayerVersionByArnOutput, error)
|
||||
GetLayerVersionByArnWithContext(aws.Context, *lambda.GetLayerVersionByArnInput, ...request.Option) (*lambda.GetLayerVersionByArnOutput, error)
|
||||
GetLayerVersionByArnRequest(*lambda.GetLayerVersionByArnInput) (*request.Request, *lambda.GetLayerVersionByArnOutput)
|
||||
|
||||
GetLayerVersionPolicy(*lambda.GetLayerVersionPolicyInput) (*lambda.GetLayerVersionPolicyOutput, error)
|
||||
GetLayerVersionPolicyWithContext(aws.Context, *lambda.GetLayerVersionPolicyInput, ...request.Option) (*lambda.GetLayerVersionPolicyOutput, error)
|
||||
GetLayerVersionPolicyRequest(*lambda.GetLayerVersionPolicyInput) (*request.Request, *lambda.GetLayerVersionPolicyOutput)
|
||||
|
||||
GetPolicy(*lambda.GetPolicyInput) (*lambda.GetPolicyOutput, error)
|
||||
GetPolicyWithContext(aws.Context, *lambda.GetPolicyInput, ...request.Option) (*lambda.GetPolicyOutput, error)
|
||||
GetPolicyRequest(*lambda.GetPolicyInput) (*request.Request, *lambda.GetPolicyOutput)
|
||||
@@ -142,6 +162,14 @@ type LambdaAPI interface {
|
||||
ListFunctionsPages(*lambda.ListFunctionsInput, func(*lambda.ListFunctionsOutput, bool) bool) error
|
||||
ListFunctionsPagesWithContext(aws.Context, *lambda.ListFunctionsInput, func(*lambda.ListFunctionsOutput, bool) bool, ...request.Option) error
|
||||
|
||||
ListLayerVersions(*lambda.ListLayerVersionsInput) (*lambda.ListLayerVersionsOutput, error)
|
||||
ListLayerVersionsWithContext(aws.Context, *lambda.ListLayerVersionsInput, ...request.Option) (*lambda.ListLayerVersionsOutput, error)
|
||||
ListLayerVersionsRequest(*lambda.ListLayerVersionsInput) (*request.Request, *lambda.ListLayerVersionsOutput)
|
||||
|
||||
ListLayers(*lambda.ListLayersInput) (*lambda.ListLayersOutput, error)
|
||||
ListLayersWithContext(aws.Context, *lambda.ListLayersInput, ...request.Option) (*lambda.ListLayersOutput, error)
|
||||
ListLayersRequest(*lambda.ListLayersInput) (*request.Request, *lambda.ListLayersOutput)
|
||||
|
||||
ListTags(*lambda.ListTagsInput) (*lambda.ListTagsOutput, error)
|
||||
ListTagsWithContext(aws.Context, *lambda.ListTagsInput, ...request.Option) (*lambda.ListTagsOutput, error)
|
||||
ListTagsRequest(*lambda.ListTagsInput) (*request.Request, *lambda.ListTagsOutput)
|
||||
@@ -150,6 +178,10 @@ type LambdaAPI interface {
|
||||
ListVersionsByFunctionWithContext(aws.Context, *lambda.ListVersionsByFunctionInput, ...request.Option) (*lambda.ListVersionsByFunctionOutput, error)
|
||||
ListVersionsByFunctionRequest(*lambda.ListVersionsByFunctionInput) (*request.Request, *lambda.ListVersionsByFunctionOutput)
|
||||
|
||||
PublishLayerVersion(*lambda.PublishLayerVersionInput) (*lambda.PublishLayerVersionOutput, error)
|
||||
PublishLayerVersionWithContext(aws.Context, *lambda.PublishLayerVersionInput, ...request.Option) (*lambda.PublishLayerVersionOutput, error)
|
||||
PublishLayerVersionRequest(*lambda.PublishLayerVersionInput) (*request.Request, *lambda.PublishLayerVersionOutput)
|
||||
|
||||
PublishVersion(*lambda.PublishVersionInput) (*lambda.FunctionConfiguration, error)
|
||||
PublishVersionWithContext(aws.Context, *lambda.PublishVersionInput, ...request.Option) (*lambda.FunctionConfiguration, error)
|
||||
PublishVersionRequest(*lambda.PublishVersionInput) (*request.Request, *lambda.FunctionConfiguration)
|
||||
@@ -158,6 +190,10 @@ type LambdaAPI interface {
|
||||
PutFunctionConcurrencyWithContext(aws.Context, *lambda.PutFunctionConcurrencyInput, ...request.Option) (*lambda.PutFunctionConcurrencyOutput, error)
|
||||
PutFunctionConcurrencyRequest(*lambda.PutFunctionConcurrencyInput) (*request.Request, *lambda.PutFunctionConcurrencyOutput)
|
||||
|
||||
RemoveLayerVersionPermission(*lambda.RemoveLayerVersionPermissionInput) (*lambda.RemoveLayerVersionPermissionOutput, error)
|
||||
RemoveLayerVersionPermissionWithContext(aws.Context, *lambda.RemoveLayerVersionPermissionInput, ...request.Option) (*lambda.RemoveLayerVersionPermissionOutput, error)
|
||||
RemoveLayerVersionPermissionRequest(*lambda.RemoveLayerVersionPermissionInput) (*request.Request, *lambda.RemoveLayerVersionPermissionOutput)
|
||||
|
||||
RemovePermission(*lambda.RemovePermissionInput) (*lambda.RemovePermissionOutput, error)
|
||||
RemovePermissionWithContext(aws.Context, *lambda.RemovePermissionInput, ...request.Option) (*lambda.RemovePermissionOutput, error)
|
||||
RemovePermissionRequest(*lambda.RemovePermissionInput) (*request.Request, *lambda.RemovePermissionOutput)
|
||||
@@ -185,6 +221,9 @@ type LambdaAPI interface {
|
||||
UpdateFunctionConfiguration(*lambda.UpdateFunctionConfigurationInput) (*lambda.FunctionConfiguration, error)
|
||||
UpdateFunctionConfigurationWithContext(aws.Context, *lambda.UpdateFunctionConfigurationInput, ...request.Option) (*lambda.FunctionConfiguration, error)
|
||||
UpdateFunctionConfigurationRequest(*lambda.UpdateFunctionConfigurationInput) (*request.Request, *lambda.FunctionConfiguration)
|
||||
|
||||
WaitUntilFunctionExists(*lambda.GetFunctionInput) error
|
||||
WaitUntilFunctionExistsWithContext(aws.Context, *lambda.GetFunctionInput, ...request.WaiterOption) error
|
||||
}
|
||||
|
||||
var _ LambdaAPI = (*lambda.Lambda)(nil)
|
||||
|
||||
+4
-2
@@ -29,8 +29,9 @@ 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.
|
||||
ServiceName = "lambda" // Name of service.
|
||||
EndpointsID = ServiceName // ID to lookup a service endpoint with.
|
||||
ServiceID = "Lambda" // ServiceID is a unique identifer of a specific service.
|
||||
)
|
||||
|
||||
// New creates a new instance of the Lambda client with a session.
|
||||
@@ -55,6 +56,7 @@ func newClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegio
|
||||
cfg,
|
||||
metadata.ClientInfo{
|
||||
ServiceName: ServiceName,
|
||||
ServiceID: ServiceID,
|
||||
SigningName: signingName,
|
||||
SigningRegion: signingRegion,
|
||||
Endpoint: endpoint,
|
||||
|
||||
+61
@@ -0,0 +1,61 @@
|
||||
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
|
||||
|
||||
package lambda
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/aws/aws-sdk-go/aws"
|
||||
"github.com/aws/aws-sdk-go/aws/request"
|
||||
)
|
||||
|
||||
// WaitUntilFunctionExists uses the AWS Lambda API operation
|
||||
// GetFunction to wait for a condition to be met before returning.
|
||||
// If the condition is not met within the max attempt window, an error will
|
||||
// be returned.
|
||||
func (c *Lambda) WaitUntilFunctionExists(input *GetFunctionInput) error {
|
||||
return c.WaitUntilFunctionExistsWithContext(aws.BackgroundContext(), input)
|
||||
}
|
||||
|
||||
// WaitUntilFunctionExistsWithContext is an extended version of WaitUntilFunctionExists.
|
||||
// With the support for passing in a context and options to configure the
|
||||
// Waiter and the underlying request options.
|
||||
//
|
||||
// The context must be non-nil and will be used for request cancellation. If
|
||||
// the context is nil a panic will occur. In the future the SDK may create
|
||||
// sub-contexts for http.Requests. See https://golang.org/pkg/context/
|
||||
// for more information on using Contexts.
|
||||
func (c *Lambda) WaitUntilFunctionExistsWithContext(ctx aws.Context, input *GetFunctionInput, opts ...request.WaiterOption) error {
|
||||
w := request.Waiter{
|
||||
Name: "WaitUntilFunctionExists",
|
||||
MaxAttempts: 20,
|
||||
Delay: request.ConstantWaiterDelay(1 * time.Second),
|
||||
Acceptors: []request.WaiterAcceptor{
|
||||
{
|
||||
State: request.SuccessWaiterState,
|
||||
Matcher: request.StatusWaiterMatch,
|
||||
Expected: 200,
|
||||
},
|
||||
{
|
||||
State: request.RetryWaiterState,
|
||||
Matcher: request.ErrorWaiterMatch,
|
||||
Expected: "ResourceNotFoundException",
|
||||
},
|
||||
},
|
||||
Logger: c.Config.Logger,
|
||||
NewRequest: func(opts []request.Option) (*request.Request, error) {
|
||||
var inCpy *GetFunctionInput
|
||||
if input != nil {
|
||||
tmp := *input
|
||||
inCpy = &tmp
|
||||
}
|
||||
req, _ := c.GetFunctionRequest(inCpy)
|
||||
req.SetContext(ctx)
|
||||
req.ApplyOptions(opts...)
|
||||
return req, nil
|
||||
},
|
||||
}
|
||||
w.ApplyOptions(opts...)
|
||||
|
||||
return w.WaitWithContext(ctx)
|
||||
}
|
||||
Reference in New Issue
Block a user