Skip to content

Commit a7b9639

Browse files
committed
support IAM role / group / user / policy; handle wildcards in actions
1 parent b6d69ca commit a7b9639

14 files changed

Lines changed: 700 additions & 145 deletions

api/v1alpha1/awsvalidator_types.go

Lines changed: 54 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,10 @@ import (
2626
// AwsValidatorSpec defines the desired state of AwsValidator
2727
type AwsValidatorSpec struct {
2828
Auth AwsAuth `json:"auth"`
29-
IamRules []IamRule `json:"iamRules,omitempty"`
29+
IamRoleRules []IamRoleRule `json:"iamRoleRules,omitempty"`
30+
IamUserRules []IamUserRule `json:"iamUserRules,omitempty"`
31+
IamGroupRules []IamGroupRule `json:"iamGroupRules,omitempty"`
32+
IamPolicyRules []IamPolicyRule `json:"iamPolicyRules,omitempty"`
3033
ServiceQuotaRules []ServiceQuotaRule `json:"serviceQuotaRules,omitempty"`
3134
TagRules []TagRule `json:"tagRules,omitempty"`
3235
}
@@ -38,9 +41,56 @@ type AwsAuth struct {
3841
ServiceAccountName string `json:"serviceAccountName,omitempty"`
3942
}
4043

41-
type IamRule struct {
42-
IamRole string `json:"iamRole"`
43-
Policies []PolicyDocument `json:"iamPolicies"`
44+
type IamRoleRule struct {
45+
IamRoleName string `json:"iamRoleName"`
46+
Policies []PolicyDocument `json:"iamPolicies"`
47+
}
48+
49+
func (r IamRoleRule) Name() string {
50+
return r.IamRoleName
51+
}
52+
53+
func (r IamRoleRule) IAMPolicies() []PolicyDocument {
54+
return r.Policies
55+
}
56+
57+
type IamUserRule struct {
58+
IamUserName string `json:"iamUserName"`
59+
Policies []PolicyDocument `json:"iamPolicies"`
60+
}
61+
62+
func (r IamUserRule) Name() string {
63+
return r.IamUserName
64+
}
65+
66+
func (r IamUserRule) IAMPolicies() []PolicyDocument {
67+
return r.Policies
68+
}
69+
70+
type IamGroupRule struct {
71+
IamGroupName string `json:"iamGroupName"`
72+
Policies []PolicyDocument `json:"iamPolicies"`
73+
}
74+
75+
func (r IamGroupRule) Name() string {
76+
return r.IamGroupName
77+
}
78+
79+
func (r IamGroupRule) IAMPolicies() []PolicyDocument {
80+
return r.Policies
81+
}
82+
83+
type IamPolicyRule struct {
84+
IamPolicyARN string `json:"iamPolicyArn"`
85+
Policies []PolicyDocument `json:"iamPolicies"`
86+
}
87+
88+
func (r IamPolicyRule) Name() string {
89+
return r.IamPolicyARN
90+
}
91+
92+
func (r IamPolicyRule) IAMPolicies() []PolicyDocument {
93+
return r.Policies
4494
}
4595

4696
type PolicyDocument struct {

api/v1alpha1/zz_generated.deepcopy.go

Lines changed: 94 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)