Skip to content

Commit 861a2bb

Browse files
authored
docs(iam): add return values of policy validation methods (#20350)
Because these just return a list of strings it may not be clear to a caller what the validation methods are actually returning. This `@returns` text is based on the documentation in core's Construct.validate documentation. ---- ### All Submissions: * [X] Have you followed the guidelines in our [Contributing guide?](https://github.com/aws/aws-cdk/blob/master/CONTRIBUTING.md) ### Adding new Unconventional Dependencies: * [ ] This PR adds new unconventional dependencies following the process described [here](https://github.com/aws/aws-cdk/blob/master/CONTRIBUTING.md/#adding-new-unconventional-dependencies) ### New Features * [ ] Have you added the new feature to an [integration test](https://github.com/aws/aws-cdk/blob/master/INTEGRATION_TESTS.md)? * [ ] Did you use `yarn integ` to deploy the infrastructure and generate the snapshot (i.e. `yarn integ` without `--dry-run`)? *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent 778feaf commit 861a2bb

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

packages/@aws-cdk/aws-iam/lib/policy-document.ts

+6
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,8 @@ export class PolicyDocument implements cdk.IResolvable {
128128
* requirements for any policy.
129129
*
130130
* @see https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#access_policies-json
131+
*
132+
* @returns An array of validation error messages, or an empty array if the document is valid.
131133
*/
132134
public validateForAnyPolicy(): string[] {
133135
const errors = new Array<string>();
@@ -142,6 +144,8 @@ export class PolicyDocument implements cdk.IResolvable {
142144
* requirements for a resource-based policy.
143145
*
144146
* @see https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#access_policies-json
147+
*
148+
* @returns An array of validation error messages, or an empty array if the document is valid.
145149
*/
146150
public validateForResourcePolicy(): string[] {
147151
const errors = new Array<string>();
@@ -156,6 +160,8 @@ export class PolicyDocument implements cdk.IResolvable {
156160
* requirements for an identity-based policy.
157161
*
158162
* @see https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#access_policies-json
163+
*
164+
* @returns An array of validation error messages, or an empty array if the document is valid.
159165
*/
160166
public validateForIdentityPolicy(): string[] {
161167
const errors = new Array<string>();

packages/@aws-cdk/aws-iam/lib/policy-statement.ts

+6
Original file line numberDiff line numberDiff line change
@@ -442,6 +442,8 @@ export class PolicyStatement {
442442

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

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

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

0 commit comments

Comments
 (0)