1+ <?php declare (strict_types=1 );
2+
3+ namespace OpenStack \Metric \v1 \Gnocchi ;
4+
5+ use OpenStack \Common \Api \AbstractApi ;
6+
7+ class Api extends AbstractApi
8+ {
9+ private $ pathPrefix = 'v1 ' ;
10+
11+ public function __construct ()
12+ {
13+ $ this ->params = new Params ();
14+ }
15+
16+ public function getResources (): array
17+ {
18+ return [
19+ 'path ' => $ this ->pathPrefix .'/resource/{type} ' ,
20+ 'method ' => 'GET ' ,
21+ 'params ' => [
22+ 'limit ' => $ this ->params ->limit (),
23+ 'marker ' => $ this ->params ->marker (),
24+ 'sort ' => $ this ->params ->sort (),
25+ 'type ' => $ this ->params ->resourceType (),
26+ ],
27+ ];
28+ }
29+
30+ public function getResource (): array
31+ {
32+ return [
33+ 'path ' => $ this ->pathPrefix .'/resource/{type}/{id} ' ,
34+ 'method ' => 'GET ' ,
35+ 'params ' => [
36+ 'id ' => $ this ->params ->idUrl ('resource ' ),
37+ ]
38+ ];
39+ }
40+
41+ public function searchResources (): array
42+ {
43+ return [
44+ 'path ' => $ this ->pathPrefix .'/search/resource/{type} ' ,
45+ 'method ' => 'POST ' ,
46+ 'params ' => [
47+ 'limit ' => $ this ->params ->limit (),
48+ 'marker ' => $ this ->params ->marker (),
49+ 'sort ' => $ this ->params ->sort (),
50+ 'type ' => $ this ->params ->resourceType (),
51+ 'criteria ' => $ this ->params ->criteria (),
52+ 'contentType ' => $ this ->params ->headerContentType (),
53+ ],
54+ ];
55+ }
56+
57+ public function getResourceTypes (): array
58+ {
59+ return [
60+ 'path ' => $ this ->pathPrefix .'/resource_type ' ,
61+ 'method ' => 'GET ' ,
62+ 'params ' => [],
63+ ];
64+ }
65+
66+ public function getMetric (): array
67+ {
68+ return [
69+ 'path ' => $ this ->pathPrefix .'/metric/{id} ' ,
70+ 'method ' => 'GET ' ,
71+ 'params ' => [
72+ 'id ' => $ this ->params ->idUrl ('metric ' ),
73+ ],
74+ ];
75+ }
76+
77+ public function getMetrics (): array
78+ {
79+ return [
80+ 'path ' => $ this ->pathPrefix .'/metric ' ,
81+ 'method ' => 'GET ' ,
82+ 'params ' => [
83+ 'limit ' => $ this ->params ->limit (),
84+ 'marker ' => $ this ->params ->marker (),
85+ 'sort ' => $ this ->params ->sort ()
86+ ],
87+ ];
88+ }
89+
90+ public function getResourceMetrics (): array
91+ {
92+ return [
93+ 'path ' => $ this ->pathPrefix .'/resource/generic/{resourceId}/metric ' ,
94+ 'method ' => 'GET ' ,
95+ 'params ' => [
96+ 'resourceId ' => $ this ->params ->idUrl ('metric ' ),
97+ ]
98+ ];
99+ }
100+
101+ public function getResourceMetric (): array
102+ {
103+ return [
104+ 'path ' => $ this ->pathPrefix .'/resource/{type}/{resourceId}/metric/{metric} ' ,
105+ 'method ' => 'GET ' ,
106+ 'params ' => [
107+ 'resourceId ' => $ this ->params ->idUrl ('resource ' ),
108+ 'metric ' => $ this ->params ->idUrl ('metric ' ),
109+ 'type ' => $ this ->params ->resourceType (),
110+ ]
111+ ];
112+ }
113+ }
0 commit comments