function main(projectId, snapshotName) {
  // [START compute_snapshot_delete]
  /**
   * TODO(developer): Uncomment and replace these variables before running the sample.
   */
  // const projectId = 'YOUR_PROJECT_ID';
  // const snapshotName = 'YOUR_SNAPSHOT_NAME';

  const compute = require('@google-cloud/compute');

  async function deleteSnapshot() {
    const snapshotsClient = new compute.SnapshotsClient();

    const [response] = await snapshotsClient.delete({
      project: projectId,
      snapshot: snapshotName,
    });
    let operation = response.latestResponse;
    const operationsClient = new compute.GlobalOperationsClient();

    // Wait for the create disk operation to complete.
    while (operation.status !== 'DONE') {
      [operation] = await operationsClient.wait({
        operation: operation.name,
        project: projectId,
      });
    }

    console.log('Snapshot deleted.');
  }

  deleteSnapshot();
  // [END compute_snapshot_delete]
}
Delete a snapshot of a disk.

@param {string} projectId - Project ID or project number of the Cloud project you want to use.
@param {string} snapshotName - Name of the snapshot to delete.