Documentation ¶
Overview ¶
Package iam contains helpers to interact with IAM objects.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Policy ¶
type Policy struct { Version string `json:"Version"` Id string `json:"Id,omitempty"` Statement []PolicyStatement `json:"Statement,omitempty"` }
Policy mirrors the structure of an IAM Policy for easy marshaling and unmarshaling to/from JSON. See https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#access_policies-json
func NewPolicy ¶
func NewPolicy(stmts ...PolicyStatement) Policy
NewPolicy returns a new Policy with the given Statements applied to it.
type PolicyStatement ¶
type PolicyStatement struct { Sid string `json:"Sid,omitempty"` Effect PolicyStatementEffect `json:"Effect"` Principal PolicyStatementPrincipal `json:"Principal,omitempty"` Action []string `json:"Action"` Resource []string `json:"Resource"` Condition PolicyStatementCondition `json:"Condition,omitempty"` }
PolicyStatement is a Statement element in a Policy.
func NewPolicyStatement ¶
func NewPolicyStatement(effect PolicyStatementEffect, opts ...PolicyStatementOpt) PolicyStatement
NewPolicyStatement returns a new PolicyStatement with the given options applied to it.
type PolicyStatementCondition ¶
type PolicyStatementCondition struct { ArnEquals map[string]string `json:"ArnEquals,omitempty"` StringEquals map[string]string `json:"StringEquals,omitempty"` }
PolicyStatementCondition is the Condition element of a Statement. See https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_condition_operators.html
type PolicyStatementEffect ¶
type PolicyStatementEffect string
PolicyStatementEffect represents the Effect element of a Statement.
const (
EffectAllow PolicyStatementEffect = "Allow"
)
type PolicyStatementOpt ¶
type PolicyStatementOpt func(*PolicyStatement)
PolicyStatementOpt is a functional option for a PolicyStatement.
func ConditionArnEquals ¶
func ConditionArnEquals(key, val string) PolicyStatementOpt
ConditionArnEquals sets a Condition of type "ArnEquals".
func ConditionStringEquals ¶
func ConditionStringEquals(key, val string) PolicyStatementOpt
ConditionStringEquals sets a Condition of type "StringEquals".
func PrincipalService ¶
func PrincipalService(service string) PolicyStatementOpt
PrincipalService adds a "Service" to the Principal.
type PolicyStatementPrincipal ¶
type PolicyStatementPrincipal struct {
Service []string `json:"Service"`
}
PolicyStatementPrincipal is the Principal element of a Statement. https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_principal.html