-
-
Notifications
You must be signed in to change notification settings - Fork 1
Grant(or remove) permission to lambda function for invoke from CloudWatch Events #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
check lambda function permission
to grant permission to invoke lambda from cloudwatch events
structs.go
Outdated
AwsSourceArn string `json:"AWS:SourceArn"` | ||
} | ||
|
||
type PolicyPrincipal struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
exported type PolicyPrincipal should have comment or be unexported
structs.go
Outdated
ArnLike *PolicyArnLike `json:"ArnLike"` | ||
} | ||
|
||
type PolicyArnLike struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
exported type PolicyArnLike should have comment or be unexported
structs.go
Outdated
Action string `json:"Action"` | ||
} | ||
|
||
type PolicyCondition struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
exported type PolicyCondition should have comment or be unexported
structs.go
Outdated
type PolicyStatement struct { | ||
Resource string `json:"Resource"` | ||
Condition *PolicyCondition `json:"Condition"` | ||
StatementId string `json:"Sid"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
struct field StatementId should be StatementID
structs.go
Outdated
Statement *[]PolicyStatement `json:"Statement"` | ||
} | ||
|
||
type PolicyStatement struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
exported type PolicyStatement should have comment or be unexported
structs.go
Outdated
|
||
type LambdaPolicy struct { | ||
Version string `json:"Version"` | ||
Id string `json:"Id"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
struct field Id should be ID
structs.go
Outdated
@@ -30,3 +30,30 @@ type Target struct { | |||
NeedUpdate bool | |||
NeedDelete bool | |||
} | |||
|
|||
type LambdaPolicy struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
exported type LambdaPolicy should have comment or be unexported
return strings.HasPrefix(arn, "arn:aws:lambda") | ||
} | ||
|
||
func LambdaFunctionNameFromArn(arn string) string { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
exported function LambdaFunctionNameFromArn should have comment or be unexported
return false, nil | ||
} | ||
|
||
func IsLambdaFunction(arn string) bool { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
exported function IsLambdaFunction should have comment or be unexported
AwsSourceArn string `json:"AWS:SourceArn"` | ||
} | ||
|
||
// part of the LambdaPolicy |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comment on exported type PolicyPrincipal should be of the form "PolicyPrincipal ..." (with optional leading article)
ArnLike *PolicyArnLike `json:"ArnLike"` | ||
} | ||
|
||
// part of the LambdaPolicy |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comment on exported type PolicyArnLike should be of the form "PolicyArnLike ..." (with optional leading article)
Action string `json:"Action"` | ||
} | ||
|
||
// part of the LambdaPolicy |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comment on exported type PolicyCondition should be of the form "PolicyCondition ..." (with optional leading article)
type PolicyStatement struct { | ||
Resource string `json:"Resource"` | ||
Condition *PolicyCondition `json:"Condition"` | ||
StatementId string `json:"Sid"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
struct field StatementId should be StatementID
Statement *[]PolicyStatement `json:"Statement"` | ||
} | ||
|
||
// part of the LambdaPolicy |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comment on exported type PolicyStatement should be of the form "PolicyStatement ..." (with optional leading article)
// struct for JSON that return from Lambda.GetPolicy | ||
type LambdaPolicy struct { | ||
Version string `json:"Version"` | ||
Id string `json:"Id"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
struct field Id should be ID
@@ -30,3 +33,35 @@ type Target struct { | |||
NeedUpdate bool | |||
NeedDelete bool | |||
} | |||
|
|||
// struct for JSON that return from Lambda.GetPolicy |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comment on exported type LambdaPolicy should be of the form "LambdaPolicy ..." (with optional leading article)
@@ -21,6 +23,7 @@ type Rule struct { | |||
NeedDelete bool | |||
} | |||
|
|||
// struct for expression CloudWatch Events Target |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comment on exported type Target should be of the form "Target ..." (with optional leading article)
type Rules struct { | ||
Rules []Rule | ||
} | ||
|
||
// struct for expression CloudWatch Events Rule |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comment on exported type Rule should be of the form "Rule ..." (with optional leading article)
@@ -4,10 +4,12 @@ import ( | |||
cwe "github.com/aws/aws-sdk-go/service/cloudwatchevents" | |||
) | |||
|
|||
// struct for store unmarshalized configuration yaml |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comment on exported type Rules should be of the form "Rules ..." (with optional leading article)
AwsSourceArn string `json:"AWS:SourceArn"` | ||
} | ||
|
||
// part of the LambdaPolicy |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comment on exported type PolicyPrincipal should be of the form "PolicyPrincipal ..." (with optional leading article)
ArnLike *PolicyArnLike `json:"ArnLike"` | ||
} | ||
|
||
// part of the LambdaPolicy |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comment on exported type PolicyArnLike should be of the form "PolicyArnLike ..." (with optional leading article)
Action string `json:"Action"` | ||
} | ||
|
||
// part of the LambdaPolicy |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comment on exported type PolicyCondition should be of the form "PolicyCondition ..." (with optional leading article)
type PolicyStatement struct { | ||
Resource string `json:"Resource"` | ||
Condition *PolicyCondition `json:"Condition"` | ||
StatementId string `json:"Sid"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
struct field StatementId should be StatementID
Statement *[]PolicyStatement `json:"Statement"` | ||
} | ||
|
||
// part of the LambdaPolicy |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comment on exported type PolicyStatement should be of the form "PolicyStatement ..." (with optional leading article)
// struct for JSON that return from Lambda.GetPolicy | ||
type LambdaPolicy struct { | ||
Version string `json:"Version"` | ||
Id string `json:"Id"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
struct field Id should be ID
@@ -30,3 +33,35 @@ type Target struct { | |||
NeedUpdate bool | |||
NeedDelete bool | |||
} | |||
|
|||
// struct for JSON that return from Lambda.GetPolicy |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comment on exported type LambdaPolicy should be of the form "LambdaPolicy ..." (with optional leading article)
@@ -21,6 +23,7 @@ type Rule struct { | |||
NeedDelete bool | |||
} | |||
|
|||
// struct for expression CloudWatch Events Target |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comment on exported type Target should be of the form "Target ..." (with optional leading article)
type Rules struct { | ||
Rules []Rule | ||
} | ||
|
||
// struct for expression CloudWatch Events Rule |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comment on exported type Rule should be of the form "Rule ..." (with optional leading article)
@@ -4,10 +4,12 @@ import ( | |||
cwe "github.com/aws/aws-sdk-go/service/cloudwatchevents" | |||
) | |||
|
|||
// struct for store unmarshalized configuration yaml |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comment on exported type Rules should be of the form "Rules ..." (with optional leading article)
😨 |
Goal
Invoke lambda function from CloudWatch Events
What should I to reach the goal?