Browse Source

Seperate OpenStack class from index.js

This commit to seperate OpenStack class from index.js to new file

Change-Id: If433040fce752e0033eb61139fd8daa9c6dbb669
Dong Ma 2 years ago
parent
commit
c5c58bcaad
3 changed files with 24 additions and 24 deletions
  1. 1
    23
      src/index.js
  2. 22
    0
      src/openstack.js
  3. 1
    1
      test/unit/openstackTest.js

+ 1
- 23
src/index.js View File

@@ -1,26 +1,4 @@
1 1
 export {default as Keystone} from './keystone';
2 2
 export {default as Glance} from './glance';
3 3
 export {default as Neutron} from './neutron';
4
-
5
-export default class OpenStack {
6
-  /**
7
-   * Create wrapper class that takes clouds.yaml instance
8
-   *
9
-   * @param {{}} cloudConfig The configuration object for a specific cloud.
10
-   */
11
-  constructor(cloudConfig) {
12
-    // Sanity checks.
13
-    if (!cloudConfig) {
14
-      throw new Error('A configuration is required.');
15
-    }
16
-    // Clone the config, so that this instance is immutable
17
-    // at runtime (no modifying the config after the fact).
18
-    cloudConfig = Object.assign({}, cloudConfig);
19
-
20
-    this.cloudConfig = cloudConfig;
21
-  }
22
-  getConfig() {
23
-    // Returns the config instance
24
-    return this.cloudConfig;
25
-  }
26
-}
4
+export {default as OpenStack} from './openstack';

+ 22
- 0
src/openstack.js View File

@@ -0,0 +1,22 @@
1
+export default class OpenStack {
2
+  /**
3
+   * Create wrapper class that takes clouds.yaml instance
4
+   *
5
+   * @param {{}} cloudConfig The configuration object for a specific cloud.
6
+   */
7
+  constructor(cloudConfig) {
8
+    // Sanity checks.
9
+    if (!cloudConfig) {
10
+      throw new Error('A configuration is required.');
11
+    }
12
+    // Clone the config, so that this instance is immutable
13
+    // at runtime (no modifying the config after the fact).
14
+    cloudConfig = Object.assign({}, cloudConfig);
15
+
16
+    this.cloudConfig = cloudConfig;
17
+  }
18
+  getConfig() {
19
+    // Returns the config instance
20
+    return this.cloudConfig;
21
+  }
22
+}

test/unit/indexTest.js → test/unit/openstackTest.js View File

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

Loading…
Cancel
Save