Skip to main content

IResourceAction <T>

A resource action creates, updates, or destroys one piece of real infrastructure.

Actions belong to external resources - the ones Octo drives itself through a cloud provider's SDK. A resource whose lifecycle terraform manages (ATerraformResource) must not have one; registering an action for it throws.

The class extends ANodeAction, which gives it the container and log(). Register it with Action, and a Factory to construct it.

@group

Resources

@see

Definition of Actions.

Type parameters

  • T: UnknownResource

Hierarchy

Index

Properties

optionalactionTimeoutInMs

actionTimeoutInMs?: number

How long the action may run before Octo aborts it.

@defaultValue

90000

readonlyinheritedcontainer

container: Container

The container, for resolving whatever services or SDK clients the action needs.

Methods

filter

  • filter(diff: Diff): boolean
  • Whether this action handles the given diff. Typically a check on the diff's resource, field, and action.


    Parameters

    Returns boolean

handle

  • handle(diff: Diff): Promise<void> | Promise<T[response]>
  • Performs the change against the cloud provider.


    Parameters

    Returns Promise<void> | Promise<T[response]>

    What the provider reported back, which Octo records as the resource's response. Return nothing when the action has no output, e.g. a delete.

inheritedlog

  • log(diff: Diff, message: string, metadata?: Record<string, unknown>): void
  • To report what the action is doing for diff, the diff its handle() was given. The message is emitted as an ActionEvent, so it is picked up by whatever listeners the command has, rather than written straight to the console.


    Parameters

    • diff: Diff
    • message: string
    • metadata: Record<string, unknown> = {}

    Returns void