16
16
*/
17
17
class Service extends AbstractService
18
18
{
19
+ /**
20
+ * Retrieves a collection of \OpenStack\Metric\v1\Gnocchi\Models\ResourceType type in a generator format.
21
+ *
22
+ * @return \Generator
23
+ */
19
24
public function listResourceTypes (): \Generator
20
25
{
21
26
return $ this ->model (ResourceType::class)->enumerate ($ this ->api ->getResourceTypes (), []);
22
27
}
23
28
29
+ /**
30
+ * Retrieves a collection of \OpenStack\Metric\v1\Gnocchi\Models\Resource type in a generator format.
31
+ *
32
+ * @param array $options {@see \OpenStack\Metric\v1\Gnocchi\Api::getResources}
33
+ *
34
+ * @return \Generator
35
+ */
24
36
public function listResources (array $ options = []): \Generator
25
37
{
26
38
$ this ->injectGenericType ($ options );
@@ -29,20 +41,31 @@ public function listResources(array $options = []): \Generator
29
41
}
30
42
31
43
/**
44
+ * Retrieves a Resource object and populates its unique identifier object. This operation will not perform a GET or
45
+ * HEAD request by default; you will need to call retrieve() if you want to pull in remote state from the API.
46
+ *
32
47
* @param array $options
33
48
*
34
- * @return \OpenStack\Metric\v1\Gnocchi\Models\ Resource
49
+ * @return Resource
35
50
*/
36
- public function getResource (array $ options = []): \ OpenStack \ Metric \ v1 \ Gnocchi \ Models \ Resource
51
+ public function getResource (array $ options = []): Resource
37
52
{
38
53
$ this ->injectGenericType ($ options );
39
54
55
+ /** @var Resource $resource */
40
56
$ resource = $ this ->model (Resource::class);
41
57
$ resource ->populateFromArray ($ options );
42
58
43
59
return $ resource ;
44
60
}
45
61
62
+ /**
63
+ * Retrieves a collection of \OpenStack\Metric\v1\Gnocchi\Models\Resource type in a generator format.
64
+ *
65
+ * @param array $options {@see \OpenStack\Metric\v1\Gnocchi\Api::searchResources}
66
+ *
67
+ * @return \Generator
68
+ */
46
69
public function searchResources (array $ options = []): \Generator
47
70
{
48
71
$ this ->injectGenericType ($ options );
@@ -64,19 +87,41 @@ public function searchResources(array $options = []): \Generator
64
87
return $ this ->model (Resource::class)->enumerate ($ this ->api ->searchResources (), $ options );
65
88
}
66
89
67
- public function getMetric ($ id ): Metric
90
+ /**
91
+ * Retrieves a Metric object and populates its unique identifier object. This operation will not perform a GET or
92
+ * HEAD request by default; you will need to call retrieve() if you want to pull in remote state from the API.
93
+ *
94
+ * @param string $id
95
+ *
96
+ * @return Metric
97
+ */
98
+ public function getMetric (string $ id ): Metric
68
99
{
100
+ /** @var Metric $metric */
69
101
$ metric = $ this ->model (Metric::class);
70
102
$ metric ->populateFromArray (['id ' => $ id ]);
71
103
72
104
return $ metric ;
73
105
}
74
106
107
+ /**
108
+ * Retrieves a collection of Metric type in a generator format.
109
+ *
110
+ * @param array $options {@see \OpenStack\Metric\v1\Gnocchi\Api::getMetrics}
111
+ *
112
+ * @return \Generator
113
+ */
75
114
public function listMetrics (array $ options = []): \Generator
76
115
{
77
116
return $ this ->model (Metric::class)->enumerate ($ this ->api ->getMetrics (), $ options );
78
117
}
79
118
119
+ /**
120
+ * If options does not have type, this will inject $options['type'] = 'generic'
121
+ *
122
+ * @internal
123
+ * @param array $options
124
+ */
80
125
private function injectGenericType (array &$ options )
81
126
{
82
127
if (empty ($ options ) || !isset ($ options ['type ' ])) {
0 commit comments