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::Firewalls - Firewalls

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

Returns all Firewall objects.

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

create

Creates a new Firewall.

#### Call specific error codes

| Code | Description | |------------------------------ |-------------------------------------------------------------- | | `server_already_added` | Server added more than one time to resource | | `incompatible_network_type` | The Network type is incompatible for the given resource | | `firewall_resource_not_found` | The resource the Firewall should be attached to was not found |

    $cloud->firewalls->create();

delete

Deletes a Firewall.

#### Call specific error codes

| Code | Description | |--------------------- |-------------------------------------------| | `resource_in_use` | Firewall must not be in use to be deleted |

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

get

Gets a specific Firewall object.

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

put

Updates the Firewall.

Note that when updating labels, the Firewall'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.

Note: if the Firewall object changes during the request, the response will be a “conflict” error.

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

list_actions

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

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

apply_to_resources

Applies one Firewall to multiple resources.

Currently servers (public network interface) and label selectors are supported.

#### Call specific error codes

| Code | Description | |-------------------------------|---------------------------------------------------------------| | `firewall_already_applied` | Firewall was already applied on resource | | `incompatible_network_type` | The Network type is incompatible for the given resource | | `firewall_resource_not_found` | The resource the Firewall should be attached to was not found |

    $cloud->firewalls->apply_to_resources(
        id => 'test',
    );

remove_from_resources

Removes one Firewall from multiple resources.

Currently only Servers (and their public network interfaces) are supported.

#### Call specific error codes

| Code | Description | |---------------------------------------|------------------------------------------------------------------------| | `firewall_already_removed` | Firewall was already removed from the resource | | `firewall_resource_not_found` | The resource the Firewall should be attached to was not found | | `firewall_managed_by_label_selector` | Firewall was applied via label selector and cannot be removed manually |

    $cloud->firewalls->remove_from_resources(
        id => 'test',
    );

set_rules

Sets the rules of a Firewall.

All existing rules will be overwritten. Pass an empty `rules` array to remove all rules. The maximum amount of rules that can be defined is 50.

#### Call specific error codes

| Code | Description | |-------------------------------|---------------------------------------------------------------| | `firewall_resource_not_found` | The resource the Firewall should be attached to was not found |

    $cloud->firewalls->set_rules(
        id => 'test',
    );

get_actions

Returns a specific Action for a Firewall.

    $cloud->firewalls->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)