go fmt on aws path role files
This commit is contained in:
parent
3ce3e40db7
commit
9b878b0717
|
@ -266,7 +266,6 @@ func (b *backend) pathRolesWrite(ctx context.Context, req *logical.Request, d *f
|
|||
roleEntry.UserPath = userPathRaw.(string)
|
||||
}
|
||||
|
||||
|
||||
if legacyRole != "" {
|
||||
roleEntry = upgradeLegacyPolicyEntry(legacyRole)
|
||||
if roleEntry.InvalidData != "" {
|
||||
|
@ -485,8 +484,8 @@ func (r *awsRoleEntry) validate() error {
|
|||
}
|
||||
|
||||
if r.MaxSTSTTL > 0 &&
|
||||
r.DefaultSTSTTL > 0 &&
|
||||
r.DefaultSTSTTL > r.MaxSTSTTL {
|
||||
r.DefaultSTSTTL > 0 &&
|
||||
r.DefaultSTSTTL > r.MaxSTSTTL {
|
||||
errors = multierror.Append(errors, fmt.Errorf(`"default_sts_ttl" value must be less than or equal to "max_sts_ttl" value`))
|
||||
}
|
||||
|
||||
|
|
|
@ -217,7 +217,7 @@ func TestUserPathValidity(t *testing.T) {
|
|||
func TestRoleEntryValidationCredTypes(t *testing.T) {
|
||||
roleEntry := awsRoleEntry{
|
||||
CredentialTypes: []string{},
|
||||
PolicyArns: []string{"arn:aws:iam::aws:policy/AdministratorAccess"},
|
||||
PolicyArns: []string{"arn:aws:iam::aws:policy/AdministratorAccess"},
|
||||
}
|
||||
if roleEntry.validate() == nil {
|
||||
t.Errorf("bad: invalid roleEntry with no CredentialTypes %#v passed validation", roleEntry)
|
||||
|
@ -237,7 +237,7 @@ func TestRoleEntryValidationIamUserCred(t *testing.T) {
|
|||
|
||||
roleEntry := awsRoleEntry{
|
||||
CredentialTypes: []string{iamUserCred},
|
||||
PolicyArns: []string{"arn:aws:iam::aws:policy/AdministratorAccess"},
|
||||
PolicyArns: []string{"arn:aws:iam::aws:policy/AdministratorAccess"},
|
||||
}
|
||||
err := roleEntry.validate()
|
||||
if err != nil {
|
||||
|
@ -256,7 +256,7 @@ func TestRoleEntryValidationIamUserCred(t *testing.T) {
|
|||
|
||||
roleEntry = awsRoleEntry{
|
||||
CredentialTypes: []string{iamUserCred},
|
||||
RoleArns: []string{"arn:aws:iam::123456789012:role/SomeRole"},
|
||||
RoleArns: []string{"arn:aws:iam::123456789012:role/SomeRole"},
|
||||
}
|
||||
if roleEntry.validate() == nil {
|
||||
t.Errorf("bad: invalid roleEntry with invalid RoleArns parameter %#v passed validation", roleEntry)
|
||||
|
@ -264,8 +264,8 @@ func TestRoleEntryValidationIamUserCred(t *testing.T) {
|
|||
|
||||
roleEntry = awsRoleEntry{
|
||||
CredentialTypes: []string{iamUserCred},
|
||||
PolicyArns: []string{"arn:aws:iam::aws:policy/AdministratorAccess"},
|
||||
DefaultSTSTTL: 1,
|
||||
PolicyArns: []string{"arn:aws:iam::aws:policy/AdministratorAccess"},
|
||||
DefaultSTSTTL: 1,
|
||||
}
|
||||
if roleEntry.validate() == nil {
|
||||
t.Errorf("bad: invalid roleEntry with unrecognized DefaultSTSTTL %#v passed validation", roleEntry)
|
||||
|
@ -281,10 +281,10 @@ func TestRoleEntryValidationAssumedRoleCred(t *testing.T) {
|
|||
var allowAllPolicyDocument = `{"Version": "2012-10-17", "Statement": [{"Sid": "AllowAll", "Effect": "Allow", "Action": "*", "Resource": "*"}]}`
|
||||
roleEntry := awsRoleEntry{
|
||||
CredentialTypes: []string{assumedRoleCred},
|
||||
RoleArns: []string{"arn:aws:iam::123456789012:role/SomeRole"},
|
||||
PolicyDocument: allowAllPolicyDocument,
|
||||
DefaultSTSTTL: 2,
|
||||
MaxSTSTTL: 3,
|
||||
RoleArns: []string{"arn:aws:iam::123456789012:role/SomeRole"},
|
||||
PolicyDocument: allowAllPolicyDocument,
|
||||
DefaultSTSTTL: 2,
|
||||
MaxSTSTTL: 3,
|
||||
}
|
||||
if err := roleEntry.validate(); err != nil {
|
||||
t.Errorf("bad: valid roleEntry %#v failed validation: %v", roleEntry, err)
|
||||
|
@ -310,9 +310,9 @@ func TestRoleEntryValidationFederationTokenCred(t *testing.T) {
|
|||
var allowAllPolicyDocument = `{"Version": "2012-10-17", "Statement": [{"Sid": "AllowAll", "Effect": "Allow", "Action": "*", "Resource": "*"}]}`
|
||||
roleEntry := awsRoleEntry{
|
||||
CredentialTypes: []string{federationTokenCred},
|
||||
PolicyDocument: allowAllPolicyDocument,
|
||||
DefaultSTSTTL: 2,
|
||||
MaxSTSTTL: 3,
|
||||
PolicyDocument: allowAllPolicyDocument,
|
||||
DefaultSTSTTL: 2,
|
||||
MaxSTSTTL: 3,
|
||||
}
|
||||
if err := roleEntry.validate(); err != nil {
|
||||
t.Errorf("bad: valid roleEntry %#v failed validation: %v", roleEntry, err)
|
||||
|
|
Loading…
Reference in New Issue