| 1 | package WWW::VastAI::Instance; | ||||||||||||
| 2 | 10 | our $VERSION = '0.001'; | |||||||||||
| 3 | # ABSTRACT: Instance wrapper with convenience lifecycle helpers | ||||||||||||
| 4 | |||||||||||||
| 5 | 10 | ▶ | use Moo; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 6 | 10 | extends 'WWW::VastAI::Object'; | |||||||||||
| 7 | |||||||||||||
| 8 | 1 | ▶ | sub label { shift->data->{label} } | ||||||||||
|
Subroutine
label: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||
| 9 | 2 | ▶ | sub actual_status { shift->data->{actual_status} } | ||||||||||
|
Subroutine
actual_status: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||
| 10 | 0 | ▶ | sub intended_status { shift->data->{intended_status} } | ||||||||||
|
Subroutine
intended_status: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||
| 11 | 0 | ▶ | sub ssh_host { shift->data->{ssh_host} } | ||||||||||
|
Subroutine
ssh_host: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||
| 12 | 1 | ▶ | sub ssh_port { shift->data->{ssh_port} } | ||||||||||
|
Subroutine
ssh_port: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||
| 13 | 0 | ▶ | sub public_ipaddr { shift->data->{public_ipaddr} } | ||||||||||
|
Subroutine
public_ipaddr: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||
| 14 | 0 | ▶ | sub gpu_name { shift->data->{gpu_name} } | ||||||||||
|
Subroutine
gpu_name: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||
| 15 | 0 | ▶ | sub num_gpus { shift->data->{num_gpus} } | ||||||||||
|
Subroutine
num_gpus: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||
| 16 | |||||||||||||
| 17 | 1 | ▶ | sub is_running { (shift->actual_status || '') eq 'running' } | ||||||||||
|
Subroutine
is_running: called CC=2 SCAR=7.6
Pod
documented
Condition50%1/2
(shift())->actual_status || ''
MC/DC0%0/1
(shift())->actual_status || ''
(shift())->actual_status
Truth table50%1/2
A
A= (shift())->actual_status
| |||||||||||||
| 18 | 0 | ▶ | sub is_stopped { (shift->actual_status || '') eq 'stopped' } | ||||||||||
|
Subroutine
is_stopped: not called CC=2 SCAR=17.9
Pod
documented
Condition0%0/2
(shift())->actual_status || ''
MC/DC0%0/1
(shift())->actual_status || ''
(shift())->actual_status
Truth table0%0/2
A
A= (shift())->actual_status
| |||||||||||||
| 19 | |||||||||||||
| 20 | 0 | ▶ | sub refresh { | ||||||||||
|
Subroutine
refresh: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||
| 21 | 0 | my ($self) = @_; | |||||||||||
| 22 | 0 | return $self->_replace_data($self->_client->instances->get($self->id)->raw); | |||||||||||
| 23 | } | ||||||||||||
| 24 | |||||||||||||
| 25 | 0 | ▶ | sub update { | ||||||||||
|
Subroutine
update: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||
| 26 | 0 | my ($self, %params) = @_; | |||||||||||
| 27 | 0 | return $self->_replace_data($self->_client->instances->update($self->id, %params)->raw); | |||||||||||
| 28 | } | ||||||||||||
| 29 | |||||||||||||
| 30 | 0 | ▶ | sub start { | ||||||||||
|
Subroutine
start: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||
| 31 | 0 | my ($self) = @_; | |||||||||||
| 32 | 0 | $self->_client->instances->start($self->id); | |||||||||||
| 33 | 0 | return $self; | |||||||||||
| 34 | } | ||||||||||||
| 35 | |||||||||||||
| 36 | 0 | ▶ | sub stop { | ||||||||||
|
Subroutine
stop: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||
| 37 | 0 | my ($self) = @_; | |||||||||||
| 38 | 0 | $self->_client->instances->stop($self->id); | |||||||||||
| 39 | 0 | return $self; | |||||||||||
| 40 | } | ||||||||||||
| 41 | |||||||||||||
| 42 | 0 | ▶ | sub set_label { | ||||||||||
|
Subroutine
set_label: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||
| 43 | 0 | my ($self, $label) = @_; | |||||||||||
| 44 | 0 | $self->_client->instances->label($self->id, $label); | |||||||||||
| 45 | 0 | $self->data->{label} = $label; | |||||||||||
| 46 | 0 | return $self; | |||||||||||
| 47 | } | ||||||||||||
| 48 | |||||||||||||
| 49 | 0 | ▶ | sub logs { | ||||||||||
|
Subroutine
logs: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||
| 50 | 0 | my ($self, %params) = @_; | |||||||||||
| 51 | 0 | return $self->_client->instances->logs($self->id, %params); | |||||||||||
| 52 | } | ||||||||||||
| 53 | |||||||||||||
| 54 | 0 | ▶ | sub ssh_keys { | ||||||||||
|
Subroutine
ssh_keys: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||
| 55 | 0 | my ($self) = @_; | |||||||||||
| 56 | 0 | return $self->_client->instances->ssh_keys($self->id); | |||||||||||
| 57 | } | ||||||||||||
| 58 | |||||||||||||
| 59 | 0 | ▶ | sub attach_ssh_key { | ||||||||||
|
Subroutine
attach_ssh_key: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||
| 60 | 0 | my ($self, $ssh_key) = @_; | |||||||||||
| 61 | 0 | return $self->_client->instances->attach_ssh_key($self->id, $ssh_key); | |||||||||||
| 62 | } | ||||||||||||
| 63 | |||||||||||||
| 64 | 0 | ▶ | sub detach_ssh_key { | ||||||||||
|
Subroutine
detach_ssh_key: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||
| 65 | 0 | my ($self, $ssh_key_id) = @_; | |||||||||||
| 66 | 0 | return $self->_client->instances->detach_ssh_key($self->id, $ssh_key_id); | |||||||||||
| 67 | } | ||||||||||||
| 68 | |||||||||||||
| 69 | 1 | ▶ | sub delete { | ||||||||||
|
Subroutine
delete: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||
| 70 | 1 | my ($self) = @_; | |||||||||||
| 71 | 1 | return $self->_client->instances->delete($self->id); | |||||||||||
| 72 | } | ||||||||||||
| 73 | |||||||||||||
| 74 | 10 | 1; | |||||||||||
| 75 | |||||||||||||
| 76 | __END__ | ||||||||||||