github.com/mweagle/Sparta@v1.15.0/aws/iam/iam.go (about) 1 package iam 2 3 import ( 4 gocf "github.com/mweagle/go-cloudformation" 5 ) 6 7 // PolicyStatement represents an entry in an IAM policy document 8 type PolicyStatement struct { 9 Effect string 10 Action []string 11 Resource *gocf.StringExpr `json:",omitempty"` 12 Principal *gocf.IAMPrincipal `json:",omitempty"` 13 Condition interface{} `json:",omitempty"` 14 } 15 16 // AssumeRolePolicyDocumentForServicePrincipal returns the document 17 // for the given service principal 18 func AssumeRolePolicyDocumentForServicePrincipal(principal string) interface{} { 19 return map[string]interface{}{ 20 "Version": "2012-10-17", 21 "Statement": []interface{}{ 22 map[string]interface{}{ 23 "Effect": "Allow", 24 "Action": "sts:AssumeRole", 25 "Principal": map[string]interface{}{ 26 "Service": principal, 27 }, 28 }, 29 }, 30 } 31 }