1 | <?php |
||
20 | class Builder |
||
21 | { |
||
22 | /** |
||
23 | * Global options that will be applied to every service created by this builder. |
||
24 | * |
||
25 | * @var array |
||
26 | */ |
||
27 | private $globalOptions = []; |
||
28 | |||
29 | /** |
||
30 | * Defaults that will be applied to options if no values are provided by the user. |
||
31 | * |
||
32 | * @var array |
||
33 | */ |
||
34 | private $defaults = ['urlType' => 'publicURL']; |
||
35 | |||
36 | /** |
||
37 | * @param array $globalOptions Options that will be applied to every service created by this builder. |
||
38 | * Eventually they will be merged (and if necessary overridden) by the |
||
39 | * service-specific options passed in. |
||
40 | */ |
||
41 | 9 | public function __construct(array $globalOptions = []) |
|
45 | |||
46 | /** |
||
47 | * Internal method which resolves the API and Service classes for a service. |
||
48 | * |
||
49 | * @param string $serviceName The name of the service, e.g. Compute |
||
50 | * @param int $serviceVersion The major version of the service, e.g. 2 |
||
51 | * |
||
52 | * @return array |
||
53 | */ |
||
54 | 2 | private function getClasses($serviceName, $serviceVersion) |
|
63 | |||
64 | /** |
||
65 | * This method will return an OpenStack service ready fully built and ready for use. There is |
||
66 | * some initial setup that may prohibit users from directly instantiating the service class |
||
67 | * directly - this setup includes the configuration of the HTTP client's base URL, and the |
||
68 | * attachment of an authentication handler. |
||
69 | * |
||
70 | * @param $serviceName The name of the service as it appears in the OpenStack\* namespace |
||
71 | * @param $serviceVersion The major version of the service |
||
72 | * @param array $serviceOptions The service-specific options to use |
||
73 | * |
||
74 | * @return \OpenStack\Common\Service\ServiceInterface |
||
75 | * |
||
76 | * @throws \Exception |
||
77 | */ |
||
78 | 9 | public function createService($serviceName, $serviceVersion, array $serviceOptions = []) |
|
90 | |||
91 | 6 | private function stockHttpClient(array &$options, $serviceName) |
|
107 | |||
108 | /** |
||
109 | * @codeCoverageIgnore |
||
110 | */ |
||
111 | private function addDebugMiddleware(array $options, HandlerStack &$stack) |
||
120 | |||
121 | 6 | private function stockIdentityService(array &$options) |
|
128 | |||
129 | /** |
||
130 | * @param array $options |
||
131 | * @codeCoverageIgnore |
||
132 | */ |
||
133 | private function stockAuthHandler(array &$options) |
||
141 | |||
142 | 2 | private function getStack(callable $authHandler, Token $token = null) |
|
148 | |||
149 | 6 | private function httpClient($baseUrl, HandlerStack $stack) |
|
156 | |||
157 | 9 | private function mergeOptions(array $serviceOptions) |
|
167 | } |
||
168 |