Skip to content

Commit 4912c82

Browse files
committed
Add jsdocs to the construct
1 parent 50ebe0a commit 4912c82

1 file changed

Lines changed: 40 additions & 6 deletions

File tree

packages/cdkConstructs/src/constructs/SsmParametersConstruct.ts

Lines changed: 40 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,19 @@ import {Effect, ManagedPolicy, PolicyStatement} from "aws-cdk-lib/aws-iam"
33
import {StringParameter} from "aws-cdk-lib/aws-ssm"
44
import {Construct} from "constructs"
55

6+
/**
7+
* Definition for a single SSM String parameter and its output export metadata.
8+
*
9+
* @property id Unique identifier used for construct and output logical IDs.
10+
* @property nameSuffix Suffix appended to stackName to create the parameter name.
11+
* The final SSM parameter name is `${stackName}-${nameSuffix}`.
12+
* @property description Description stored with the SSM parameter.
13+
* @property value Value stored in the SSM parameter.
14+
* @property outputExportSuffix Optional export suffix for the output containing
15+
* the parameter name. Defaults to `nameSuffix`.
16+
* @property outputDescription Optional output description. Defaults to
17+
* `description`.
18+
*/
619
export interface SsmParameterDefinition {
720
/**
821
* Unique identifier used for construct and output logical IDs.
@@ -23,16 +36,29 @@ export interface SsmParameterDefinition {
2336
readonly value: string
2437
/**
2538
* Optional export suffix for the output containing the parameter name.
26-
* Defaults to `nameSuffix`.
39+
* @default nameSuffix value
2740
*/
2841
readonly outputExportSuffix?: string
2942
/**
3043
* Optional output description.
31-
* Defaults to `description`.
44+
* @default description value
3245
*/
3346
readonly outputDescription?: string
3447
}
3548

49+
/**
50+
* Properties used to configure {@link SsmParametersConstruct}.
51+
*
52+
* @property namePrefix Prefix used in SSM parameter names and CloudFormation
53+
* export names.
54+
* @property parameters List of SSM parameters to create.
55+
* @property readPolicyDescription Description for the managed policy that grants
56+
* read access. Defaults to "Allows reading SSM parameters".
57+
* @property readPolicyOutputDescription Description for the output exporting the
58+
* managed policy ARN. Defaults to "Access to the parameters used by the integration".
59+
* @property readPolicyExportSuffix Export suffix for the output exporting the
60+
* managed policy ARN.
61+
*/
3662
export interface SsmParametersConstructProps {
3763
/**
3864
* Prefix used in SSM parameter names and CloudFormation export names.
@@ -54,9 +80,8 @@ export interface SsmParametersConstructProps {
5480
readonly readPolicyOutputDescription?: string
5581
/**
5682
* Export suffix for the output exporting the managed policy ARN.
57-
* @default "GetParametersPolicy"
5883
*/
59-
readonly readPolicyExportSuffix?: string
84+
readonly readPolicyExportSuffix: string
6085
}
6186

6287
/**
@@ -67,15 +92,24 @@ export class SsmParametersConstruct extends Construct {
6792
public readonly parameters: Record<string, StringParameter>
6893
public readonly readParametersPolicy: ManagedPolicy
6994

95+
/**
96+
* Creates SSM String parameters, a managed read policy, and CloudFormation outputs.
97+
*
98+
* @param scope CDK construct scope.
99+
* @param id Unique construct identifier.
100+
* @param props Configuration for parameter names, values, and exported outputs.
101+
* @throws {Error} Throws when no parameter definitions are provided.
102+
* @throws {Error} Throws when duplicate parameter IDs or parameter names are detected.
103+
*/
70104
public constructor(scope: Construct, id: string, props: SsmParametersConstructProps) {
71105
super(scope, id)
72106

73107
const {
74108
namePrefix: stackName,
75109
parameters,
110+
readPolicyExportSuffix,
76111
readPolicyDescription = "Allows reading SSM parameters",
77-
readPolicyOutputDescription = "Access to the parameters used by the integration",
78-
readPolicyExportSuffix = "GetParametersPolicy"
112+
readPolicyOutputDescription = "Access to the parameters used by the integration"
79113
} = props
80114

81115
if (parameters.length === 0) {

0 commit comments

Comments
 (0)