NAME
SolusVM::Client::Specification - The SolusVM 2 API, distilled out of its OpenAPI document
VERSION
version 0.001
SYNOPSIS
my $spec = SolusVM::Client::Specification::load();
print $spec->{get_list_of_servers}{method}, "\n"; # GET
print $spec->{get_list_of_servers}{uri}, "\n"; # /servers
DESCRIPTION
SolusVM publishes an OpenAPI 3.0 document describing the 309 operations of its version 2 API. This module carries a distillation of it -- everything SolusVM::Client needs in order to turn an operation into an HTTP request, and nothing else -- so that a client can be built out of the vendor's own description of the API rather than out of a hand-written list that goes stale.
The distillation is baked into this file, so nothing reaches the network at runtime. "fetch" is how it gets regenerated when SolusVM ships new endpoints.
FUNCTIONS
load
Returns the spec as a hashref keyed on operation name, each value a hashref of:
name-- the perl method name, as "operation_name" derived itoperation_id-- theoperationIdit came from, to find the operation in the published referencemethod-- the HTTP verb, upper caseuri-- the path below the API prefix,{id}placeholders and allpath_params-- the placeholder names inuri, in the order they appearquery_params-- the query parameter names the operation declaresbody_params-- the body property names it declares, andrequiredthe subset it insists onhas_body-- whether the operation takes a request bodytag,summary-- the grouping and the one-line description, for "catalog" in SolusVM::Client
Takes an optional file => $path naming a distilled spec written by "fetch", for running against an API newer than this release.
The result is memoised for the life of the process, keyed on that path. A spec file that changes underneath a running program is not a case worth serving; call it again with a different path to get a different spec.
distil
Takes the decoded OpenAPI document and returns the arrayref of entries described in "load". Kept apart from "fetch" so that what the client believes about an API can be tested against a document without fetching one.
operation_name
Turns an operationId into a perl method name: lower cased, with every run of characters that cannot appear in an identifier collapsed to a single underscore.
The result is clumsy -- create_a_new_server, get_an_existing_api_token -- and deliberately so. It derives in both directions, so a name in your code can be found in SolusVM's published reference by eye, and an operation added to a future spec arrives named without anybody having to decide anything.
Thirteen operations have no name to derive one from. SolusVM's document gives them a 32 character hex digest where the operationId should be -- the whole of License, Search, Usage and Server Batch Actions -- and one of those digests begins with a digit, which perl will not accept as a method name at all. For those the name is built out of the verb and the path instead, so POST /servers/start becomes post_servers_start. Pass $method and $uri so that it can be.
fetch
Downloads the OpenAPI document, distils it, and writes the result as JSON into dir => $dir as solusvm2.json. Returns the path it wrote, or undef when there was nothing to do.
Options are dir (required), url (defaulting to $SolusVM::Client::Specification::SPEC_URL), once to skip the download when the file is already there and the server reports nothing newer, and ua to hand it your own HTTP::Tiny.
This is on no runtime path. It exists to regenerate the baked-in spec, and to let somebody run against an API newer than this release without waiting for one:
perl -MSolusVM::Client::Specification -e 'SolusVM::Client::Specification::fetch( dir => "." )'
The URL it defaults to is the one the published reference at https://docs.solusvm.com/en/solusvm2/api-reference/api/ loads its document from, and it lives on a vendor development host. Expect to need url one day.
SEE ALSO
Please see those modules/websites for more information related to this module.
BUGS
Please report any bugs or feature requests on the bugtracker website https://github.com/Troglodyne-Internet-Widgets/perl-solusvm-client/issues
When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.
AUTHORS
Current Maintainers:
George S. Baugh <george@troglodyne.net>
COPYRIGHT AND LICENSE
Copyright (c) 2026 Troglodyne LLC
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.