Network Interface¶
Entity¶
Network Interface¶
Interface resource:
Field |
Explanation |
---|---|
id |
interface identifier |
label |
interface label |
network_id |
network id |
vlan |
vlan |
primary |
is primary |
rate_limit |
interface rate limitation |
status |
interface status |
virtual_machine_id |
virtual machine identifier |
default_firewall_policy |
default firewall policy |
mac_address |
mac address |
Interface_list resource:
[interface resource 1, interface resource 2, …]
Operations¶
Create Interface¶
Get Interfaces from Virtual Machine¶
Delete network interface¶
- Method
DELETE
- Url
/account/<account_id>/network_interface/<interface_id>
- Success Code
204/202
- Returned Data
No data returned
- Has Token
Yes
Remove a network interface. This will also eliminate other resources that rely on it.
Curl examples¶
How to list IP addresses from a network interface to obtain the IPADDRESS_ID x.x.x.x
:
List ip addresses
curl -i -X GET "https://api.gigas.com/account/ACCOUNT_ID/ip_addresses?ip=x.x.x.x" -H "Authorization: $TOKEN" -H "Content-Type: application/json"
How to Unassign an IP address from an interface (note: If there is only one IP address attached to the interface, such unassignment means automatically remove the network interface too): Delete ip from interface
curl -i -X DELETE https://api.gigas.com/account/ACCOUNT_ID/network_interface/INTERFACE_ID/ip_address/IPADDRESS_ID -H "Authorization: $TOKEN" -H "Content-Type: application/json"
How to delete a network interface:
curl -i -X DELETE https://api.gigas.com/account/ACCOUNT_ID/network_interface/INTERFACE_ID -H "Authorization: $TOKEN" -H "Content-Type: application/json"
Edit network interface¶
- Method
PUT
- Url
/account/<account_id>/network_interface/<interface_id>
- Success Code
200/202
- Returned Data
- Has Token
Yes
Change the network interface resources.
Parameters:
label: give the label of a network interface you wish to attach
network_id: set the ID of a physical network used to attach this network interface
primary: set 1 if the interface is primary
rate_limit: set max port speed in Mb, 0 for unlimited.
default_firewall_policy: (‘ACCEPT’, ‘DROP’)
mac_address: new MAC to config the network interface
Set default policy¶
- Method
PUT
- Url
/account/<account_id>/network_interface/<interface_id>
- Success Code
200
- Returned Data
- Has Token
No
Define the default firewall rule on the interface, accept to permit all traffic or drop to deny it. Any other firewall rules will take precedence over this.
Mandatory parameters:
default_firewall_policy
Get network interface¶
- Method
GET
- Url
/account/<account_id>/network_interface/<interface_id>
- Success Code
Success return Code: 200
- Returned Data
- Has Token
No
Get a network interface resource given it’s id.
List network interfaces¶
- Method
GET
- Url
/account/<account_id>/network_interfaces
- Success Code
200
- Returned Data
- Has Token
No
List user’s network interfaces.
Filters:
virtual_machine_id
network_id
public
interface_label
Add ip to interface¶
- Method
POST
- Url
/account/<account_id>/network_interface/<interface_id>/ip_address
- Success Code
200/202
- Returned Data
- Has Token
Yes
Assing an ip to a network interface. If an ip address has been reserved previously, here can be attached to the interface.
Optional parameters:
ip_address_id
Curl example¶
curl -i -X POST https://api.gigas.com/account/ACCOUNT_ID/network_interface/INTERFACE_ID/ip_address -H "Authorization: $TOKEN" -H "Content-Type: application/json"
Note
if no IP address id is specified, it’ll generate a new ip address
Note
if parameter ip_address_id is present, ip address must be prereserved
Delete ip from interface¶
- Method
DELETE
- Url
/account/<account_id>/network_interface/<interface_id>/ip_address/<ip_address_id>
- Success Code
204
- Returned Data
No data returned
- Has Token
No
Remove the ip from the interface.
List interface firewall rules¶
- Method
GET
- Url
/account/<account_id>/network_interface/<interface_id>/firewall_rules
- Success Code
200
- Returned Data
- Has Token
No
Get firewall configuration for the target interface
Curl example¶
curl -i -X GET https://api.gigas.com/account/ACCOUNT_ID/network_interface/INTERFACE_ID/firewall_rules -H "Authorization: $TOKEN" -H "Content-Type: application/json"
Create rule¶
- Method
POST
- Url
/account/<account_id>/network_interface/<interface_id>/firewall_rule
- Success Code
201
- Returned Data
- Has Token
No
Create a firewall rule to filter traffic.
Mandatory Parameters :
command: ACCEPT or DROP packet matching the rule.
protocol: TCP or UDP.
Optional Parameters:
address: ip address o ip address/mask o range. Empty or 0.0.0.0 for full access.
port: Empty for any port, can be separated by commas for a list or by colon for a range.
description: Description of the rule.
Curl example¶
curl -i -X POST https://api.gigas.com/account/ACCOUNT_ID/network_interface/INTERFACE_ID/firewall_rule -d '{ "command": "ACCEPT|DROP", "protocol": "TCP|UDP", "address": "x.x.x.x", "port": "NNNN"}' -H "Authorization: $TOKEN" -H "Content-Type: application/json"