NAME

WWW::VastAI::API::Instances - Instance lifecycle and helper methods for Vast.ai

VERSION

version 0.001

SYNOPSIS

my $instances = $vast->instances->list;
my $instance  = $vast->instances->get($id);

my $created = $vast->instances->create(
    $offer_id,
    image   => 'nginx:alpine',
    disk    => 16,
    runtype => 'args',
);

$vast->instances->stop($created->id);
$vast->instances->delete($created->id);

DESCRIPTION

This module wraps the main Vast.ai instance APIs. It handles both the documented response style where create/update endpoints only return success or an ID, and the richer response style used in mocks or compatibility layers.

METHODS

list

Returns an arrayref of WWW::VastAI::Instance objects.

get

Fetches a single instance by ID.

create

my $instance = $vast->instances->create($offer_id, %params);

Creates an instance from a marketplace ask/offer ID. Requires either image or template_hash_id.

update

my $instance = $vast->instances->update($id, %params);

Sends an instance update and returns a refreshed object.

start

Starts the instance identified by $id.

stop

Stops the instance identified by $id.

label

Updates the instance label via update.

delete

Deletes an instance.

logs

Requests instance logs. If Vast.ai returns a result_url, this method fetches that URL and returns the decoded log content.

ssh_keys

Returns the SSH keys attached to the instance.

attach_ssh_key

Attaches a public SSH key to the instance.

detach_ssh_key

Detaches an SSH key from the instance.

SUPPORT

Issues

Please report bugs and feature requests on GitHub at https://github.com/Getty/p5-www-vastai/issues.

IRC

Join #kubernetes on irc.perl.org or message Getty directly.

CONTRIBUTING

Contributions are welcome! Please fork the repository and submit a pull request.

AUTHOR

Torsten Raudssus <torsten@raudssus.de>

COPYRIGHT AND LICENSE

This software is copyright (c) 2026 by Torsten Raudssus <torsten@raudssus.de> https://raudssus.de/.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.