Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
dqos committed Feb 24, 2022
2 parents 1d8e8f4 + 3b627f5 commit 00077e2
Show file tree
Hide file tree
Showing 28 changed files with 97,572 additions and 82 deletions.
15 changes: 8 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
# NovoServe WHMCS Console Module
# NovoServe WHMCS Module

### Introduction

This provisioning module allows you as a reseller to offer IPMI console links (SSO).
WIth just one click they will be automatically logged in. Currently, this is the core functionality of this module.
For the admin convenience we also added the login ability from the WHMCS admin side, this allows you to quickly access the IPMI of your customer.
This provisioning module allows you as a reseller to offer your customers full server management.
With just one click they are able to login to the IPMI of the server (e.g. HPE iLO). This feature is also available as an administrator.

Current features:
Features:
- Autologin IPMI for the clientarea;
- Autologin IPMI for the admin side;
- Whitelabel console URL generation;
- Server power management;
- Bandwidth usage graph.

### Requirements
- WHMCS 7.x or 8.x;
Expand All @@ -20,8 +21,8 @@ Current features:

1. Upload the contents of the ZIP into your WHMCS root directory.
2. Setup a new or use an existing Product:
3. Under Module Settings, select the "NovoServe Console Module".
4. Now enter your API credentials accordingly and decide if you want whitelabel consoles (without any logo), or the default NovoServe branded.
3. Under Module Settings, select the "NovoServe Module".
4. Now enter your API credentials accordingly and decide if you want whitelabel consoles (without any logo), or the default NovoServe branded. If you want to use the whitelabel console then enter "yes" in the textbox. For resellers with the branded console can also use their ID here.
5. Go to a service that uses this (newly) product and ensure that the Username contains a server tag (000-000). This is a requirement.

Note: Ensure that you added the IP address of your WHMCS instance to the API ACL in our portal.
Expand Down
12 changes: 12 additions & 0 deletions modules/servers/novoserve/composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"require": {
"php": ">=7.4",
"ext-curl": "*",
"ext-json": "*"
},
"autoload": {
"classmap": [
"libs"
]
}
}
22 changes: 22 additions & 0 deletions modules/servers/novoserve/composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
on:
push:
branches:
- main
jobs:
test_code:
runs-on: ubuntu-latest
name: run unit tests
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Run PHPunit tests
run: cd tests; mkdir output; XDEBUG_MODE=coverage ./phpunit --configuration phpunit.xml --coverage-html output
- name: create results artefact
uses: actions/upload-artifact@v2
with:
name: test coverage results
path: tests/output/
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/.idea
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?php

namespace NovoServe\Cloudrack\Types;

class AssetTag
{
/**
* Asset Tag
* @var string
*/
private $assetTag;

/**
* ISO-3166 Country Codes
* @link https://en.wikipedia.org/wiki/ISO_3166
* @var string[]
*/
private $countryCodes = ['NL', 'DE', 'US', 'DEV'];

/**
* Validates the asset tag and throws an error if incorrect.
*
* @param string $assetTag The asset tag to validate.
* @throws InvalidAssetTagException | InvalidAssetTagLocationException
*/
public function __construct(string $assetTag = '')
{
if (!preg_match('/^((([a-zA-Z]{2,3})-\d{3}-\d{3})|(\d{3}-\d{3}))$/', $assetTag, $pregMatch)) {
throw new InvalidAssetTagException('Invalid asset tag.');
}
if (!empty($pregMatch[3]) && !in_array($pregMatch[3], $this->countryCodes)) {
throw new InvalidAssetTagLocationException('Invalid asset tag location.');
}
$this->assetTag = $assetTag;
}

/**
* Returns the actual string containing the (validated) asset tag.
*
* @return string
*/
public function __toString(): string
{
return $this->assetTag;
}
}

class ServerTag extends AssetTag {}
class InvalidAssetTagException extends \Exception {}
class InvalidAssetTagLocationException extends \Exception {}
11 changes: 11 additions & 0 deletions modules/servers/novoserve/libs/cloudrack-type-assettag/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# cloudrack-type-assettag

Data type for AssetTag. Supports the following formats:
```
123-123
NL-123-123
DEV-123-123
```

The prefixes are based on ISO-3166 country codes (except DEV):
https://en.wikipedia.org/wiki/ISO_3166
Loading

0 comments on commit 00077e2

Please sign in to comment.