UNPKG

@yawetse/pkgcloud

Version:

An infrastructure-as-a-service agnostic cloud library for node.js

39 lines (28 loc) 925 B
/* * volume.js: OpenStack Block Storage snapshot * * (C) 2014 Rackspace * Ken Perkins * MIT LICENSE * */ var util = require('util'), base = require('../../core/base'), _ = require('underscore'); var Snapshot = exports.Snapshot = function Snapshot(client, details) { base.Model.call(this, client, details); }; util.inherits(Snapshot, base.Model); Snapshot.prototype._setProperties = function (details) { this.id = details.id; this.status = details.status; this.name = details.name || details['display_name']; this.description = details.description || details['display_description']; this.createdAt = details['created_at']; this.volumeId = details['volume_id']; this.size = details.size; this.metadata = details.metadata; }; Snapshot.prototype.toJSON = function () { return _.pick(this, ['id', 'status', 'name', 'description', 'createdAt', 'size', 'volumeId', 'metadata']); };