Skip to content
This repository was archived by the owner on Sep 26, 2023. It is now read-only.

Commit e027880

Browse files
authored
v0.8.2.4
1 parent 4303652 commit e027880

File tree

23 files changed

+161
-49
lines changed

23 files changed

+161
-49
lines changed

Docs/articles/ReleaseNotes-Hicetas.md

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: Release notes for LambdaSharp "Hicetas" (v0.8)
44
keywords: release, notes, hicetas
55
---
66

7-
# LambdaSharp "Hicetas" Release (v0.8.2.3) - 2021-04-01
7+
# LambdaSharp "Hicetas" Release (v0.8.2.4) - 2021-04-30
88

99
> Hicetas was a Greek philosopher of the Pythagorean School. He was born in Syracuse. Like his fellow Pythagorean Ecphantus and the Academic Heraclides Ponticus, he believed that the daily movement of permanent stars was caused by the rotation of the Earth around its axis. When Copernicus referred to Nicetus Syracusanus (Nicetus of Syracuse) in _De revolutionibus orbium coelestium_ as having been cited by Cicero as an ancient who also argued that the Earth moved, it is believed that he was actually referring to Hicetas. [(Wikipedia)](https://en.wikipedia.org/wiki/Hicetas)
1010
@@ -141,6 +141,32 @@ Part of this release, _LambdaSharp.Core_ functions were ported to .NET Core 3.1
141141

142142
## Releases
143143

144+
### (v0.8.2.4) - 2021-04-30
145+
146+
### Features
147+
148+
* CLI
149+
* Added `DependsOn` property for `Function` declarations.
150+
151+
* Modules
152+
* _LambdaSharp.S3.Subscriber_
153+
* Added `ResourceHandlerRole` as export value from module to allow dependent stacks to import it and add policies to it when needed.
154+
155+
#### Fixes
156+
157+
* CLI
158+
* Fixed a regression that caused the _Beep_ sound not to be played anymore after a long operation.
159+
160+
* SDK
161+
* Fixed a possible `NullReferenceException` when module info is not set for a Lambda function.
162+
163+
* Modules
164+
* _LambdaSharp.S3.Subscriber_
165+
* Fixed an issue where buckets in another region or inaccessible would cause an _internal error_ rather than respond with an informative message.
166+
167+
* Samples
168+
* Enabled debug output for _Sample.Debug_ module.
169+
144170
### (v0.8.2.3) - 2021-04-01
145171

146172
#### Features

Docs/articles/VideoTutorials.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,9 @@ This presentation covers some of the serverless design patterns, such as CQRS (C
3737
This presentation dives into the details of how modules are published. It shows how artifacts from the build process are copied to the deployment bucket. As well as how to stage builds for validation, before publishing the approved artifacts. It is a deep-dive into one of the most critical features in LambdaSharp to ensure a safe development process for production environments. Code samples can be found at: https://github.com/LambdaSharp/ServerlessPatterns-PublishingAndSharing
3838

3939
<iframe width="560" height="315" src="https://www.youtube.com/embed/d7J0cyhCZUc" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
40+
41+
## Serverless .NET Patterns: Deployment Configuration
42+
43+
In this presentation, I cover configuration management for your serverless solutions. We dive into the various CloudFormation parameter types, as well as the parameter file format for LambdaSharp modules. We also explore--with code samples--how to read values from a JSON configuration file, the parameter store, and how to securely encode sensitive infrastructure information. Code samples can be found at: https://github.com/LambdaSharp/ServerlessPatterns-DeploymentConfiguration
44+
45+
<iframe width="560" height="315" src="https://www.youtube.com/embed/shVf1jjz83E" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>

Docs/articles/toc.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
- name: Releases
5858
items:
5959

60-
- name: Hicetas (v0.8.2.3)
60+
- name: Hicetas (v0.8.2.4)
6161
href: ReleaseNotes-Hicetas.md
6262

6363
- name: Geminus (v0.7.0.17)

Docs/modules/LambdaSharp-S3-Subscriber.md

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,39 @@ This module requires no parameters.
2020

2121
## Output Values
2222

23-
This module has no output values.
23+
<dl>
24+
25+
<dt><code>ResourceHandlerRole</code></dt>
26+
<dd>
27+
28+
The <code>ResourceHandlerRole</code> output contains the module IAM role ARN. This enables other modules to give additional permissions to the resource handler when required.
29+
30+
<i>Type:</i> AWS::IAM::Role
31+
32+
The following module sample shows how to import the `ResourceHandlerRole` output value and use it to attach additional permission to the S3 subscription handler.
33+
34+
```yaml
35+
- Import: SubscriberRole
36+
Module: LambdaSharp.S3.Subscriber::ResourceHandlerRole
37+
38+
- Resource: S3SubscriberAccess
39+
Type: AWS::IAM::Policy
40+
Properties:
41+
PolicyName: !Sub "${AWS::StackName}S3BucketPolicy"
42+
PolicyDocument:
43+
Version: 2012-10-17
44+
Statement:
45+
- Sid: S3BucketPermissions
46+
Effect: Allow
47+
Action:
48+
- s3:GetBucketNotification
49+
- s3:PutBucketNotification
50+
Resource: !Ref MyBucket
51+
Roles:
52+
- !Ref SubscriberRole
53+
```
54+
55+
</dd>
56+
57+
</dl>
58+

Docs/syntax/Module-Function.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,22 @@ Properties:
3030
ResourceProperties
3131
Sources:
3232
- SourceDefinition
33+
DependsOn:
34+
- String
3335
```
3436
3537
## Properties
3638
3739
<dl>
3840
41+
<dt><code>DependsOn</code></dt>
42+
<dd>
43+
44+
The <code>DependsOn</code> attribute identifies items that must be created prior. For additional information, see <a href="https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-dependson.html">CloudFormation DependsOn Attribute</a>.
45+
46+
<i>Type</i>: List of String
47+
</dd>
48+
3949
<dt><code>Description</code></dt>
4050
<dd>
4151

Docs/version.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.8.2.2
1+
0.8.2.4

Modules/LambdaSharp.S3.Subscriber/Module.yml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ Items:
2222
Description: Resource type for S3 bucket subscriptions
2323
Handler: CustomResourceTopic
2424
Properties:
25-
2625
- Name: Bucket
2726
Description: S3 bucket ARN/name to subscribe to
2827
Type: String
@@ -39,7 +38,6 @@ Items:
3938
Required: true
4039

4140
Attributes:
42-
4341
- Name: Result
4442
Description: S3 bucket URL
4543
Type: String
@@ -48,8 +46,8 @@ Items:
4846
Description: LambdaSharpS3Subscriber requires notification configuration access to all S3 buckets
4947
Type: AWS::S3::Bucket
5048
Allow:
51-
- "s3:GetBucketNotification"
52-
- "s3:PutBucketNotification"
49+
- s3:GetBucketNotification
50+
- s3:PutBucketNotification
5351
Value: !Sub "arn:aws:s3:::${Deployment::TierPrefixLowercase}*"
5452

5553
- Resource: CustomResourceTopic
@@ -59,9 +57,14 @@ Items:
5957

6058
- Function: ResourceHandler
6159
Description: LambdaSharp S3 Subscription handler
62-
Memory: 256
60+
Memory: 512
6361
Timeout: 30
6462
Properties:
6563
ReservedConcurrentExecutions: 1
6664
Sources:
6765
- Topic: CustomResourceTopic
66+
67+
- Variable: ResourceHandlerRole
68+
Description: Custom resource IAM role name used to update notifications on S3 buckets
69+
Scope: public
70+
Value: !Ref Module::Role

Modules/LambdaSharp.S3.Subscriber/ResourceHandler/Function.cs

Lines changed: 28 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,15 @@ public override async Task<Response<S3SubscriptionAttributes>> ProcessCreateReso
7575

7676
// extract bucket name from arn (arn:aws:s3:::bucket_name)
7777
var bucketName = properties.BucketName;
78-
var config = await _s3Client.GetBucketNotificationAsync(new GetBucketNotificationRequest {
79-
BucketName = bucketName
80-
});
81-
Add(config.LambdaFunctionConfigurations, properties);
78+
GetBucketNotificationResponse config;
79+
try {
80+
config = await _s3Client.GetBucketNotificationAsync(new GetBucketNotificationRequest {
81+
BucketName = bucketName
82+
});
83+
Add(config.LambdaFunctionConfigurations, properties);
84+
} catch(AmazonS3Exception e) {
85+
throw Abort(e.Message);
86+
}
8287

8388
// attempt to update bucket notification configuration
8489
var attempts = 0;
@@ -113,20 +118,26 @@ await _s3Client.PutBucketNotificationAsync(new PutBucketNotificationRequest {
113118
}
114119

115120
public override async Task<Response<S3SubscriptionAttributes>> ProcessDeleteResourceAsync(Request<S3SubscriptionProperties> request, CancellationToken cancellationToken) {
116-
var properties = request.ResourceProperties;
117121

118-
// extract bucket name from arn (arn:aws:s3:::bucket_name)
119-
var bucketName = properties.BucketName;
120-
var config = await _s3Client.GetBucketNotificationAsync(new GetBucketNotificationRequest {
121-
BucketName = bucketName
122-
});
123-
Remove(config.LambdaFunctionConfigurations, properties);
124-
await _s3Client.PutBucketNotificationAsync(new PutBucketNotificationRequest {
125-
BucketName = bucketName,
126-
LambdaFunctionConfigurations = config.LambdaFunctionConfigurations,
127-
QueueConfigurations = config.QueueConfigurations,
128-
TopicConfigurations = config.TopicConfigurations
129-
});
122+
// only attempt delete operation if a physical resource ID is present
123+
if(request.HasPhysicalResourceId()) {
124+
var properties = request.ResourceProperties;
125+
126+
// extract bucket name from arn (arn:aws:s3:::bucket_name)
127+
var bucketName = properties.BucketName;
128+
var config = await _s3Client.GetBucketNotificationAsync(new GetBucketNotificationRequest {
129+
BucketName = bucketName
130+
});
131+
Remove(config.LambdaFunctionConfigurations, properties);
132+
await _s3Client.PutBucketNotificationAsync(new PutBucketNotificationRequest {
133+
BucketName = bucketName,
134+
LambdaFunctionConfigurations = config.LambdaFunctionConfigurations,
135+
QueueConfigurations = config.QueueConfigurations,
136+
TopicConfigurations = config.TopicConfigurations
137+
});
138+
} else {
139+
LogInfo("no physical ID provided; ignoring DELETE operation");
140+
}
130141
return new Response<S3SubscriptionAttributes>();
131142
}
132143

Samples/DebugSample/Module.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,7 @@ Items:
2121
- Function: MyFunction
2222
Memory: 256
2323
Timeout: 30
24+
Properties:
25+
Environment:
26+
Variables:
27+
DEBUG_LOGGING_ENABLED: "true"

Scripts/Set-Lash-Version.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
$Env:LAMBDASHARP_VERSION_PREFIX="0.8.2.3"
1+
$Env:LAMBDASHARP_VERSION_PREFIX="0.8.2.4"
22
$Env:LAMBDASHARP_VERSION_SUFFIX=""
33

44
# create full version text

0 commit comments

Comments
 (0)