Skip to content

Commit be0c0c0

Browse files
committed
context switching, cloud provider support
1 parent 9510e49 commit be0c0c0

File tree

5 files changed

+392
-21
lines changed

5 files changed

+392
-21
lines changed

composer.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,12 @@
1313
"require": {
1414
"php": ">=7.2.0",
1515
"ext-json": "*",
16-
"ext-yaml": "*"
16+
"symfony/yaml": "^5.0",
17+
"flow/jsonpath": "^0.5.0"
1718
},
1819
"suggest": {
19-
"ext-pcntl": "support forking of watches"
20+
"ext-pcntl": "support forking of watches",
21+
"ext-yaml": "support parsing yaml with native extensions"
2022
},
2123
"autoload": {
2224
"psr-0": {"KubernetesClient\\": "src/"}

src/KubernetesClient/Client.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
namespace KubernetesClient;
44

5+
use Flow\JSONPath\JSONPathException;
6+
57
/**
68
* Client class for interacting with a kubernetes API. Primary interface should be:
79
* - ->request()
@@ -39,6 +41,8 @@ public function getConfig()
3941
* Get common options to be used for the stream context
4042
*
4143
* @return array
44+
* @throws \Error
45+
* @throws JSONPathException
4246
*/
4347
private function getContextOptions()
4448
{
@@ -75,6 +79,8 @@ private function getContextOptions()
7579
* @param string $verb
7680
* @param array $opts
7781
* @return resource
82+
* @throws \Error
83+
* @throws JSONPathException
7884
*/
7985
public function getStreamContext($verb = 'GET', $opts = [])
8086
{
@@ -163,9 +169,7 @@ public function request($endpoint, $verb = 'GET', $params = [], $data = null)
163169
*/
164170
public function createWatch($endpoint, $params = [], \Closure $callback)
165171
{
166-
$watch = new Watch($this, $endpoint, $params, $callback);
167-
168-
return $watch;
172+
return new Watch($this, $endpoint, $params, $callback);
169173
}
170174

171175
/**

0 commit comments

Comments
 (0)