Skip to main content

List

The List class provides a convenient way to list objects from S3.

Extends

This class extends the abstract Action class from Core.

Methods

performAs

public async performAs(actor: Actor): Promise<ListObjectsV2CommandOutput>;
  • Description: Lists objects from S3.
  • Parameters:
    • actor - The actor performing the action.
  • Returns: Promise<ListObjectsV2CommandOutput> - The response object.

objects

Introduced in: 1.0.0

public static objects(listObjectsCommandInput): List;
  • Description: Create a new instance of the List class with the specified listObjectsCommandInput.
  • Parameters:
    • listObjectsCommandInput - The ListObjectsV2CommandInput object.
  • Returns: List - A new instance of the List class.

Usage:

await actor.attemptsTo(
List.objects(getObjectCommandInput),
);

asText

Introduced in: 1.0.0

public get asText(): List;
  • Description: Turn the result into plain text array of all object keys.
  • Returns: List - Returns the current action.

Usage:

await actor.attemptsTo(
List.objects(glistObjectsCommandInput).asText,
);

asJson

Introduced in: 1.0.0

public get asJson(): List;
  • Description: Turn the list into a JSON object array.
  • Returns: List - Returns the current action.

Usage:

await actor.attemptsTo(
List.objects(listObjectsCommandInput).asJson,
);

withTags

Introduced in: 1.0.0

public get withTags(): List;
  • Description: Includes object tags in the list. (This wont have an impact on the result if asText is applied)
  • Returns: List - Returns the current action.

Usage:

await actor.attemptsTo(
List.objects(listObjectsCommandInput).withTags,
);

Methods inherited from Core Action

orSkipOnFail

Introduced in core: 0.5.0

public get orSkipOnFail(): Action;
  • Description: Allows to skip an action on fail.
  • Returns: Action - Returns the current action.

Usage:

// Would skip the step on error without breaking the execution
await actor.attemptsTo(
Do.something().orSkipOnFail,
);

withAbilityAlias

Introduced in core: 0.3.0

public withAbilityAlias(alias: string): Action;
  • Description: Defines the ability alias to be used during execution.
  • Parameters:
    • alias - The alias.
  • Returns: Action - Returns the current action.

Usage:

await actor.attemptsTo(
Do.something().withAbilityAlias('myAlias'),
);