REST - Groups and firewall

Listing groups

Request

GET /v2/groups

Returns an array with the list of existing groups.

Response

{
  "groups": [
    {
      "id":"$group_id",
      "name":"$group_name",
      "owner":{
        "id":"$owner_id",
        "name":"$owner_name"
      },
      "members":[

      ],
      "virtual_machines":[

      ],
      "permisions":{
        "global":[

        ],
        "vm":[

        ]
      },
      "resources": [
        {
          "id": "$uid",
          "type": "$type",
          "label": "$label"
        }
      ],
      "rules": [
        {
          // fields are returned only if they have a value other than null
          "id": "$rule_id",
          "direction": "$direction",
          "src_address": "$src_address",
          "dst_address": "$dst_address",
          "protocol": "$protocol",
          "min_port": "$min_port",
          "max_port": "$max_port",
          "icmp_type": "$icmp_type",
          "icmp_code": "$icmp_code"
        }
      ]
    }, { ... }
  ]
}

Returned information

  • $group_id (string) - group UUID
  • $group_name (string) - group name
  • $owner_id (string) - group owner UUID
  • $owner_name (string) - group owner name
  • $uid (string) - resource UUID
  • $type (string) - resource type
  • $label (string) - resource name (if available)
  • $rule_id (int) - rule ID
  • $direction (string) - firewall rule direction - IN, OUT
  • $src_address (string) - source address
  • $dst_address (string) - destination address
  • $protocol (string) - protocol - TCP, UDP, ICMP, SCTP, ESP, AH, IPIP, GRE
  • $min_port (int) - minimum port number
  • $max_port (int) - maximum port number
  • $icmp_type (string) - ICMP type
  • $icmp_code (string) - ICMP code


Adding a group

Request

PUT /v2/groups

Adds a new group.

Request body

{
    "name": "$name"
}

Parameter description

  • $name (string) - group name

Response

{
  "groups": [
    {
      "id":"$group_id",
      "name":"$group_name",
      "owner":{
        "id":"$owner_id",
        "name":"$owner_name"
      },
      "members":[

      ],
      "virtual_machines":[

      ],
      "permisions":{
        "global":[

        ],
        "vm":[

        ]
      },
      "resources": [

      ],
      "rules": [

      ]
    }
  ]
}

Returned information

  • $group_id (string) - group UUID
  • $group_name (string) - group name
  • $owner_id (string) - group owner UUID
  • $owner_name (string) - group owner name


Retrieving information about a group

Request

POST /v2/groups/$GROUP_ID

Returns information about a single group with the specified $GROUP_ID.

Response

{
  "success":true,
  "group":
  {
    "id":"$group_id",
    "name":"$group_name",
    "owner":{
      "id":"$owner_id",
      "name":"$owner_name",
    },
    "members":[

    ],
    "virtual_machines":[

    ],
    "permisions":{
      "global":[

      ],
      "vm":[

      ]
    },
    "resources": [

    ],
    "rules": [

    ]
  }
}

Returned information

  • $group_id (string) - group UUID
  • $group_name (string) - group name
  • $owner_id (string) - group owner UUID
  • $owner_name (string) - group owner name


Adding a user to a group

Request

POST /v2/groups/$GROUP_ID/group-attach-user

Adds a user to the group with the specified $GROUP_ID.

Request body

{ 
  "id" : $user_id
}

Parameter description

  • $user_id (string) - user UUID

Response

{
  "success":true
}


Adding a server to a group

Request

POST /v2/groups/$GROUP_ID/group-attach-vm

Adds a server to the group with the specified $GROUP_ID.

Request body

{
  "id" : $vm_id
}

Parameter description

  • $vm_id (string) - server UUID

Response

{
  "success":true
}


Adding a resource to a group

Request

POST /v2/groups/$GROUP_ID/group-attach-resource

Adds a resource to the group with the specified $GROUP_ID.

Request body

{ 
  "id" : $resource_id
}

Parameter description

  • $resource_id (string) - resource UUID

Response

{
  "success":true
}


Detaching a user from a group

Request

POST /v2/groups/$GROUP_ID/group-detach-user

Removes a user from the group with the specified $GROUP_ID.

Request body

{ 
  "id" : $user_id
}

Parameter description

  • $user_id (string) - user UUID

Response

{  
  "success":true
}


Detaching a server from a group

Request

POST /v2/groups/$GROUP_ID/group-detach-vm

Removes a server from the group with the specified $GROUP_ID.

Request body

{
  "id" : $vm_id
}

Parameter description

  • $vm_id (string) - server UUID

Response

{
  "success":true
}


Detaching a resource from a group

Request

POST /v2/groups/$GROUP_ID/group-detach-resource

Removes a resource from the group with the specified $GROUP_ID.

Request body

{ 
  "id" : $resource_id
}

Parameter description

  • $resource_id (string) - resource UUID

Response

{  
  "success":true
}


Adding a firewall rule to a group

Request

POST /v2/groups/$GROUP_ID/group-add-rule

Adds a firewall rule to the group with the specified $GROUP_ID.

Request body

{
  "direction": "$direction",
  "src_address": "$src_address",
  "dst_address": "$dst_address",
  "protocol": "$protocol",
  "min_port": "$min_port",
  "max_port": "$max_port",
  "icmp_type": "$icmp_type",
  "icmp_code": "$icmp_code"
}

Parameter description

  • $direction (string) - firewall rule direction - IN, OUT
  • $src_address (string) - source address
  • $dst_address (string) - destination address
  • $protocol (string) - protocol - TCP, UDP, ICMP, SCTP, ESP, AH, IPIP, GRE
  • $min_port (int) - minimum port number
  • $max_port (int) - maximum port number
  • $icmp_type (string) - ICMP type
  • $icmp_code (string) - ICMP code

Response

{  
  "success":true
}


Editing a firewall rule

Request

POST /v2/groups/$GROUP_ID/group-update-rule

Edits the specified firewall rule of the group with the specified $GROUP_ID.

Request body

{
  "rule_id": "$rule_id",
  "direction": "$direction",
  "src_address": "$src_address",
  "dst_address": "$dst_address",
  "protocol": "$protocol",
  "min_port": "$min_port",
  "max_port": "$max_port",
  "icmp_type": "$icmp_type",
  "icmp_code": "$icmp_code"
}

Parameter description

  • $rule_id (int) - rule ID
  • $direction (string) - firewall rule direction - IN, OUT
  • $src_address (string) - source address
  • $dst_address (string) - destination address
  • $protocol (string) - protocol - TCP, UDP, ICMP, SCTP, ESP, AH, IPIP, GRE
  • $min_port (int) - minimum port number
  • $max_port (int) - maximum port number
  • $icmp_type (string) - ICMP type
  • $icmp_code (string) - ICMP code

Response

{  
  "success":true
}


Deleting a firewall rule

Request

POST /v2/groups/$GROUP_ID/group-delete-rule

Removes a firewall rule from the group with the specified $GROUP_ID.

Request body

{
  "rule_id": "$rule_id"
}

Parameter description

  • $rule_id (int) - rule ID

Response

{  
  "success":true
}


Enabling / disabling the firewall

Request

POST /v2/groups/$GROUP_ID/firewall

Enables / disables the firewall for the group with the specified $GROUP_ID.

Request body

{
  "active": $active
}

Parameter description

  • $active (bool) - firewall state - true, false

Response

{  
  "success":true
}


Deleting a group

Request

DELETE  /v2/groups/$GROUP_ID

Adds a task to delete the group with the specified $GROUP_ID.

Response

{
  "success":true
}