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:
Dong Ma 2016-09-28 23:23:34 -07:00
parent 9677a06a2d
commit c5c58bcaad
3 changed files with 24 additions and 24 deletions

View File

@ -1,26 +1,4 @@
export {default as Keystone} from './keystone';
export {default as Glance} from './glance';
export {default as Neutron} from './neutron';
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;
}
}
export {default as OpenStack} from './openstack';

22
src/openstack.js Normal file
View File

@ -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;
}
}

View File

@ -1,4 +1,4 @@
import OpenStack from "../../src/index";
import OpenStack from "../../src/openstack";
import * as mockData from './helpers/data/openstack';
const FetchMock = require('fetch-mock');