HPCloud-PHP  1.2.0
PHP bindings for HPCloud and OpenStack services.
 All Classes Namespaces Files Functions Variables Pages
SnapshotDetails.php
Go to the documentation of this file.
1 <?php
2 /* ============================================================================
3 (c) Copyright 2012 Hewlett-Packard Development Company, L.P.
4 Permission is hereby granted, free of charge, to any person obtaining a copy
5 of this software and associated documentation files (the "Software"), to deal
6 in the Software without restriction, including without limitation the rights to
7 use, copy, modify, merge,publish, distribute, sublicense, and/or sell copies of
8 the Software, and to permit persons to whom the Software is furnished to do so,
9 subject to the following conditions:
10 
11 The above copyright notice and this permission notice shall be included in all
12 copies or substantial portions of the Software.
13 
14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 SOFTWARE.
21 ============================================================================ */
22 /**
23  * @file
24  *
25  * This file contains the HPCloud::DBaaS::SnapshotDetails class.
26  */
27 
28 namespace HPCloud\Services\DBaaS;
29 
30 /**
31  * Details about a DBaaS snapshot.
32  * Instances of this class are returned from DBaaS during creation
33  * and listing operations.
34  */
36  protected $id;
37  protected $instanceId;
38  protected $created;
39  protected $status;
40  protected $links;
41 
42  public static function newFromJSON($json) {
43  $o = new SnapshotDetails($json['id'], $json['instanceId']);
44  $o->created = $json['created'];
45  $o->links = $json['links'];
46 
47  return $o;
48  }
49  public function __construct($id, $instanceId) {
50  $this->id = $id;
51  $this->instanceId = $instanceId;
52  }
53  /**
54  * The ID of the snapshot.
55  *
56  * @retval string
57  * @return string
58  * The ID.
59  */
60  public function id() {
61  return $this->id;
62  }
63  /**
64  * The ID of the database instance.
65  *
66  * This returns the ID of the database instance of which this
67  * is a snapshot.
68  *
69  * @retval string
70  * @return string
71  * The database instance ID.
72  */
73  public function instanceId() {
74  return $this->instanceId;
75  }
76  /**
77  * The data upon which this snapshot was created.
78  *
79  * @retval string
80  * @return string
81  * An ISO data string representing the date and time
82  * that this snapshot was created.
83  */
84  public function createdOn() {
85  return $this->created;
86  }
87  /**
88  * The links for this snapshot.
89  *
90  * See HPCloud::Services::DBaaS::InstanceDetails::links().
91  *
92  * @attention
93  * The data returned from this may be in flux during the beta release
94  * of this product.
95  * @retval array
96  * @return array
97  * An array of links. Typically, at least an URL to the snapshot should
98  * be provided.
99  */
100  public function links() {
101  return $this->links;
102  }
103 }