in magenta-lib/src/main/scala/magenta/deployment_type/FastlyCompute.scala [33:82]
def withSsm[T](
keyRing: KeyRing,
region: Region,
resources: DeploymentResources
): (SsmClient => T) => T = SSM.withSsmClient[T](keyRing, region, resources)
val uploadArtifacts: Action = Action(
"uploadArtifacts",
"""
|Uploads the Compute@Edge package in the deployment's directory to the specified bucket.
""".stripMargin
) { (pkg, resources, target) =>
implicit val keyRing: KeyRing = resources.assembleKeyring(target, pkg)
implicit val artifactClient: S3Client = resources.artifactClient
val reporter = resources.reporter
val maybePackageOrAppName: Option[String] = (
prefixPackage(pkg, target, reporter),
prefixApp(pkg, target, reporter)
) match {
case (_, true) => Some(pkg.app.name)
case (true, false) => Some(pkg.name)
case (false, false) => None
}
val prefix = S3Upload.prefixGenerator(
stack =
if (prefixStack(pkg, target, reporter)) Some(target.stack) else None,
stage =
if (prefixStage(pkg, target, reporter)) Some(target.parameters.stage)
else None,
packageOrAppName = maybePackageOrAppName
)
val bucket = getTargetBucketFromConfig(pkg, target, reporter)
val s3Bucket = S3Tasks.getBucketName(
bucket,
withSsm(keyRing, target.region, resources),
resources.reporter
)
List(
S3Upload(
target.region,
s3Bucket,
Seq(pkg.s3Package -> prefix)
)
)
}