Skip to content

Commit

Permalink
Update aws-s3-folder example
Browse files Browse the repository at this point in the history
  • Loading branch information
pawelprazak committed Sep 28, 2023
1 parent ae42ad3 commit caa64aa
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 34 deletions.
28 changes: 15 additions & 13 deletions examples/aws-s3-folder/Main.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import besom.*
import besom.api.aws.*
import besom.api.aws.s3.BucketObject
import besom.api.aws.s3
import besom.api.aws.s3.inputs.BucketWebsiteArgs
import besom.types.Asset.FileAsset
import besom.types.Output
Expand Down Expand Up @@ -62,18 +61,21 @@ val siteDir = "www"
)

// For each file in the directory, create an S3 object stored in `siteBucket`
val uploads: Array[Output[BucketObject]] = File(siteDir).listFiles().map { file =>
s3.BucketObject(
NonEmptyString(file.getName).get, // FIXME: https://github.com/VirtusLab/besom/issues/138
s3.BucketObjectArgs(
bucket = siteBucket.id, // reference the s3.Bucket object
source = FileAsset(file.getAbsolutePath), // use FileAsset to point to a file
contentType = Files.probeContentType(file.toPath) // set the MIME type of the file
),
CustomResourceOptions(
dependsOn = siteBucket.map(List(_))
val uploads: Array[Output[s3.BucketObject]] = File(siteDir).listFiles().map {
case file if file.getName.nonEmpty =>
s3.BucketObject(
NonEmptyString(file.getName).get,
s3.BucketObjectArgs(
bucket = siteBucket.id, // reference the s3.Bucket object
source = FileAsset(file.getAbsolutePath), // use FileAsset to point to a file
contentType = Files.probeContentType(file.toPath) // set the MIME type of the file
),
CustomResourceOptions(
dependsOn = siteBucket.map(List(_))
)
)
)
case _ =>
throw new RuntimeException("Unexpected empty file name")
}

for
Expand Down
9 changes: 0 additions & 9 deletions integration-tests/src/test/resources/logger-test/Pulumi.yaml

This file was deleted.

12 changes: 0 additions & 12 deletions integration-tests/src/test/resources/logger-test/run.scala

This file was deleted.

0 comments on commit caa64aa

Please sign in to comment.