DigitalOcean

 view release on metacpan or  search on metacpan

lib/DigitalOcean/Image.pm  view on Meta::CPAN

);


has distribution => (
    is => 'ro',
    isa => 'Str',
);


has slug => ( 
    is => 'ro',
    isa => 'Undef|Str',
    coerce => 1,
);


has public => ( 
    is => 'ro',
    isa => 'Bool',
);


has regions => ( 
    is => 'ro',
    isa => 'ArrayRef[Str]',
    coerce => 1,
);


has min_disk_size => ( 
    is => 'ro',
    isa => 'Num',
);


has created_at => ( 
    is => 'ro',
    isa => 'Str',
);


has path => (
    is => 'rw',
    isa => 'Str',
);

sub BUILD { 
    my ($self) = @_;
    
    $self->path('images/' . $self->id . '/');
}


sub actions { 
    my ($self, $per_page) = @_;
    my $init_arr = [['DigitalOcean', $self]];
    return $self->DigitalOcean->_get_collection($self->path . 'actions', 'DigitalOcean::Action', 'actions', {per_page => $per_page}, $init_arr);
}


sub update { 
    my $self = shift;
    my (%args) = @_;

    return $self->DigitalOcean->_put_object($self->path, 'DigitalOcean::Image', 'image', \%args);
}


sub delete { 
    my ($self) = @_;
    return $self->DigitalOcean->_delete(path => $self->path);
}


sub transfer { 
    my $self = shift;
    my (%args) = @_;

    $args{type} = 'transfer';
    return $self->DigitalOcean->_post_object($self->path . 'actions', 'DigitalOcean::Action', 'action', \%args);
}


sub convert { 
    my $self = shift;
    my (%args) = @_;

    $args{type} = 'convert';
    return $self->DigitalOcean->_post_object($self->path . 'actions', 'DigitalOcean::Action', 'action', \%args);
}


sub action { 
    my ($self, $id) = @_;

    return $self->DigitalOcean->_get_object($self->path . "actions/$id", 'DigitalOcean::Action', 'action');
}


__PACKAGE__->meta->make_immutable();

1;

__END__

=pod

=encoding UTF-8

=head1 NAME

DigitalOcean::Image - Represents a Region object in the DigitalOcean API

=head1 VERSION

version 0.17

=head1 SYNOPSIS

    FILL ME IN   



( run in 0.755 second using v1.01-cache-2.11-cpan-39bf76dae61 )