mirror of
				https://github.com/SourceFellows/gobuch.git
				synced 2025-11-04 15:46:17 +01:00 
			
		
		
		
	initial import
This commit is contained in:
		
							
								
								
									
										10
									
								
								cloud-provider/aws-lambda-go/README.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								cloud-provider/aws-lambda-go/README.txt
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,10 @@
 | 
			
		||||
```
 | 
			
		||||
GOOS=linux go build main.go
 | 
			
		||||
zip function.zip main
 | 
			
		||||
aws lambda create-function \
 | 
			
		||||
    --function-name aws-lambda-sample \
 | 
			
		||||
    --runtime go1.x \
 | 
			
		||||
    --zip-file fileb://function.zip
 | 
			
		||||
    --handler main
 | 
			
		||||
    --role arn:aws:iam::<xx>:role/<xx>
 | 
			
		||||
```
 | 
			
		||||
							
								
								
									
										
											BIN
										
									
								
								cloud-provider/aws-lambda-go/function.zip
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								cloud-provider/aws-lambda-go/function.zip
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										24
									
								
								cloud-provider/aws-lambda-go/main.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										24
									
								
								cloud-provider/aws-lambda-go/main.go
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,24 @@
 | 
			
		||||
package main
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"context"
 | 
			
		||||
	"fmt"
 | 
			
		||||
 | 
			
		||||
	"github.com/aws/aws-lambda-go/lambda"
 | 
			
		||||
	"github.com/aws/aws-lambda-go/lambdacontext"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
type MyEvent struct {
 | 
			
		||||
	Name string `json:"name"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func HandleRequest(ctx context.Context, name MyEvent) (string, error) {
 | 
			
		||||
 | 
			
		||||
	lc, _ := lambdacontext.FromContext(ctx)
 | 
			
		||||
 | 
			
		||||
	return fmt.Sprintf("Hello %s! %s", name.Name, lc.AwsRequestID), nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func main() {
 | 
			
		||||
	lambda.Start(HandleRequest)
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user