docs: s3 lib: deprecated #Put in favor #Object
Signed-off-by: Sam Alba <sam.alba@gmail.com>
This commit is contained in:
parent
5eb40b3176
commit
0d5f41ee31
@ -6,32 +6,11 @@ sidebar_label: s3
|
||||
|
||||
AWS Simple Storage Service
|
||||
|
||||
## #Put
|
||||
## #Object
|
||||
|
||||
S3 Bucket upload (file or directory)
|
||||
S3 Bucket object(s) sync
|
||||
|
||||
### #Put Inputs
|
||||
|
||||
| Name | Type | Description |
|
||||
| ------------- |:-------------: |:-------------: |
|
||||
|*config.region* | `string` |AWS region |
|
||||
|*config.accessKey* | `dagger.#Secret` |AWS access key |
|
||||
|*config.secretKey* | `dagger.#Secret` |AWS secret key |
|
||||
|*target* | `string` |Target S3 URL (eg. s3://\<bucket-name\>/\<path\>/\<sub-path\>) |
|
||||
|*contentType* | `*"" \| string` |Object content type |
|
||||
|*always* | `*true \| bool` |Always write the object to S3 |
|
||||
|
||||
### #Put Outputs
|
||||
|
||||
| Name | Type | Description |
|
||||
| ------------- |:-------------: |:-------------: |
|
||||
|*url* | `string` |URL of the uploaded S3 object |
|
||||
|
||||
## #Sync
|
||||
|
||||
S3 Bucket sync
|
||||
|
||||
### #Sync Inputs
|
||||
### #Object Inputs
|
||||
|
||||
| Name | Type | Description |
|
||||
| ------------- |:-------------: |:-------------: |
|
||||
@ -40,11 +19,11 @@ S3 Bucket sync
|
||||
|*config.secretKey* | `dagger.#Secret` |AWS secret key |
|
||||
|*source* | `dagger.#Artifact` |Source Artifact to upload to S3 |
|
||||
|*target* | `string` |Target S3 URL (eg. s3://\<bucket-name\>/\<path\>/\<sub-path\>) |
|
||||
|*delete* | `*false \| bool` |Delete files that already exist on remote destination |
|
||||
|*delete* | `false` |Delete files that already exist on remote destination |
|
||||
|*contentType* | `*"" \| string` |Object content type |
|
||||
|*always* | `*true \| bool` |Always write the object to S3 |
|
||||
|*always* | `*true \| false` |Always write the object to S3 |
|
||||
|
||||
### #Sync Outputs
|
||||
### #Object Outputs
|
||||
|
||||
| Name | Type | Description |
|
||||
| ------------- |:-------------: |:-------------: |
|
||||
|
@ -20,7 +20,7 @@ source: dagger.#Artifact @dagger(input)
|
||||
// Deployed URL
|
||||
url: "\(deploy.url)index.html" @dagger(output)
|
||||
|
||||
deploy: s3.#Put & {
|
||||
deploy: s3.#Object & {
|
||||
always: true
|
||||
config: awsConfig
|
||||
"source": source
|
||||
|
38
stdlib/.dagger/env/aws-s3/plan/s3.cue
vendored
38
stdlib/.dagger/env/aws-s3/plan/s3.cue
vendored
@ -14,44 +14,10 @@ bucket: "dagger-ci"
|
||||
|
||||
content: "A simple test sentence"
|
||||
|
||||
TestS3UploadFile: {
|
||||
deploy: s3.#Put & {
|
||||
config: TestConfig.awsConfig
|
||||
sourceInline: content
|
||||
target: "s3://\(bucket)/test.txt"
|
||||
}
|
||||
|
||||
verify: #VerifyS3 & {
|
||||
config: TestConfig.awsConfig
|
||||
target: deploy.target
|
||||
file: "test.txt"
|
||||
}
|
||||
}
|
||||
|
||||
TestDirectory: dagger.#Artifact
|
||||
|
||||
TestS3UploadDir: {
|
||||
deploy: s3.#Put & {
|
||||
config: TestConfig.awsConfig
|
||||
source: TestDirectory
|
||||
target: "s3://\(bucket)/"
|
||||
}
|
||||
|
||||
verifyFile: #VerifyS3 & {
|
||||
config: TestConfig.awsConfig
|
||||
target: deploy.target
|
||||
file: "dirFile.txt"
|
||||
}
|
||||
|
||||
verifyDir: #VerifyS3 & {
|
||||
config: TestConfig.awsConfig
|
||||
target: deploy.target
|
||||
file: "foo.txt"
|
||||
}
|
||||
}
|
||||
|
||||
TestS3Sync: {
|
||||
deploy: s3.#Sync & {
|
||||
TestS3Object: {
|
||||
deploy: s3.#Object & {
|
||||
config: TestConfig.awsConfig
|
||||
source: TestDirectory
|
||||
target: "s3://\(bucket)/"
|
||||
|
@ -7,96 +7,8 @@ import (
|
||||
"dagger.io/aws"
|
||||
)
|
||||
|
||||
// S3 Bucket upload (file or directory)
|
||||
// FIXME: rename #Put to use a noun
|
||||
// FIXME: deprecate in favor of #Sync
|
||||
#Put: {
|
||||
|
||||
// AWS Config
|
||||
config: aws.#Config
|
||||
|
||||
// Source Artifact to upload to S3
|
||||
source?: dagger.#Artifact @dagger(input)
|
||||
|
||||
// Source inlined as a string to upload to S3
|
||||
sourceInline?: string @dagger(input)
|
||||
|
||||
// Target S3 URL (eg. s3://<bucket-name>/<path>/<sub-path>)
|
||||
target: string @dagger(input)
|
||||
|
||||
// Object content type
|
||||
contentType: string | *"" @dagger(input)
|
||||
|
||||
// Always write the object to S3
|
||||
always: bool | *true @dagger(input)
|
||||
|
||||
// URL of the uploaded S3 object
|
||||
url: {
|
||||
@dagger(output)
|
||||
string
|
||||
|
||||
#up: [
|
||||
op.#Load & {
|
||||
from: aws.#CLI & {
|
||||
"config": config
|
||||
}
|
||||
},
|
||||
|
||||
if sourceInline != _|_ {
|
||||
op.#WriteFile & {
|
||||
dest: "/source"
|
||||
content: sourceInline
|
||||
}
|
||||
},
|
||||
|
||||
op.#Exec & {
|
||||
if always != _|_ {
|
||||
"always": always
|
||||
}
|
||||
env: {
|
||||
TARGET: target
|
||||
CONTENT_TYPE: contentType
|
||||
}
|
||||
|
||||
if sourceInline == _|_ {
|
||||
mount: "/source": from: source
|
||||
}
|
||||
|
||||
args: [
|
||||
"/bin/bash",
|
||||
"--noprofile",
|
||||
"--norc",
|
||||
"-eo",
|
||||
"pipefail",
|
||||
"-c",
|
||||
#"""
|
||||
opts=""
|
||||
op=cp
|
||||
if [ -d /source ]; then
|
||||
op=sync
|
||||
fi
|
||||
if [ -n "$CONTENT_TYPE" ]; then
|
||||
opts="--content-type $CONTENT_TYPE"
|
||||
fi
|
||||
aws s3 $op $opts /source "$TARGET"
|
||||
echo -n "$TARGET" \
|
||||
| sed -E 's=^s3://([^/]*)/=https://\1.s3.amazonaws.com/=' \
|
||||
> /url
|
||||
"""#,
|
||||
]
|
||||
},
|
||||
|
||||
op.#Export & {
|
||||
source: "/url"
|
||||
format: "string"
|
||||
},
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
// S3 Bucket sync
|
||||
// FIXME: rename #Sync to use a noun
|
||||
#Sync: {
|
||||
// S3 Bucket object(s) sync
|
||||
#Object: {
|
||||
|
||||
// AWS Config
|
||||
config: aws.#Config
|
||||
@ -108,17 +20,16 @@ import (
|
||||
target: string @dagger(input)
|
||||
|
||||
// Delete files that already exist on remote destination
|
||||
delete: *false | bool @dagger(input)
|
||||
delete: *false | false @dagger(input)
|
||||
|
||||
// Object content type
|
||||
contentType: string | *"" @dagger(input)
|
||||
|
||||
// Always write the object to S3
|
||||
always: bool | *true @dagger(input)
|
||||
always: *true | false @dagger(input)
|
||||
|
||||
// URL of the uploaded S3 object
|
||||
url: {
|
||||
@dagger(output)
|
||||
string
|
||||
|
||||
#up: [
|
||||
@ -169,5 +80,5 @@ import (
|
||||
format: "string"
|
||||
},
|
||||
]
|
||||
}
|
||||
} @dagger(output)
|
||||
}
|
||||
|
Reference in New Issue
Block a user