Skip to content

Commit

Permalink
Switch to an EC2 API that doesn't return unknown enum values
Browse files Browse the repository at this point in the history
The EC2 spec in
https://github.com/disneystreaming/aws-sdk-smithy-specs/releases/tag/v2023.02.10
doesn't contain some enum values that were retured in the describe
instances response, and because at present smithy4s doesn't support open
enums, decoding was failing. In time it should support open enums, but
for now we can get a successful Sandbox run against the EC2 API by just
using an endpoint that doesn't (at present) return unknown enum values.
  • Loading branch information
dhpiggott committed Jul 31, 2023
1 parent 29f7d5b commit 9bab5c6
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions modules/sandbox/src/Sandbox.scala
Original file line number Diff line number Diff line change
Expand Up @@ -48,17 +48,17 @@ object Main extends IOApp.Simple {
// https://disneystreaming.github.io/smithy4s/docs/protocols/aws/aws/#ec2query,
// EC2 is the only service that use the ec2Query protocol.
AwsClient(EC2, awsEnvironment).use(ec2Client =>
listAll[DescribeInstancesResult, Reservation](
listAll[DescribeInstanceStatusResult, InstanceStatus](
listF = maybeNextToken =>
ec2Client.describeInstances(
ec2Client.describeInstanceStatus(
maxResults = 100,
nextToken = maybeNextToken
),
accessResults = _.reservations.toList.flatten,
accessResults = _.instanceStatuses.toList.flatten,
accessNextToken = _.nextToken
)
.map(_.size)
.flatMap(size => IO.println(s"Found $size instances"))
.flatMap(size => IO.println(s"Found $size instance statuses"))
)
}

Expand All @@ -68,7 +68,7 @@ object Main extends IOApp.Simple {
.default[IO]
.build
.map(
Logger(
RequestLogger.colored(
logHeaders = true,
logBody = true,
logAction = Some(IO.println _)
Expand Down

0 comments on commit 9bab5c6

Please sign in to comment.