Interface ResourceProvider<Inputs, Outputs>

ResourceProvider represents an object that provides CRUD operations for a particular type of resource.

interface ResourceProvider<Inputs, Outputs> {
    check?: ((olds, news) => Promise<dynamic.CheckResult<Inputs>>);
    create: ((inputs) => Promise<dynamic.CreateResult<Outputs>>);
    delete?: ((id, props) => Promise<void>);
    diff?: ((id, olds, news) => Promise<dynamic.DiffResult>);
    read?: ((id, props?) => Promise<dynamic.ReadResult<Outputs>>);
    update?: ((id, olds, news) => Promise<dynamic.UpdateResult<Outputs>>);
}

Type Parameters

  • Inputs = any
  • Outputs = any

Properties

check?: ((olds, news) => Promise<dynamic.CheckResult<Inputs>>)

Check validates that the given property bag is valid for a resource of the given type.

Type declaration

create: ((inputs) => Promise<dynamic.CreateResult<Outputs>>)

Create allocates a new instance of the provided resource and returns its unique ID afterwards. If this call fails, the resource must not have been created (i.e., it is "transactional").

Type declaration

delete?: ((id, props) => Promise<void>)

Delete tears down an existing resource with the given ID. If it fails, the resource is assumed to still exist.

Type declaration

    • (id, props): Promise<void>
    • Parameters

      • id: string

        The ID of the resource to delete.

      • props: Outputs

        The current properties on the resource.

      Returns Promise<void>

diff?: ((id, olds, news) => Promise<dynamic.DiffResult>)

Diff checks what impacts a hypothetical update will have on the resource's properties.

Type declaration

read?: ((id, props?) => Promise<dynamic.ReadResult<Outputs>>)

Reads the current live state associated with a resource. Enough state must be included in the inputs to uniquely identify the resource; this is typically just the resource ID, but it may also include some properties.

Type declaration

update?: ((id, olds, news) => Promise<dynamic.UpdateResult<Outputs>>)

Update updates an existing resource with new values.

Type declaration

Generated using TypeDoc