# Snapshots

## Create a snapshot

A `Snapshot` object is created from the Cloud Block Storage service. However, it is associated with a volume, and you must specify a volume to create one:

    // New instance of OpenCloud\Volume\Resource\Snapshot
    $snapshot = $service->snapshot();

    // Send to API
    $snapshot->create(array(
        'display_name' => 'Name that snapshot',
        'volume_id'    => $volume->id
    ));

Get the executable PHP script for this example

## List snapshots

    $snapshots = $service->snapshotList();

    foreach ($snapshots as $snapshot) {
        /** @param $snapshot OpenCloud\Volume\Resource\Snapshot */
    }

Get the executable PHP script for this example

## To get details on a single snapshot

    $snapshot = $dallas->snapshot('{snapshotId}');

Get the executable PHP script for this example

## To delete a snapshot

    $snapshot->delete();

Get the executable PHP script for this example