Skip to content

Commit

Permalink
Update documentation with policy validation (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
tdpauw committed Aug 25, 2024
1 parent ef00e04 commit 1001b77
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,3 +149,39 @@ Supports different principals.
// "Principal" : "*"
const wildcardPrincipal = new WildcardPrincipal();
```
Validate a policy document.
```typescript
// validate any policy
// when valid returns an empty list
// when invalid returns a list of errors
const errors = policy.validate();
if (errors) {
throw errors;
}

// validate an IAM policy document
const errors = policy.validate(PolicyType.IAM);
if (errors) {
throw errors;
}

//validate a KMS key policy document.
const errors = policy.validate(PolicyType.KMS);
if (errors) {
throw errors;
}

//validate an S3 bucket policy document.
const errors = policy.validate(PolicyType.S3);
if (errors) {
throw errors;
}

//validate a SecretsManager secret policy document.
const errors = policy.validate(PolicyType.SecretsManager);
if (errors) {
throw errors;
}
```

0 comments on commit 1001b77

Please sign in to comment.