Home Reference Source Test
public class | source

Destination

This class represents a single, defined destination which the user has specified inside the UserParameters key.

Responsible for first resolving any source input artifacts and matching all files found inside the artifact. Then assuming the correct role to access the destination, and uploading them, using the File#upload method.

Constructor Summary

Public Constructor
public

constructor(destination: Object, artifacts: Object)

Member Summary

Public Members
public

artifacts: Array[Artifact]

An array of Artifact (which may not be ready).

public

A static or remote reference to a destination S3 bucket.

public

The working directory to match files against.

public

The prefix to apply to all uploaded source files in the destination S3 bucket.

public

A static or remote reference to a IAM Role which has sufficient permissons for the destination S3 Bucket.

public

sources: Array[String]

An array of source files to be found inside one or more input artifacts.

public

sts: STS

The AWS STS client used to assume roles inside the lambda function for the appropriate S3 destination.

Method Summary

Public Methods
public

async credentials(): Object

Retrieves credentials by assuming the defined role, which (should) enable IAM access to the remote S3 destination.

public

async files(): Array[File]

Retrieves all matched file objects from inside the "src" definition.

public

async upload(): Boolean

Uploads all matched files from their source input artifacts to the defined destinations, prefixed with the appropriate key.

Public Constructors

public constructor(destination: Object, artifacts: Object) source

Params:

NameTypeAttributeDescription
destination Object

a valid src/destination object.

destination.roleArn String, Object

a static or remote reference to a IAM Role which has sufficient permissons for the destination S3 Bucket.

destination.bucket String, Object

a static or remote reference to a destination S3 bucket.

destination.src Array[String]

An array of source files to be found inside one or more input artifacts.

destination.cwd String

The working directory to match files against.

destination.prefix String

The prefix to apply to all uploaded source files in the destination S3 bucket.

artifacts Object

An object containing all Artifact instances with the property key being the artifacts name.

Public Members

public artifacts: Array[Artifact] source

An array of Artifact (which may not be ready).

public bucket: Attribute source

A static or remote reference to a destination S3 bucket.

public cwd: String source

The working directory to match files against.

Matched files are returned relatively against this directory.

public prefix: String source

The prefix to apply to all uploaded source files in the destination S3 bucket.

public roleArn: Attribute source

A static or remote reference to a IAM Role which has sufficient permissons for the destination S3 Bucket.

public sources: Array[String] source

An array of source files to be found inside one or more input artifacts.

public sts: STS source

The AWS STS client used to assume roles inside the lambda function for the appropriate S3 destination.

Public Methods

public async credentials(): Object source

Retrieves credentials by assuming the defined role, which (should) enable IAM access to the remote S3 destination.

Return:

Object

an object containing AWS access keys.

public async files(): Array[File] source

Retrieves all matched file objects from inside the "src" definition. This function will resolve all matched file references, across all input artifacts.

If a cwd parameter has been defined, file objects returned will have paths relative to this directory path.

Return:

Array[File]

an array of file objects ready for upload.

public async upload(): Boolean source

Uploads all matched files from their source input artifacts to the defined destinations, prefixed with the appropriate key.

Note that this function first assumes the correct role for this destination.

Return:

Boolean

true if successful, throws otherwise.