mirror of https://github.com/kubernetes/kops.git
Update IAM Policy Principal.Service to stringorset
This commit is contained in:
parent
8f71e68d68
commit
3f74f21b7e
|
@ -279,11 +279,11 @@ func (s *Statement) MarshalJSON() ([]byte, error) {
|
||||||
|
|
||||||
type Principal struct {
|
type Principal struct {
|
||||||
Federated string `json:",omitempty"`
|
Federated string `json:",omitempty"`
|
||||||
Service string `json:",omitempty"`
|
Service *stringorset.StringOrSet `json:",omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *Principal) IsEmpty() bool {
|
func (p *Principal) IsEmpty() bool {
|
||||||
return *p == Principal{}
|
return p.Federated == "" && (p.Service == nil || p.Service.IsEmpty())
|
||||||
}
|
}
|
||||||
|
|
||||||
// Equal compares two IAM Statements and returns a bool
|
// Equal compares two IAM Statements and returns a bool
|
||||||
|
|
|
@ -64,7 +64,7 @@ func TestRoundTrip(t *testing.T) {
|
||||||
{
|
{
|
||||||
IAM: &Statement{
|
IAM: &Statement{
|
||||||
Effect: StatementEffectDeny,
|
Effect: StatementEffectDeny,
|
||||||
Principal: Principal{Service: "service"},
|
Principal: Principal{Service: fi.PtrTo(stringorset.Of("service"))},
|
||||||
Condition: map[string]interface{}{
|
Condition: map[string]interface{}{
|
||||||
"bar": "baz",
|
"bar": "baz",
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue