Package: beam
A lightweight wrapper for the SolusVM client API.FeaturesQuery a host’s memory, bandwidth, IP addresses and storage usage.Boot, reboot and shutdown machines.Configurable to work with any SolusVM provider.Command line client and intuitive Python module for your own scripts.SetupRunpip install beamto download the module.Create your.beam.iniinventory file as below.InventoryThe inventory file holds information about your hosting provider(s) and host(s),
so beam knows how to contact the relevant API endpoints and what credentials to
use. Here’s a sample file:[special:vendors]
ramnode = https://vpscp.ramnode.com
vendor2 = https://vendor2-panel.com
default = ramnode

[nyc-1]
key = nyc-1_host_key
hash = nyc-1_host_hash

[ams-1]
key = ams-1_host_key
hash = ams-1_host_hash
vendor = vendor2This file defines two hosts,nyc-1, hosted with RamNode, andams-1,
hosted with FlipHost. At the top are the vendor names in a special vendors
section (all other sections are assumed to represent hosts). The format maps a
vendor name to their base endpoint for the SolusVM API. Thedefaultdirective indicates the implicit vendor of every host, and must be specified if
more than one vendor is defined.Each host has its own section. The correctkeyandhashvalues can be
optained from the SolusVM control panel used by your vendor. If a host is not
provided by the default vendor, avendordirective specifies the correct
one.UsageBeam provides both a Python library for programmatic access to your hosts, and
a simple CLI that wraps it in a couple of lines of code.CLIThe CLI client can be used to find information about a single host.$ beam --help
usage: beam [-h] [-V]
            (-A {boot,reboot,shutdown} | -a ATTRIBUTES [ATTRIBUTES ...])
            [host]

A lightweight wrapper for the SolusVM client API.

positional arguments:
  host                  the identifier of the host whose information to
                        retrieve

optional arguments:
  -h, --help            show this help message and exit
  -V, --version         show program's version number and exit
  -A {boot,reboot,shutdown}, --action {boot,reboot,shutdown}
                        an action to execute against the host
  -a ATTRIBUTES [ATTRIBUTES ...], --attributes ATTRIBUTES [ATTRIBUTES ...]
                        one or more attributes of the host to retrieve
$ beam -a bandwidth.free_percentage nyc-1
0.4983459835
$ beam -a primary_ip lon-1
2604:180:2:32b::498b
$ beam -a is_online memory.used_bytes ams-1
True
34578234983
$ beam -A shutdown nyc-1
OKLibraryimportbeam# shutdown a specific hosthost=beam.host('nyc-1')# name, key or hashifhost.is_online:host.shutdown()# boot all offline hosts[host.boot()forhostinbeam.hosts()ifnothost.is_online]# get a list of hosts using above 90% of their memoryhosts=[hostforhostinbeam.hosts()ifhost.memory.used_percentage>.9]# get a list of hosts with less than 10 GiB of storage lefthosts=[hostforhostinbeam.hosts()ifhost.storage.free_bytes<1024**3*10]RoadmapGenerate documentation.Increase unit test coverage to 100%, and implement some integration tests.EtymologyAlthough “solus” means alone, that’s a tad depressing. Solus also conjures up
images of the sun for me. The sunbeams down - and the name was available on
PyPI - so beam it was.