Overview

Namespaces

  • None
  • OpenCloud
    • Autoscale
      • Resource
    • CloudMonitoring
      • Exception
      • Resource
    • Common
      • Exceptions
      • Log
      • Request
        • Response
    • Compute
    • Database
    • DNS
    • LoadBalancer
      • Resources
    • ObjectStore
      • Resource
    • Orchestration
    • Volume
  • PHP

Classes

  • Service
  • Snapshot
  • Volume
  • VolumeType
  • Overview
  • Namespace
  • Class
  • Tree
  • Download
  1: <?php
  2: /**
  3:  * Defines a block storage snapshot
  4:  *
  5:  * @copyright 2012-2013 Rackspace Hosting, Inc.
  6:  * See COPYING for licensing information
  7:  *
  8:  * @package phpOpenCloud
  9:  * @version 1.0
 10:  * @author Glen Campbell <glen.campbell@rackspace.com>
 11:  */
 12: 
 13: namespace OpenCloud\Volume;
 14: 
 15: use OpenCloud\Common\PersistentObject;
 16: use OpenCloud\Common\Lang;
 17: use OpenCloud\Common\Exceptions;
 18: 
 19: /**
 20:  * The Snapshot class represents a single block storage snapshot
 21:  *
 22:  * @api
 23:  * @author Glen Campbell <glen.campbell@rackspace.com>
 24:  *
 25:  * @property string $id the identifier (usually a GUID)
 26:  * @property string $display_name the name of the snapshot
 27:  * @property string $display_description the description
 28:  * @property string $volume_id the ID of the associated volume (GUID)
 29:  * @property string $status a regular status value 
 30:  * @property integer $size the size of the snapshot
 31:  * @property datetime $created_at the date/time the snapshot was created
 32:  * @property object $metadata metadata associated with the snapshot
 33:  */
 34: class Snapshot extends PersistentObject 
 35: {
 36: 
 37:     public $id;
 38:     public $display_name;
 39:     public $display_description;
 40:     public $volume_id;
 41:     public $status;
 42:     public $size;
 43:     public $created_at;
 44:     public $metadata;
 45: 
 46:     protected $force = false;
 47: 
 48:     protected static $json_name = 'snapshot';
 49:     protected static $url_resource = 'snapshots';
 50: 
 51:     private $_create_keys = array(
 52:         'display_name',
 53:         'display_description',
 54:         'volume_id',
 55:         'force'
 56:     );
 57: 
 58:     /**
 59:      * updates are not permitted
 60:      *
 61:      * @throws OpenCloud\UpdateError always
 62:      */
 63:     public function Update($params = array()) 
 64:     {
 65:         throw new Exceptions\UpdateError(
 66:             Lang::translate('VolumeType cannot be updated')
 67:         );
 68:     }
 69: 
 70:     /**
 71:      * returns the display_name attribute
 72:      *
 73:      * @api
 74:      * @return string
 75:      */
 76:     public function Name() 
 77:     {
 78:         return $this->display_name;
 79:     }
 80: 
 81:     /**
 82:      * returns the object for the Create() method's JSON
 83:      *
 84:      * @return stdClass
 85:      */
 86:     protected function CreateJson() 
 87:     {
 88:         $object = new \stdClass();
 89: 
 90:         $elem = $this->JsonName();
 91:         $object->$elem = new \stdClass();
 92:         
 93:         foreach($this->_create_keys as $key) {
 94:             $object->$elem->$key = $this->$key;
 95:         }
 96: 
 97:         return $object;
 98:     }
 99: 
100: }
101: 
PHP OpenCloud API API documentation generated by ApiGen 2.8.0