Skip to content

Latest commit

 

History

History
147 lines (113 loc) · 5.62 KB

plugin-aws-s3.adoc

File metadata and controls

147 lines (113 loc) · 5.62 KB

AWS S3 Plugin

The plugin provides functionality to interact with Amazon Simple Storage Service (Amazon S3).

Installation

build.gradle
implementation(group: 'org.vividus', name: 'vividus-plugin-aws-s3', version: '{current-version}')

Steps

Upload data

Upload the specified data to Amazon S3 under the specified bucket and key name.

When I upload data `$data` with key `$objectKey` and content type `$contentType` to S3 bucket `$bucketName`
  • $data - the data to be uploaded

  • $objectKey - the key under which to store the specified data

  • $contentType - the MIME type of data

  • $bucketName - the name of an existing bucket

Upload data to Amazon S3
When I upload data `{"my":"json"}` with key `folder/name.json` and content type `application/json` to S3 bucket `testBucket`

Download S3 object

Retrieve the object by key from the provided S3 bucket and save its content to a variable. The specified bucket and object key must exist, or an error will result.

When I fetch object with key `$objectKey` from S3 bucket `$bucketName` and save result to $scopes variable `$variableName`
  • $objectKey - the key under which the desired object is stored

  • $bucketName - the name of the bucket containing the desired object

  • $scopes - The comma-separated set of the variables scopes.

  • $variableName - the variable name

Download S3 object
When I fetch object with key `/path/file.json` from S3 bucket `some-bucket-name` and save result to scenario variable `my-json-var`

Set S3 object ACL

Set the canned access control list (ACL) for the specified object in Amazon S3. Each bucket and object in Amazon S3 has an ACL that defines its access control policy. When a request is made, Amazon S3 authenticates the request using its standard authentication procedure and then checks the ACL to verify the sender was granted access to the bucket or object. If the sender is approved, the request proceeds. Otherwise, Amazon S3 returns an error.

When I set ACL `$cannedAcl` for object with key `$objectKey` from S3 bucket `$bucketName`
  • $cannedAcl - The new pre-configured canned ACL for the specified object. (See the official documentation for a complete list of the available ACLs)

  • $objectKey - The key of the object within the specified bucket whose ACL is being set.

  • $bucketName - The name of the bucket containing the object whose ACL is being set

Set public READ permission
When I set ACL `public-read` for object with key `/path/file.json` from S3 bucket `some-bucket-name`

Collect S3 objects keys

Collects a list of the S3 objects keys in the specified bucket. Because buckets can contain a virtually unlimited number of keys, the complete results can be extremely large, thus it’s recommended to use filters to retrieve the filtered dataset.

When I collect objects keys filtered by:$filters in S3 bucket `$bucketName` and save result to $scopes variable `$variableName`
  • $filters - The ExamplesTable with filters to be applied to the objects to limit the resulting set.

    Table 1. The supported filter types
    Type Alias Description

    KEY_PREFIX

    key prefix

    The prefix parameter, restricting to keys that begin with the specified value

    KEY_SUFFIX

    key suffix

    The suffix parameter, restricting to keys that end with the specified value

    OBJECT_MODIFIED_NOT_EARLIER_THAN

    object modified not earlier than

    The ISO-8601 date, restricting to objects with last modified date after the specified value

    The filters can be combined in any order and in any composition.

    The combination of filters
    |filterType                      |filterValue               |
    |key suffix                      |.txt                      |
    |object modified not earlier than|2021-01-15T19:00:00+00:00 |
  • $bucketName - The name of the S3 bucket which objects keys are to be collected

  • $scopes - The comma-separated set of the variables scopes.

  • $variableName - The variable name to store the S3 objects keys. The keys are accessible via zero-based index, ${my-keys[0]} will return the first found key.

Download the first found S3 object with the specified prefix
When I collect objects keys filtered by:
|filterType                      |filterValue   |
|key prefix                      |folder/       |
in S3 bucket `some-bucket-name` and save result to scenario variable `s3-keys`
When I fetch object with key `${s3-keys[0]}` from S3 bucket `some-bucket-name` and save result to scenario variable `s3-object`

Delete S3 object

Delete the specified object in the specified bucket. Once deleted, the object can only be restored if versioning was enabled when the object was deleted. If attempting to delete an object that does not exist, Amazon S3 returns a success message instead of an error message.

When I delete object with key `$objectKey` from S3 bucket `$bucketName`
  • $objectKey - The key of the object to delete.

  • $bucketName - The name of the Amazon S3 bucket containing the object to delete.

Delete S3 object
When I delete object with key `/path/file.json` from S3 bucket `some-bucket-name`