public class DeployKt
| Modifier and Type | Method and Description |
|---|---|
static java.lang.String |
bucketName(java.lang.String appName,
java.lang.String envName,
java.lang.String suffix,
java.lang.String accountId)
Returns the name of a bucket for the environment and API with the specified suffix.
|
static java.lang.String |
codeBucketName(java.lang.String appName,
java.lang.String envName,
java.lang.String accountId)
Returns the default name of the S3 bucket from which code is deployed.
|
static java.lang.String |
createBucket(AwsProfile profile,
java.lang.String bucketName)
Creates an S3 bucket.
|
static java.util.List<java.lang.String> |
deployStages(AwsProfile profile,
java.lang.String apiId,
java.lang.String apiName,
java.util.List<ws.osiris.aws.Stage> stages,
boolean stackCreated)
Deploys the API to the stages and returns the names of the stages that were updated.
|
static java.lang.String |
staticFilesBucketName(java.lang.String appName,
java.lang.String envName,
java.lang.String accountId)
Returns the name of the static files bucket for the API.
|
static java.lang.String |
uploadFile(AwsProfile profile,
java.nio.file.Path file,
java.lang.String bucketName,
java.lang.String key)
Uploads a file to an S3 bucket and returns the URL of the file in S3.
|
static java.lang.String |
uploadFile(AwsProfile profile,
java.nio.file.Path file,
java.lang.String bucketName,
java.nio.file.Path baseDir,
java.lang.String key,
java.lang.String bucketDir)
Uploads a file to an S3 bucket and returns the URL of the file in S3.
|
@NotNull
public static java.util.List<java.lang.String> deployStages(@NotNull
AwsProfile profile,
@NotNull
java.lang.String apiId,
@NotNull
java.lang.String apiName,
@NotNull
java.util.List<ws.osiris.aws.Stage> stages,
boolean stackCreated)
Deploys the API to the stages and returns the names of the stages that were updated.
If the API is being deployed for the first time then all stages are deployed. If the API
was updated then only stages where deployOnUpdate is true are deployed.
@NotNull
public static java.lang.String createBucket(@NotNull
AwsProfile profile,
@NotNull
java.lang.String bucketName)
Creates an S3 bucket.
If the bucket already exists the function does nothing.
@NotNull
public static java.lang.String uploadFile(@NotNull
AwsProfile profile,
@NotNull
java.nio.file.Path file,
@NotNull
java.lang.String bucketName,
@Nullable
java.lang.String key)
Uploads a file to an S3 bucket and returns the URL of the file in S3.
@NotNull
public static java.lang.String uploadFile(@NotNull
AwsProfile profile,
@NotNull
java.nio.file.Path file,
@NotNull
java.lang.String bucketName,
@NotNull
java.nio.file.Path baseDir,
@Nullable
java.lang.String key,
@Nullable
java.lang.String bucketDir)
Uploads a file to an S3 bucket and returns the URL of the file in S3.
The file should be under baseDir on the filesystem. The S3 key for the file will be the relative path
from the base directory to the file.
For example, if baseDir is /foo/bar and the file is /foo/bar/baz/qux.txt then the file will be
uploaded to S3 with the key `baz/qux.txt
The key can be specified by the caller in which case it is used instead of automatically generating a key.
@NotNull
public static java.lang.String bucketName(@NotNull
java.lang.String appName,
@Nullable
java.lang.String envName,
@NotNull
java.lang.String suffix,
@NotNull
java.lang.String accountId)
Returns the name of a bucket for the environment and API with the specified suffix.
The bucket name is ${appName}-${envName}-${suffix}-${accountId}, converted to lower case.
accountId is used to ensure bucket names don't clash, given that there is a single global
namespace for S3 buckets. If a clash does occur it's very hard to diagnose as there's no easy
way to find out which account owns a bucket.
If the envName is null then the corresponding dashes aren't included.
If the resulting bucket name is invalid an IllegalArgumentException is thrown.
accountId,
envName,
IllegalArgumentException@NotNull
public static java.lang.String codeBucketName(@NotNull
java.lang.String appName,
@Nullable
java.lang.String envName,
@NotNull
java.lang.String accountId)
Returns the default name of the S3 bucket from which code is deployed.
The bucket name is ${appName}-${envName}-code-${accountId}, converted to lower case.
accountId is used to ensure bucket names don't clash, given that there is a single global
namespace for S3 buckets. If a clash does occur it's very hard to diagnose as there's no easy
way to find out which account owns a bucket.
If the envName is null then the corresponding dashes aren't included.
If the resulting bucket name is invalid an IllegalArgumentException is thrown.
accountId,
envName,
IllegalArgumentException@NotNull
public static java.lang.String staticFilesBucketName(@NotNull
java.lang.String appName,
@Nullable
java.lang.String envName,
@NotNull
java.lang.String accountId)
Returns the name of the static files bucket for the API.
The bucket name is ${appName}-${envName}-staticfiles-${accountId}, converted to lower case.
accountId is used to ensure bucket names don't clash, given that there is a single global
namespace for S3 buckets. If a clash does occur it's very hard to diagnose as there's no easy
way to find out which account owns a bucket.
If the envName is null then the corresponding dashes aren't included.
If the resulting bucket name is invalid an IllegalArgumentException is thrown.
accountId,
envName,
IllegalArgumentException