Skip to content

Commit

Permalink
Merge pull request #7 from bkolobara/master
Browse files Browse the repository at this point in the history
Add PersistentVolumeClaim
  • Loading branch information
maclof authored May 2, 2017
2 parents 8f79454 + 25a4529 commit 7be10ea
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ class Client
'events' => 'Repositories\EventRepository',
'configMaps' => 'Repositories\ConfigMapRepository',
'endpoints' => 'Repositories\EndpointRepository',
'persistentVolumeClaims' => 'Repositories\PersistentVolumeClaimRepository',

// extensions/v1beta1
'deployments' => 'Repositories\DeploymentRepository',
Expand Down
31 changes: 31 additions & 0 deletions src/Collections/PersistentVolumeClaimCollection.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php namespace Maclof\Kubernetes\Collections;

use Maclof\Kubernetes\Models\PersistentVolumeClaim;

class PersistentVolumeClaimCollection extends Collection
{
/**
* The constructor.
*
* @param array $data
*/
public function __construct(array $data)
{
parent::__construct($this->getPersistentVolumeClaims(isset($data['items']) ? $data['items'] : []));
}

/**
* Get an array of persistent volume claims.
*
* @param array $items
* @return array
*/
protected function getPersistentVolumeClaims(array $items)
{
foreach ($items as &$item) {
$item = new PersistentVolumeClaim($item);
}

return $items;
}
}
6 changes: 6 additions & 0 deletions src/Models/PersistentVolumeClaim.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?php namespace Maclof\Kubernetes\Models;

class PersistentVolumeClaim extends Model
{

}
13 changes: 13 additions & 0 deletions src/Repositories/PersistentVolumeClaimRepository.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php namespace Maclof\Kubernetes\Repositories;

use Maclof\Kubernetes\Collections\PersistentVolumeClaimCollection;

class PersistentVolumeClaimRepository extends Repository
{
protected $uri = 'persistentvolumeclaims';

protected function createCollection($response)
{
return new PersistentVolumeClaimCollection($response);
}
}

0 comments on commit 7be10ea

Please sign in to comment.