Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

<a name="1.1.1"></a>
## [1.1.1](https://github.com/bucharest-gold/openshift-rest-client/compare/v1.1.0...v1.1.1) (2018-05-14)


### Bug Fixes

* **package:** update dependecies to fix sshpk security issue, https://nodesecurity.io/advisories/606 ([#65](https://github.com/bucharest-gold/openshift-rest-client/issues/65)) ([5cde946](https://github.com/bucharest-gold/openshift-rest-client/commit/5cde946)), closes [#64](https://github.com/bucharest-gold/openshift-rest-client/issues/64)



<a name="1.1.0"></a>
# [1.1.0](https://github.com/bucharest-gold/openshift-rest-client/compare/v1.0.1...v1.1.0) (2018-03-20)

Expand Down
58 changes: 58 additions & 0 deletions lib/events.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
'use strict';

/*
*
* Copyright 2016-2017 Red Hat, Inc, and individual contributors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/

const request = require('./common-request');
const privates = require('./private-map');

function findAll (client) {
return function findAll (options = {}) {
const clientConfig = privates.get(client).config;

const req = {
method: 'GET',
url: `${client.kubeUrl}/namespaces/${clientConfig.context.namespace}/events`,
qs: options.qs
};

return request(client, req);
};
}

function find (client) {
return function find (eventName, options = {}) {
const clientConfig = privates.get(client).config;

if (!eventName) {
return Promise.reject(new Error('Event Name is required'));
}

const req = {
method: 'GET',
url: `${client.kubeUrl}/namespaces/${clientConfig.context.namespace}/events/${eventName}`
};

return request(client, req);
};
}

module.exports = {
findAll: findAll,
find: find
};
4 changes: 4 additions & 0 deletions lib/openshift-rest-client.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,10 @@ const builds = require('./builds');
const clusterrolebindings = require('./cluster-role-bindings');
const configMaps = require('./configmaps');
const deploymentconfigs = require('./deployment-config');
const events = require('./events');
const groups = require('./groups');
const imagestreams = require('./imagestreams');
const persistentvolumeclaims = require('./persistent-volume-claims');
const pods = require('./pods');
const projectrequests = require('./projectrequests');
const projects = require('./projects');
Expand Down Expand Up @@ -68,8 +70,10 @@ function openshiftClient (settings = {}) {
clusterrolebindings: clusterrolebindings,
configmaps: configMaps,
deploymentconfigs: deploymentconfigs,
events: events,
groups: groups,
imagestreams: imagestreams,
persistentvolumeclaims: persistentvolumeclaims,
pods: pods,
projectrequests: projectrequests,
projects: projects,
Expand Down
133 changes: 133 additions & 0 deletions lib/persistent-volume-claims.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
'use strict';

/*
*
* Copyright 2016-2017 Red Hat, Inc, and individual contributors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/

const request = require('./common-request');
const privates = require('./private-map');

function findAll (client) {
return function findAll (options = {}) {
const clientConfig = privates.get(client).config;

const req = {
method: 'GET',
url: `${client.kubeUrl}/namespaces/${clientConfig.context.namespace}/persistentvolumeclaims`,
qs: options.qs
};

return request(client, req);
};
}

function find (client) {
return function find (claimName, options = {}) {
const clientConfig = privates.get(client).config;

if (!claimName) {
return Promise.reject(new Error('Claim Name is required'));
}

const req = {
method: 'GET',
url: `${client.kubeUrl}/namespaces/${clientConfig.context.namespace}/persistentvolumeclaims/${claimName}`
};

return request(client, req);
};
}

function create (client) {
return function create (pvc, options = {}) {
const clientConfig = privates.get(client).config;

const req = {
method: 'POST',
url: `${client.kubeUrl}/namespaces/${clientConfig.context.namespace}/persistentvolumeclaims`,
json: false,
body: JSON.stringify(pvc)
};

return request(client, req).then((body) => {
return JSON.parse(body);
});
};
}

function update (client) {
return function create (claimName, pvc, options = {}) {
const clientConfig = privates.get(client).config;

if (!claimName) {
return Promise.reject(new Error('Claim Name is required'));
}

const req = {
method: 'PUT',
json: false,
url: `${client.kubeUrl}/namespaces/${clientConfig.context.namespace}/persistentvolumeclaims/${claimName}`,
body: JSON.stringify(pvc)
};

return request(client, req).then((body) => {
return JSON.parse(body);
});
};
}

function remove (client) {
return function remove (claimName, options = {}) {
const clientConfig = privates.get(client).config;

if (!claimName) {
return Promise.reject(new Error('Claim Name is required'));
}

const req = {
method: 'DELETE',
url: `${client.kubeUrl}/namespaces/${clientConfig.context.namespace}/persistentvolumeclaims/${claimName}`,
body: options.body,
qs: options.qs
};

return request(client, req);
};
}

function removeAll (client) {
return function removeAll (options = {}) {
const clientConfig = privates.get(client).config;

const req = {
method: 'DELETE',
url: `${client.kubeUrl}/namespaces/${clientConfig.context.namespace}/persistentvolumeclaims`,
qs: options.qs
};

return request(client, req);
};
}

module.exports = {
findAll: findAll,
find: find,
create: create,
update: update,
remove: remove,
removeAll: removeAll
};
Loading