Skip to main content

Get

The Get class provides a convenient way to get objects from S3.

Extends

This class extends the abstract Action class from Core.

Methods

performAs

public async performAs(actor: Actor): Promise<any>;
  • Description: Get an object from S3. If not specified otherwise returns the raw GetObjectCommandOutput.
  • Parameters:
    • actor - The actor performing the action.
  • Returns: Promise<any> - The response object.

object

Introduced in: 1.0.0

public static object(getObjectCommandInput): Get;
  • Description: Create a new instance of the Get class with the specified getObjectCommandInput.
  • Parameters:
    • getObjectCommandInput - The GetObjectCommandInput object.
  • Returns: Get - A new instance of the Get class.

Usage:

await actor.attemptsTo(
Get.object(getObjectCommandInput),
);

objectTags

Introduced in: 1.0.0

public static objectTags(getObjectTaggingCommandInput): Get;
  • Description: Create a new instance of the Get class with the specified getObjectTaggingCommandInput.
  • Parameters:
    • getObjectTaggingCommandInput - The GetObjectTaggingCommandInput object.
  • Returns: Get - A new instance of the Get class.

Usage:

await actor.attemptsTo(
Get.objectTags(getObjectTaggingCommandInput),
);

asText

Introduced in: 1.0.0

public get asText(): Get;
  • Description: Turn the result into plain text.
  • Returns: Get - Returns the current action.

Usage:

await actor.attemptsTo(
Get.object(getObjectCommandInput).asText,
);

asJson

Introduced in: 1.0.0

public get asJson(): Get;
  • Description: Turn the result into a JSON object (by trying to parse the content).
  • Returns: Get - Returns the current action.

Usage:

await actor.attemptsTo(
Get.object(getObjectCommandInput).asJson,
);

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'),
);