The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

VM::HetznerCloud::API::Volumes - Volumes

VERSION

version 0.0.3

SYNOPSIS

    use VM::HetznerCloud;

    my $api_key = '1234abc';
    my $cloud   = VM::HetznerCloud->new(
        token => $api_key,
    );

    $cloud->records->create(
    );

ATTRIBUTES

  • endpoint

METHODS

list

Gets all existing Volumes that you have available.

    $cloud->volumes->list(
        label_selector => 'test',
        name => 'test',
        sort => 'test',
        status => 'test',
    );

create

Creates a new Volume attached to a Server. If you want to create a Volume that is not attached to a Server, you need to provide the `location` key instead of `server`. This can be either the ID or the name of the Location this Volume will be created in. Note that a Volume can be attached to a Server only in the same Location as the Volume itself.

Specifying the Server during Volume creation will automatically attach the Volume to that Server after it has been initialized. In that case, the `next_actions` key in the response is an array which contains a single `attach_volume` action.

The minimum Volume size is 10GB and the maximum size is 10TB (10240GB).

A volume’s name can consist of alphanumeric characters, dashes, underscores, and dots, but has to start and end with an alphanumeric character. The total length is limited to 64 characters. Volume names must be unique per Project.

#### Call specific error codes

| Code | Description | |-------------------------------------|-----------------------------------------------------| | `no_space_left_in_location` | There is no volume space left in the given location |

    $cloud->volumes->create();

delete

Deletes a volume. All Volume data is irreversibly destroyed. The Volume must not be attached to a Server and it must not have delete protection enabled.

    $cloud->volumes->delete(
        id => 'test',
    );

get

Gets a specific Volume object.

    $cloud->volumes->get(
        id => 'test',
    );

put

Updates the Volume properties.

Note that when updating labels, the volume’s current set of labels will be replaced with the labels provided in the request body. So, for example, if you want to add a new label, you have to provide all existing labels plus the new label in the request body.

    $cloud->volumes->put(
        id => 'test',
    );

list_actions

Returns all Action objects for a Volume. You can `sort` the results by using the sort URI parameter, and filter them with the `status` parameter.

    $cloud->volumes->list_actions(
        id => 'test',
        sort => 'test',
        status => 'test',
    );

attach

Attaches a Volume to a Server. Works only if the Server is in the same Location as the Volume.

    $cloud->volumes->attach(
        id => 'test',
    );

change_protection

Changes the protection configuration of a Volume.

    $cloud->volumes->change_protection(
        id => 'test',
    );

detach

Detaches a Volume from the Server it’s attached to. You may attach it to a Server again at a later time.

    $cloud->volumes->detach(
        id => 'test',
    );

resize

Changes the size of a Volume. Note that downsizing a Volume is not possible.

    $cloud->volumes->resize(
        id => 'test',
    );

get_actions

Returns a specific Action for a Volume.

    $cloud->volumes->get_actions(
        action_id => 'test',
        id => 'test',
    );

AUTHOR

Renee Baecker <reneeb@cpan.org>

COPYRIGHT AND LICENSE

This software is Copyright (c) 2018 by Renee Baecker.

This is free software, licensed under:

  The Artistic License 2.0 (GPL Compatible)