Class SnapshotService

Hierarchy

  • SnapshotService

Constructors

Methods

  • Delete a specific snapshot by ID

    Example

    import { DigitalOcean } from 'digitalocean-js';

    const client = new DigitalOcean('your-api-key');
    await client.snapshots.deleteSnapshot('snapshot-id');

    Parameters

    • snapshotId: string

    Returns Promise<void>

  • Get a specific existing snapshot by ID

    Example

    import { DigitalOcean } from 'digitalocean-js';

    const client = new DigitalOcean('your-api-key');
    const snapshot = await client.snapshots.getSnapshotById('snapshot-id');

    Parameters

    • snapshotId: string

    Returns Promise<Snapshot>

  • Get all snapshots on the account. Optionally provide a resource type to filter snapshots.

    Example

    import { DigitalOcean } from 'digitalocean-js';

    const client = new DigitalOcean('your-api-key');
    // Get all snapshots
    const snapshots = await client.snapshots.getSnapshots();
    // Get all droplet snapshots
    snapshots = await client.snapshots.getSnapshots('droplet');
    // Get all volume snapshots
    snapshots = await client.snapshots.getSnapshots('volume');

    Parameters

    Returns Promise<Snapshot[]>

Generated using TypeDoc