8000 Grant(or remove) permission to lambda function for invoke from CloudWatch Events by unasuke · Pull Request #4 · unasuke/maekawa · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

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

Merged
merged 14 commits into from
Mar 9, 2017

Conversation

unasuke
Copy link
Owner
@unasuke unasuke commented Mar 9, 2017

Goal

Invoke lambda function from CloudWatch Events

What should I to reach the goal?

structs.go Outdated
AwsSourceArn string `json:"AWS:SourceArn"`
}

type PolicyPrincipal struct {

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 {

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 {

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"`

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 {

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"`

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 {

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 {

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 {

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

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

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

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"`

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

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"`

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

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

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

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

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

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

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

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"`

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

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"`

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

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

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

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

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)

@unasuke
Copy link
Owner Author
unasuke commented Mar 9, 2017

😨

@unasuke unasuke merged commit 5c89471 into master Mar 9, 2017
@unasuke unasuke deleted the lambda_permission branch March 9, 2017 12:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0