Seperate OpenStack class from index.js
This commit to seperate OpenStack class from index.js to new file Change-Id: If433040fce752e0033eb61139fd8daa9c6dbb669
This commit is contained in:
parent
9677a06a2d
commit
c5c58bcaad
24
src/index.js
24
src/index.js
|
@ -1,26 +1,4 @@
|
||||||
export {default as Keystone} from './keystone';
|
export {default as Keystone} from './keystone';
|
||||||
export {default as Glance} from './glance';
|
export {default as Glance} from './glance';
|
||||||
export {default as Neutron} from './neutron';
|
export {default as Neutron} from './neutron';
|
||||||
|
export {default as OpenStack} from './openstack';
|
||||||
export default class OpenStack {
|
|
||||||
/**
|
|
||||||
* Create wrapper class that takes clouds.yaml instance
|
|
||||||
*
|
|
||||||
* @param {{}} cloudConfig The configuration object for a specific cloud.
|
|
||||||
*/
|
|
||||||
constructor(cloudConfig) {
|
|
||||||
// Sanity checks.
|
|
||||||
if (!cloudConfig) {
|
|
||||||
throw new Error('A configuration is required.');
|
|
||||||
}
|
|
||||||
// Clone the config, so that this instance is immutable
|
|
||||||
// at runtime (no modifying the config after the fact).
|
|
||||||
cloudConfig = Object.assign({}, cloudConfig);
|
|
||||||
|
|
||||||
this.cloudConfig = cloudConfig;
|
|
||||||
}
|
|
||||||
getConfig() {
|
|
||||||
// Returns the config instance
|
|
||||||
return this.cloudConfig;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -0,0 +1,22 @@
|
||||||
|
export default class OpenStack {
|
||||||
|
/**
|
||||||
|
* Create wrapper class that takes clouds.yaml instance
|
||||||
|
*
|
||||||
|
* @param {{}} cloudConfig The configuration object for a specific cloud.
|
||||||
|
*/
|
||||||
|
constructor(cloudConfig) {
|
||||||
|
// Sanity checks.
|
||||||
|
if (!cloudConfig) {
|
||||||
|
throw new Error('A configuration is required.');
|
||||||
|
}
|
||||||
|
// Clone the config, so that this instance is immutable
|
||||||
|
// at runtime (no modifying the config after the fact).
|
||||||
|
cloudConfig = Object.assign({}, cloudConfig);
|
||||||
|
|
||||||
|
this.cloudConfig = cloudConfig;
|
||||||
|
}
|
||||||
|
getConfig() {
|
||||||
|
// Returns the config instance
|
||||||
|
return this.cloudConfig;
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
import OpenStack from "../../src/index";
|
import OpenStack from "../../src/openstack";
|
||||||
import * as mockData from './helpers/data/openstack';
|
import * as mockData from './helpers/data/openstack';
|
||||||
|
|
||||||
const FetchMock = require('fetch-mock');
|
const FetchMock = require('fetch-mock');
|
Loading…
Reference in New Issue