-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #21 from SysBind/persistentVolume
Persistent volume
- Loading branch information
Showing
6 changed files
with
93 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,6 @@ | |
/clover.xml | ||
/composer.lock | ||
/.idea | ||
/.settings/ | ||
/.buildpath | ||
/.project |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?php | ||
namespace Maclof\Kubernetes\Collections; | ||
|
||
use Maclof\Kubernetes\Models\PersistentVolume; | ||
use Maclof\Kubernetes\Collections\Collection; | ||
/** | ||
* | ||
* @author avi | ||
* | ||
*/ | ||
class PersistentVolumeCollection extends Collection | ||
{ | ||
public function __construct(array $data) | ||
{ | ||
parent::__construct($this->getPersistentVolume(isset($data['items']) ? $data['items'] : [])); | ||
} | ||
|
||
protected function getPersistentVolume(array $items) | ||
{ | ||
foreach ($items as &$item) { | ||
$item = new PersistentVolume($item); | ||
} | ||
|
||
return $items; | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?php | ||
namespace Maclof\Kubernetes\Models; | ||
|
||
/** | ||
* | ||
* @author avi | ||
* | ||
*/ | ||
class PersistentVolume extends Model | ||
{ | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<?php | ||
namespace Maclof\Kubernetes\Repositories; | ||
|
||
use Maclof\Kubernetes\Collections\PersistentVolumeCollection; | ||
|
||
/** | ||
* | ||
* @author avi | ||
* | ||
*/ | ||
class PersistentVolumeRepository extends Repository | ||
{ | ||
protected $uri = 'persistentvolumes'; | ||
/** | ||
* (non-PHPdoc) | ||
* | ||
* @see \Maclof\Kubernetes\Repositories\Repository::createCollection() | ||
* | ||
*/ | ||
protected function createCollection($response) | ||
{ | ||
return new PersistentVolumeCollection($response); | ||
} | ||
|
||
/** | ||
* Send a request. | ||
* | ||
* @param string $method | ||
* @param string $uri | ||
* @param array $query | ||
* @param mixed $body | ||
* @param boolean $namespace | ||
* @return array | ||
*/ | ||
protected function sendRequest($method, $uri, $query = [], $body = [], $namespace = false) | ||
{ | ||
$namespace = false; | ||
$apiVersion = $this->getApiVersion(); | ||
if ($apiVersion == 'v1') { | ||
$apiVersion = null; | ||
} | ||
|
||
return $this->client->sendRequest($method, $uri, $query, $body, $namespace, $apiVersion); | ||
} | ||
} | ||
|