Laravel Forge JavaScript SDK

Firewall Rules

Firewall Rules

Create a rule

Method

forge.firewallRules.create(server_id, payload)

Usage

1const forge = new Forge('API_TOKEN');
2
3const rule = await forge.firewallRules.create(server_id, payload);

Payload

1{
2 name: 'rule name',
3 ip_address: '192.168.1.1',
4 port: 88,
5 type: 'allow'
6}

Payload Parameters

KeyDescription
nameThe name of the new firewall rule.
ip_addressThe ip address to either allow or deny.
portThe port that the rule should apply to.
typeYou may specify allow or deny as the rule type.

Example Response

1{
2 "rule": {
3 "id": 4,
4 "name": "rule",
5 "port": 123,
6 "type": "allow",
7 "ip_address": null,
8 "status": "installing",
9 "created_at": "2016-12-16 15:50:17"
10 }
11}

List firewall rules

Method

forge.firewallRules.list(server_id)

Usage

1const forge = new Forge('API_TOKEN');
2
3const rules = await forge.firewallRules.list(server_id);

Example Response

1{
2 "rules": [
3 {
4 "id": 4,
5 "name": "rule",
6 "port": 123,
7 "type": "allow",
8 "ip_address": null,
9 "status": "installing",
10 "created_at": "2016-12-16 15:50:17"
11 }
12 ]
13}

Get a firewall rule

Method

forge.firewallRules.get(server_id, rule_id)

Usage

1const forge = new Forge('API_TOKEN');
2
3const rule = await forge.firewallRules.get(server_id, rule_id);

Example Response

1{
2 "rule": {
3 "id": 4,
4 "name": "rule",
5 "port": 123,
6 "type": "allow",
7 "ip_address": null,
8 "status": "installing",
9 "created_at": "2016-12-16 15:50:17"
10 }
11}

Delete a firewall rule

Method

forge.firewallRules.delete(server_id, rule_id)

Usage

1const forge = new Forge('API_TOKEN');
2
3await forge.firewallRules.delete(server_id, rule_id);

Edit this page on GitHub