virtualizorjs 1.0.4 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CONTRIBUTING.md DELETED
@@ -1,92 +0,0 @@
1
-
2
- # Contributing to VirtualizorJS
3
-
4
- Welcome to VirtualizorJS! We appreciate your interest in contributing to our project. By contributing, you help make VirtualizorJS better for everyone. Please take a moment to review this document before getting started.
5
-
6
- ## Table of Contents
7
-
8
- 1. [Code of Conduct](#code-of-conduct)
9
- 2. [How Can I Contribute?](#how-can-i-contribute)
10
- 3. [Getting Started](#getting-started)
11
- - [Fork the Repository](#fork-the-repository)
12
- - [Clone the Repository](#clone-the-repository)
13
- - [Install Dependencies](#install-dependencies)
14
- - [Make Changes](#make-changes)
15
- - [Test Your Changes](#test-your-changes)
16
- 4. [Submitting a Pull Request](#submitting-a-pull-request)
17
- 5. [Code of Conduct](#code-of-conduct)
18
- 6. [License](#license)
19
-
20
- ## Code of Conduct
21
-
22
- Please review our [Code of Conduct](CODE_OF_CONDUCT.md) to understand the standards and expectations for all contributors.
23
-
24
- ## How Can I Contribute?
25
-
26
- ### Reporting Bugs
27
-
28
- If you encounter a bug, please [open an issue](../../issues) and provide as much detail as possible.
29
-
30
- ### Suggesting Enhancements
31
-
32
- Have an idea to enhance VirtualizorJS? Feel free to [open an issue](../../issues) with your suggestion, or even better, submit a pull request.
33
-
34
- ### Pull Requests
35
-
36
- We welcome contributions! Before submitting a pull request, please ensure:
37
-
38
- - Your code adheres to the existing coding style.
39
- - You have documented any new features or changes.
40
-
41
- ## Getting Started
42
-
43
- ### Fork the Repository
44
-
45
- Click on the "Fork" button at the top right of the repository page to create your copy.
46
-
47
- ### Clone the Repository
48
-
49
- Clone your forked repository to your local machine:
50
-
51
- ```bash
52
- git clone https://github.com/kkMihai/virtualizorjs.git
53
- ```
54
-
55
- ### Install Dependencies
56
-
57
- Navigate to the project directory and install dependencies:
58
-
59
- ```bash
60
- cd virtualizorjs
61
- npm install
62
- ```
63
-
64
- ### Make Changes
65
-
66
- Make your changes and add new features or fix bugs.
67
-
68
- ### Test Your Changes
69
-
70
- Ensure that your changes don't introduce new issues. Run tests and fix any failures:
71
-
72
- ```bash
73
- npm test
74
- ```
75
-
76
- ## Submitting a Pull Request
77
-
78
- When you're ready to submit your changes:
79
-
80
- 1. Commit your changes: `git commit -m "Your commit message"`
81
- 2. Push to your fork: `git push origin your-branch`
82
- 3. Open a pull request from your fork to the `main` branch of the original repository.
83
-
84
- Our team will review your pull request and provide feedback. Thank you for contributing to VirtualizorJS!
85
-
86
- ## Code of Conduct
87
-
88
- Please follow our [Code of Conduct](CODE_OF_CONDUCT.md) in all interactions.
89
-
90
- ## License
91
-
92
- By contributing to VirtualizorJS, you agree that your contributions will be licensed under the [MIT License](LICENSE).
package/SECURITY.md DELETED
@@ -1,26 +0,0 @@
1
- # Security Policy
2
-
3
- ## Supported Versions
4
-
5
- | Version | Supported |
6
- | ------- | ------------------ |
7
- | 1.0.1 | ✅ |
8
- | 1.0.0-beta | ❌ |
9
-
10
- ## Reporting a Vulnerability
11
-
12
- If you discover any security issues within the project, please report them by following these guidelines:
13
-
14
- 1. **Go to the Issues section:** Visit [GitHub Issues](https://github.com/kkMihai/virtualizorjs/issues) to check if the vulnerability has already been reported or discussed.
15
-
16
- 2. **Open a New Issue:** If the vulnerability is not reported, please open a new issue.
17
-
18
- 3. **Provide Details:** Clearly describe the nature of the vulnerability, including steps to reproduce if possible. The more information you provide, the easier it is for us to understand and address the issue.
19
-
20
- 4. **Expectations:** We will acknowledge your report within a reasonable timeframe and strive to keep you informed of the progress.
21
-
22
- 5. **Resolution:** Once the vulnerability is validated, we will work on resolving it. The timeline for resolution may vary based on the severity of the issue.
23
-
24
- Please note that this security policy applies to supported versions. Ensure you are using a supported version before reporting any vulnerabilities.
25
-
26
- Thank you for helping us keep VirtualizorJS secure!
@@ -1,33 +0,0 @@
1
- const VirtualizorClient = require("virtualizorjs");
2
-
3
- const { CreateVPS } = new VirtualizorClient({
4
- host: "< IP or Hostname of Virtualizor Server >",
5
- port: 4085, // Default port for Virtualizor API
6
- adminapikey: "< Your API KEY >",
7
- adminapipass: "< Your API PASS >",
8
- });
9
-
10
- async function exampleUsage() {
11
- try {
12
- const vps = await CreateVPS({
13
- virtualizationType: "kvm",
14
- nodeSelection: "node1",
15
- userEmail: "user@example.com",
16
- userPassword: "password",
17
- serverHostname: "serverhostname",
18
- rootPassword: "password",
19
- osId: "222",
20
- ipAddress: "188.0.0.0",
21
- storageSpace: "10", // GB
22
- serverRam: "1024", // MB
23
- bandwidthLimit: "1000", // GB | 0 for unlimited
24
- cpuCores: "1",
25
- });
26
-
27
- console.log(vps); // Output: { time_taken: 0.022, ... }
28
- } catch (error) {
29
- console.error("Error:", error);
30
- }
31
- }
32
-
33
- exampleUsage();
@@ -1,36 +0,0 @@
1
- const VirtualizorClient = require('virtualizorjs');
2
-
3
- const Client = new VirtualizorClient({
4
- host: '< IP or Hostname of Virtualizor Server >',
5
- port: 4085,
6
- adminapikey: "< Your API KEY >",
7
- adminapipass: "< Your API PASS >",
8
- });
9
-
10
- const { StartVPS } = Client;
11
-
12
- StartVPS(1);
13
-
14
- // Event listener for when a virtual server is created
15
- Client.on('vpsCreated', (response) => {
16
- console.log(`Virtual Server Created! Details:`, response);
17
- // Output: Virtual Server Created! Details: { ...virtualizorResponse }
18
- });
19
-
20
- // Event listener for when a virtual server is started
21
- Client.on('vpsStarted', (response) => {
22
- console.log(`Virtual Server Started! Details:`, response);
23
- // Output: Virtual Server Started! Details: { ...virtualizorResponse }
24
- });
25
-
26
- // Event listener for when a virtual server is stopped
27
- Client.on('vpsStopped', (response) => {
28
- console.log(`Virtual Server Stopped! Details:`, response);
29
- // Output: Virtual Server Stopped! Details: { ...virtualizorResponse }
30
- });
31
-
32
- // Event listener for when a virtual server is restarted
33
- Client.on('vpsRestarted', (response) => {
34
- console.log(`Virtual Server Restarted! Details:`, response);
35
- // Output: Virtual Server Restarted! Details: { ...virtualizorResponse }
36
- });
@@ -1,117 +0,0 @@
1
- const VirtualizorClient = require("virtualizorjs");
2
-
3
- const { ListVPS } = new VirtualizorClient({
4
- host: "< IP or Hostname of Virtualizor Server >",
5
- port: 4085, // Default port for Virtualizor API
6
- adminapikey: "< Your API KEY >",
7
- adminapipass: "< Your API PASS >",
8
- });
9
-
10
- async function exampleUsage() {
11
- try {
12
- const vpsList = await ListVPS();
13
- console.log(vpsList);
14
- //Output:
15
- // {
16
- // "37": {
17
- // "vpsid": "37",
18
- // "vps_name": "v1001",
19
- // "uuid": "mark7ygoeqtfdf72",
20
- // "serid": 0,
21
- // "time": "1534260671",
22
- // "edittime": "1534499180",
23
- // "virt": "kvm",
24
- // "uid": "55",
25
- // "plid": "1",
26
- // "hostname": "www.mydomainff.com",
27
- // "osid": "270",
28
- // "os_name": "centos-6.5-x86",
29
- // "iso": "",
30
- // "sec_iso": "",
31
- // "boot": "cda",
32
- // "space": "2",
33
- // "inodes": "0",
34
- // "ram": "128",
35
- // "burst": "0",
36
- // "swap": "128",
37
- // "cpu": "1000",
38
- // "cores": "1",
39
- // "cpupin": "-1",
40
- // "cpu_percent": "0.00",
41
- // "bandwidth": "1",
42
- // "network_speed": "0",
43
- // "upload_speed": "-1",
44
- // "io": "0",
45
- // "ubc": "a:0:{}",
46
- // "acpi": "1",
47
- // "apic": "1",
48
- // "pae": "1",
49
- // "shadow": "0",
50
- // "vnc": "1",
51
- // "vncport": "5901",
52
- // "vnc_passwd": "",
53
- // "hvm": "0",
54
- // "suspended": "0",
55
- // "suspend_reason": null,
56
- // "nw_suspended": null,
57
- // "rescue": "0",
58
- // "band_suspend": "0",
59
- // "tuntap": "0",
60
- // "ppp": "0",
61
- // "ploop": "0",
62
- // "dns_nameserver": "a:0:{}",
63
- // "osreinstall_limit": "0",
64
- // "preferences": null,
65
- // "nic_type": "virtio",
66
- // "vif_type": "",
67
- // "virtio": "0",
68
- // "pv_on_hvm": "0",
69
- // "disks": null,
70
- // "kvm_cache": "0",
71
- // "io_mode": "0",
72
- // "cpu_mode": "default",
73
- // "total_iops_sec": "0",
74
- // "read_bytes_sec": "0",
75
- // "write_bytes_sec": "0",
76
- // "kvm_vga": "0",
77
- // "acceleration": "0",
78
- // "vnc_keymap": "en-us",
79
- // "routing": "0",
80
- // "mg": "",
81
- // "used_bandwidth": "0.01",
82
- // "cached_disk": "a:2:{s:4:\"disk\";a:3:{s:4:\"Used\";i:776044;s:9:\"Available\";i:1190036;s:4:\"Use%\";d:39.469999999999998863131622783839702606201171875;}s:5:\"inode\";a:4:{s:6:\"Inodes\";i:122880;s:5:\"IUsed\";i:21323;s:5:\"IFree\";i:101557;s:4:\"Use%\";d:17.35000000000000142108547152020037174224853515625;}}",
83
- // "webuzo": "0",
84
- // "disable_ebtables": "0",
85
- // "install_xentools": "0",
86
- // "admin_managed": "0",
87
- // "rdp": "0",
88
- // "topology_sockets": "0",
89
- // "topology_cores": "0",
90
- // "topology_threads": "0",
91
- // "mac": "00:16:3e:5f:cd:48",
92
- // "notes": null,
93
- // "disable_nw_config": "0",
94
- // "locked": "",
95
- // "openvz_features": "",
96
- // "speed_cap": "",
97
- // "numa": "0",
98
- // "bpid": "0",
99
- // "bserid": "0",
100
- // "timezone": null,
101
- // "usbdevice": "",
102
- // "server_name": "localhost",
103
- // "email": "tt@rrr.com",
104
- // "pid": "0",
105
- // "type": "0",
106
- // "os_distro": "centos",
107
- // "ips": {
108
- // "2": "8.8.8.1"
109
- // }
110
- // }
111
- // }
112
- } catch (error) {
113
- console.error("Error:", error);
114
- }
115
- }
116
-
117
- exampleUsage();
package/src/Actions.js DELETED
@@ -1,79 +0,0 @@
1
- /**
2
- * @description Actions that can be performed on the server. Made available as an enum incase the API changes.
3
- * @enum {string}
4
- * @readonly
5
- */
6
- module.exports = {
7
- /**
8
- * Action to add a new virtual private server (VPS).
9
- * @type {string}
10
- */
11
- AddVPS: "addvs",
12
-
13
- /**
14
- * Action to manage a VPS.
15
- * @type {string}
16
- */
17
- VPSManage: "vpsmanage",
18
-
19
- /**
20
- * Action to get a VPS Info
21
- * @type {string}
22
- */
23
- GetVPS: "vs",
24
-
25
- /**
26
- * Action to list all VPS.
27
- * @type {string}
28
- */
29
- ListVPS: "listvs",
30
-
31
- /**
32
- * Action to start a VPS.
33
- * @type {string}
34
- */
35
- StartVPS: "start",
36
-
37
- /**
38
- * Action to stop a VPS.
39
- * @type {string}
40
- */
41
- StopVPS: "stop",
42
-
43
- /**
44
- * Action to restart a VPS.
45
- * @type {string}
46
- */
47
- RestartVPS: "restart",
48
-
49
- /**
50
- * Action to get VPS RAM information.
51
- * @type {string}
52
- */
53
- GetVPSRam: "ram",
54
-
55
- /**
56
- * Action to get VPS CPU information.
57
- * @type {string}
58
- */
59
- GetVPSCPU: "cpu",
60
-
61
- /**
62
- * Action to get VPS disk information.
63
- * @type {string}
64
- */
65
- GetVPSDisk: "disk",
66
-
67
- /**
68
- * Action to get Server Bandwidth information.
69
- * @type {string}
70
- */
71
- GetServerBandwidth: "bandwidth",
72
-
73
- /**
74
- * Action to get VPS Bandwidth information.
75
- * @type {string}
76
- */
77
-
78
- GetPlans: "plans",
79
- };