Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(iam): add return values of policy validation methods #20350

Merged
merged 2 commits into from
May 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions packages/@aws-cdk/aws-iam/lib/policy-document.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,8 @@ export class PolicyDocument implements cdk.IResolvable {
* requirements for any policy.
*
* @see https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#access_policies-json
*
* @returns An array of validation error messages, or an empty array if the document is valid.
*/
public validateForAnyPolicy(): string[] {
const errors = new Array<string>();
Expand All @@ -142,6 +144,8 @@ export class PolicyDocument implements cdk.IResolvable {
* requirements for a resource-based policy.
*
* @see https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#access_policies-json
*
* @returns An array of validation error messages, or an empty array if the document is valid.
*/
public validateForResourcePolicy(): string[] {
const errors = new Array<string>();
Expand All @@ -156,6 +160,8 @@ export class PolicyDocument implements cdk.IResolvable {
* requirements for an identity-based policy.
*
* @see https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#access_policies-json
*
* @returns An array of validation error messages, or an empty array if the document is valid.
*/
public validateForIdentityPolicy(): string[] {
const errors = new Array<string>();
Expand Down
6 changes: 6 additions & 0 deletions packages/@aws-cdk/aws-iam/lib/policy-statement.ts
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,8 @@ export class PolicyStatement {

/**
* Validate that the policy statement satisfies base requirements for a policy.
*
* @returns An array of validation error messages, or an empty array if the statement is valid.
*/
public validateForAnyPolicy(): string[] {
const errors = new Array<string>();
Expand All @@ -453,6 +455,8 @@ export class PolicyStatement {

/**
* Validate that the policy statement satisfies all requirements for a resource-based policy.
*
* @returns An array of validation error messages, or an empty array if the statement is valid.
*/
public validateForResourcePolicy(): string[] {
const errors = this.validateForAnyPolicy();
Expand All @@ -464,6 +468,8 @@ export class PolicyStatement {

/**
* Validate that the policy statement satisfies all requirements for an identity-based policy.
*
* @returns An array of validation error messages, or an empty array if the statement is valid.
*/
public validateForIdentityPolicy(): string[] {
const errors = this.validateForAnyPolicy();
Expand Down