Skip to content

[FEATURE] Add hapi vps vm purchase for API-created VPS workflows #31

@coygeek

Description

@coygeek

Feature Description

Please add a CLI command for the VPS purchase endpoint:

POST /api/vps/v1/virtual-machines

The OpenAPI operation is VPS_purchaseNewVirtualMachineV1, and the generated Go client already contains VPSPurchaseNewVirtualMachineV1.

Problem Statement

The CLI can list, inspect, start, stop, recreate, and modify virtual machines, but it does not appear to expose a command for purchasing a new VPS.

This creates an awkward gap for automation and agentic workflows:

  1. Use the CLI to discover templates and data centers.
  2. Use manual/dashboard or custom API code to purchase a VPS.
  3. Return to the CLI for list/status/stop operations.

For automated lifecycle flows, purchase should be available through the same official CLI surface.

Proposed Solution

Add a command similar to:

hapi vps vm purchase \
  --item-id hostingercom-vps-kvm2-usd-1m \
  --template-id 1130 \
  --data-center-id 19 \
  --hostname example-agent-runner \
  --public-key-name example-agent-key \
  --public-key "ssh-ed25519 AAAA..." \
  --enable-backups=false \
  --format json

Optional flags could include:

  • --payment-method-id
  • --coupon
  • --password
  • --post-install-script-id
  • --install-monarx
  • --ns1
  • --ns2

Use Cases

  • Create short-lived VPS instances from scripts.
  • Run repeatable integration and smoke tests against newly provisioned infrastructure.
  • Build agentic workflows that can provision, inspect, use, and stop VPSs without switching to the dashboard.
  • Capture the returned order.id, order.subscription_id, and virtual_machine.id in JSON for later cleanup and billing reconciliation.

Additional Context

The API purchase response schema already returns a Billing.V1.Order.VirtualMachineOrderResource containing both order and virtual_machine, which is a good shape for automation. Exposing this through the CLI would make the official tool much more complete.

Are you willing to contribute?

  • Yes, I'd like to implement this feature
  • Yes, but I need guidance
  • No, but I'm available for testing
  • No

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions