-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Also: 1. Fix bug with updating a function 2. Fix bug listing more than 10 functions 3. Add log support for functions 4. Proxy invoke function using service discovery hostname Resolves #1 Signed-off-by: Edward Wilde <[email protected]>
- Loading branch information
Showing
42 changed files
with
42,167 additions
and
244 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
.idea | ||
examples/hellogoworld2/ | ||
dist | ||
faas-fargate |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
package aws | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/aws/aws-sdk-go/aws/awserr" | ||
|
||
"github.com/aws/aws-sdk-go/aws" | ||
"github.com/aws/aws-sdk-go/service/cloudwatchlogs" | ||
) | ||
|
||
func buildLogPolicyStatement( | ||
builder *PolicyBuilder, | ||
name string) error { | ||
|
||
builder.AddStatement( | ||
[]string{ | ||
"logs:CreateLogStream", | ||
"logs:PutLogEvents", | ||
}, | ||
[]string{ | ||
fmt.Sprintf("arn:aws:logs:*:%s:*", name), | ||
}) | ||
|
||
return nil | ||
} | ||
|
||
func createLogGroup(functionName string) (string, error) { | ||
name := ServiceNameFromFunctionName(functionName) | ||
_, err := cloudwatchClient.CreateLogGroup(&cloudwatchlogs.CreateLogGroupInput{ | ||
LogGroupName: aws.String(name), | ||
}) | ||
|
||
if err != nil { | ||
if awsErr, ok := err.(awserr.Error); ok { | ||
if awsErr.Code() == cloudwatchlogs.ErrCodeResourceAlreadyExistsException { | ||
return name, nil | ||
} | ||
} | ||
|
||
return "", fmt.Errorf("error creating log group for %s. %v", functionName, err) | ||
} | ||
|
||
return name, nil | ||
} | ||
|
||
func deleteLogGroup(functionName string) error { | ||
name := ServiceNameFromFunctionName(functionName) | ||
_, err := cloudwatchClient.DeleteLogGroup(&cloudwatchlogs.DeleteLogGroupInput{ | ||
LogGroupName: aws.String(name), | ||
}) | ||
|
||
if err != nil { | ||
return fmt.Errorf("error deleting log group for %s. %v", functionName, err) | ||
} | ||
|
||
return nil | ||
} |
Oops, something went wrong.