Skip to content

Commit 7d020f1

Browse files
mikhailshilkovElad Ben-Israel
authored andcommitted
fix(core): fix build errors in fsharp init-template (#3229)
1 parent d6f5207 commit 7d020f1

File tree

3 files changed

+11
-13
lines changed

3 files changed

+11
-13
lines changed

packages/aws-cdk/lib/init-templates/app/fsharp/src/HelloCdk/HelloCdk.template.fsproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
<PackageReference Include="Amazon.CDK" Version="%cdk-version%-devpreview" />
1616
<PackageReference Include="Amazon.CDK.AWS.IAM" Version="%cdk-version%-devpreview" />
1717
<PackageReference Include="Amazon.CDK.AWS.SNS" Version="%cdk-version%-devpreview" />
18+
<PackageReference Include="Amazon.CDK.AWS.SNS.Subscriptions" Version="%cdk-version%-devpreview" />
1819
<PackageReference Include="Amazon.CDK.AWS.SQS" Version="%cdk-version%-devpreview" />
1920
</ItemGroup>
2021

packages/aws-cdk/lib/init-templates/app/fsharp/src/HelloCdk/HelloConstruct.fs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,10 @@ type HelloConstructProps = { BucketCount : int }
88
type HelloConstruct(parent, id, props) as this =
99
inherit Construct(parent, id)
1010

11-
let mutable buckets = List.empty
12-
13-
do
14-
buckets <- List.init props.BucketCount
11+
let buckets =
12+
List.init props.BucketCount
1513
(fun i -> Bucket(this, "Bucket" + i.ToString(), BucketProps()))
16-
()
1714

1815
member public __.GrantRead(principal) =
19-
List.iter
20-
(fun (bucket : Bucket) -> bucket.GrantRead(principal, "*")) buckets
16+
buckets
17+
|> List.iter (fun bucket -> bucket.GrantRead(principal, "*") |> ignore)

packages/aws-cdk/lib/init-templates/app/fsharp/src/HelloCdk/HelloStack.fs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,20 @@ namespace HelloCdk
22

33
open HelloCdk
44

5-
open System
65
open Amazon.CDK
76
open Amazon.CDK.AWS.IAM
87
open Amazon.CDK.AWS.SNS
8+
open Amazon.CDK.AWS.SNS.Subscriptions
99
open Amazon.CDK.AWS.SQS
1010

1111
type MyStack(scope, id, props) as this =
1212
inherit Stack(scope, id, props)
1313

14-
let queue = Queue(this, "MyFirstQueue", QueueProps(VisibilityTimeout = Duration.Seconds(300)))
14+
let queue = Queue(this, "MyFirstQueue", QueueProps(VisibilityTimeout = Duration.Seconds(300.)))
15+
1516
let topic = Topic(this, "MyFirstTopic", TopicProps(DisplayName = "My First Topic Yeah"))
17+
do topic.AddSubscription(SqsSubscription(queue, null))
18+
1619
let hello = HelloConstruct(this, "Buckets", { BucketCount = 5 })
1720
let user = User(this, "MyUser", UserProps())
18-
19-
do
20-
topic.SubscribeQueue(queue, Nullable false) |> ignore
21-
hello.GrantRead(user)
21+
do hello.GrantRead(user)

0 commit comments

Comments
 (0)