HPCloud-PHP
1.2.0
PHP bindings for HPCloud and OpenStack services.
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Pages
FlavorDetails.php
Go to the documentation of this file.
1
<?php
2
/* ============================================================================
3
(c) Copyright 2013 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
* This file contains the Database FlavorDetails class.
25
*/
26
27
namespace
HPCloud\Services\DBaaS
;
28
29
/**
30
* Class for working with Database Flavors Details.
31
*/
32
class
FlavorDetails
{
33
34
protected
$name
;
35
protected
$id
;
36
protected
$url
;
37
protected
$links
;
38
protected
$ram
;
39
protected
$vcpu
;
40
41
public
static
function
newFromArray
(array $array) {
42
43
$o =
new
FlavorDetails
($array[
'name'
], $array[
'id'
]);
44
$o->links = $array[
'links'
];
45
$o->ram = $array[
'ram'
];
46
$o->vcpu = $array[
'vcpu'
];
47
48
if
(isset($array[
'links'
][0]) && $array[
'links'
][0][
'rel'
] ==
'self'
) {
49
$o->url = $array[
'links'
][0][
'href'
];
50
}
51
52
return
$o;
53
}
54
55
public
function
__construct
(
$name
, $id) {
56
$this->
name
=
$name
;
57
$this->
id
=
$id
;
58
}
59
60
/**
61
* Get the name of a flavor (e.g., small).
62
*
63
* @return string
64
* The name of a flavor.
65
*/
66
public
function
name
() {
67
return
$this->name
;
68
}
69
70
/**
71
* Get the id of a flavor.
72
*
73
* @return int
74
* The id of a flavor.
75
*/
76
public
function
id
() {
77
return
$this->id;
78
}
79
80
/**
81
* Get the links for a flavor.
82
*
83
* @retval array
84
* @return array
85
* Get an array of links for the flavor.
86
*/
87
public
function
links
() {
88
return
$this->links;
89
}
90
91
/**
92
* Get the callback url for the flavor.
93
*
94
* @retval string
95
* @return string
96
* The callback url for the flavor. This is in the form
97
* [DaaSBaseURI]/{tenant_id}/flavors/{flavorId}
98
*/
99
public
function
url
() {
100
return
$this->url
;
101
}
102
103
/**
104
* Get the amount of ram available to this flavor.
105
*
106
* @retval int
107
* @return int
108
* The amount of ram available to the flavor.
109
*/
110
public
function
ram
() {
111
return
$this->ram;
112
}
113
114
/**
115
* Get the number of virtual CPUs available to this flavor.
116
*
117
* @retval int
118
* @return int
119
* The number of virtual CPUs available to the flavor.
120
*/
121
public
function
vcpu
() {
122
return
$this->vcpu;
123
}
124
}
src
HPCloud
Services
DBaaS
FlavorDetails.php
Generated on Fri Jan 11 2013 09:17:48 for HPCloud-PHP by
1.8.1.2