File tree Expand file tree Collapse file tree 2 files changed +18
-2
lines changed
packages/@aws-cdk/aws-lambda Expand file tree Collapse file tree 2 files changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -182,6 +182,20 @@ correct log retention period (never expire, by default).
182182* Further note* that, if the log group already exists and the ` logRetention ` is not set, the custom resource will reset
183183the log retention to never expire even if it was configured with a different value.
184184
185+ ### Singleton Function
186+
187+ The ` SingletonFunction ` construct is a way to guarantee that a lambda function will be guaranteed to be part of the stack,
188+ once and only once, irrespective of how many times the construct is declared to be part of the stack. This is guaranteed
189+ as long as the ` uuid ` property and the optional ` lambdaPurpose ` property stay the same whenever they're declared into the
190+ stack.
191+
192+ A typical use case of this function is when a higher level construct needs to declare a Lambda function as part of it but
193+ needs to guarantee that the function is declared once. However, a user of this higher level construct can declare it any
194+ number of times and with different properties. Using ` SingletonFunction ` here with a fixed ` uuid ` will guarantee this.
195+
196+ For example, the ` LogRetention ` construct requires only one single lambda function for all different log groups whose
197+ retention it seeks to manage.
198+
185199### Language-specific APIs
186200Language-specific higher level constructs are provided in separate modules:
187201
Original file line number Diff line number Diff line change @@ -31,8 +31,10 @@ export interface SingletonFunctionProps extends FunctionProps {
3131/**
3232 * A Lambda that will only ever be added to a stack once.
3333 *
34- * The lambda is identified using the value of 'uuid'. Run 'uuidgen'
35- * for every SingletonLambda you create.
34+ * This construct is a way to guarantee that the lambda function will be guaranteed to be part of the stack,
35+ * once and only once, irrespective of how many times the construct is declared to be part of the stack.
36+ * This is guaranteed as long as the `uuid` property and the optional `lambdaPurpose` property stay the same
37+ * whenever they're declared into the stack.
3638 *
3739 * @resource AWS::Lambda::Function
3840 */
You can’t perform that action at this time.
0 commit comments