File tree Expand file tree Collapse file tree 3 files changed +18
-61
lines changed Expand file tree Collapse file tree 3 files changed +18
-61
lines changed Original file line number Diff line number Diff line change @@ -642,23 +642,23 @@ public function getHypervisorStatistics(): array
642
642
];
643
643
}
644
644
645
- public function getHosts (): array
645
+ public function getHypervisors (): array
646
646
{
647
647
return [
648
648
'method ' => 'GET ' ,
649
- 'path ' => 'os-hosts ' ,
649
+ 'path ' => 'os-hypervisors ' ,
650
650
'params ' => [
651
- 'name ' => $ this ->params ->filterName ()
651
+ 'limit ' => $ this ->params ->limit (),
652
+ 'marker ' => $ this ->params ->marker ()
652
653
],
653
654
];
654
655
}
655
656
656
- public function getHost (): array
657
+ public function getHypervisorsDetail (): array
657
658
{
658
- return [
659
- 'method ' => 'GET ' ,
660
- 'path ' => 'os-hosts/{name} ' ,
661
- 'params ' => ['name ' => $ this ->params ->urlId ('host ' )]
662
- ];
659
+ $ definition = $ this ->getHypervisors ();
660
+ $ definition ['path ' ] .= '/detail ' ;
661
+ return $ definition ;
663
662
}
663
+
664
664
}
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 9
9
use OpenStack \Compute \v2 \Models \Keypair ;
10
10
use OpenStack \Compute \v2 \Models \Limit ;
11
11
use OpenStack \Compute \v2 \Models \Server ;
12
- use OpenStack \Compute \v2 \Models \Host ;
12
+ use OpenStack \Compute \v2 \Models \Hypervisor ;
13
13
14
14
/**
15
15
* Compute v2 service for OpenStack.
@@ -202,16 +202,19 @@ public function getHypervisorStatistics(): HypervisorStatistic
202
202
}
203
203
204
204
/**
205
- * List hosts .
205
+ * List hypervisors .
206
206
*
207
- * @param array $options {@see \OpenStack\Compute\v2\Api::getHosts}
207
+ * @param bool $detailed Determines whether detailed information will be returned. If FALSE is specified, only
208
+ * the ID, name and links attributes are returned, saving bandwidth.
209
+ * @param array $options {@see \OpenStack\Compute\v2\Api::getHypervisors}
208
210
* @param callable $mapFn A callable function that will be invoked on every iteration of the list.
209
211
*
210
212
* @return \Generator
211
213
*/
212
- public function listHosts ( array $ options = [], callable $ mapFn = null ): \Generator
214
+ public function listHypervisors ( bool $ detailed = false , array $ options = [], callable $ mapFn = null ): \Generator
213
215
{
214
- $ def = $ this ->api ->getHosts ();
215
- return $ this ->model (Host ::class)->enumerate ($ def , $ options , $ mapFn );
216
+ $ def = ( $ detailed === true ) ? $ this ->api ->getHypervisorsDetail () : $ this -> api -> getHypervisors ();
217
+ return $ this ->model (Hypervisor ::class)->enumerate ($ def , $ options , $ mapFn );
216
218
}
219
+
217
220
}
You can’t perform that action at this time.
0 commit comments