diff --git a/lib/base.js b/lib/base.js index 574b6743..9751702e 100644 --- a/lib/base.js +++ b/lib/base.js @@ -42,9 +42,11 @@ class BaseObject extends CallableObject { * * @param {object} options - Options object * @param {string} options.api - Kubernetes API URL + * @param {string} options.name - kubernetes resource name + * @param {string} options.parentPath - Kubernetes resource paprent path * @param {string} options.fn - Optional function to invoke when object is - * called. - * @param {string} options.path - Kubernetes resource path + * called + * @param {string} options.qs - Optional query string object */ constructor(options) { const api = options.api; @@ -62,10 +64,13 @@ class BaseObject extends CallableObject { } super(fn); - this.parentPath = options.parentPath; this.api = api; - this.path = path; + this._name = options.name; + this.parentPath = options.parentPath; + this.fn = options.fn; this.qs = options.qs || {}; + + this.path = path; } /** @@ -151,7 +156,13 @@ class BaseObject extends CallableObject { const qs = Object.assign({}, this.qs, { labelSelector: matchExpression.stringify(expressions) }); - return new this.constructor(Object.assign({}, this, { qs })); + return new this.constructor({ + api: this.api, + name: this._name, + parentPath: this.parentPath, + fn: this.fn, + qs + }); } /**