Logo
OpenScaler

Create a New Firewall

Creates a new firewall. must contain at least one inbound or outbound access rule.

POST
/v1/network/firewalls

Authorization

AuthorizationRequiredBearer <token>

OAuth Authentication

OpenScaler API uses OAuth, a standard for secure authorization. To access the API, obtain a token via the OpenScaler Platform.

Use the access_token in the Authorization header for requests:

Authorization: Bearer <token>

Always keep your token secure and do not share it with anyone.

In: header

Request Body

application/jsonOptional
idRequiredstring

A unique ID that can be used to identify a firewall.

project_idstring

A globally unique identifier for a project (where resource is placed) - or "default" for your default project. Projects are used as workspaces to organize things and separate resources for different independent purposes.

created_atstring

A time value given in ISO8601 combined date and time format that represents when the firewall was created.

Format: "date-time"
pending_changesarray<object>

An array of objects each containing the fields "vm_id", "removing", and "status". It is provided to detail exactly which VMs are having their security policies updated. When empty, all changes have been successfully applied.

nameRequiredstring

A human-readable name for a firewall. The name must begin with an alphanumeric character. Subsequent characters must either be alphanumeric characters, a period (.), or a dash (-).

Pattern: "^[a-zA-Z0-9][a-zA-Z0-9\\.-]+$"
vm_idsarray | null

An array containing the IDs of the VMs assigned to the firewall.

inbound_rulesarray | null
outbound_rulesarray | null
curl -X POST "https://api.alpha.openscaler.net/v1/network/firewalls" \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "id": "4de7ac8b-495b-4884-9a69-1050c6793cd6",
    "project_id": "default",
    "name": "firewall",
    "inbound_rules": [
      {
        "protocol": "tcp",
        "ports": "80",
        "sources": {
          "load_balancer_uids": [
            "4de7ac8b-495b-4884-9a69-1050c6793cd6"
          ]
        }
      },
      {
        "protocol": "tcp",
        "ports": "22",
        "sources": {
          "tags": [
            "gateway"
          ],
          "addresses": [
            "123.0.0.0/8"
          ]
        }
      }
    ],
    "outbound_rules": [
      {
        "protocol": "tcp",
        "ports": "80",
        "destinations": {
          "addresses": [
            "0.0.0.0/0",
            "::/0"
          ]
        }
      }
    ],
    "vm_ids": [
      8043964
    ]
  }'

The response contain information related to created firewall.

{
  "firewall": {
    "id": "bb4b2611-3d72-467b-8602-280330ecd65c",
    "name": "firewall",
    "inbound_rules": [
      {
        "protocol": "tcp",
        "ports": "80",
        "sources": {
          "load_balancer_uids": [
            "4de7ac8b-495b-4884-9a69-1050c6793cd6"
          ]
        }
      },
      {
        "protocol": "tcp",
        "ports": "22",
        "sources": {
          "tags": [
            "gateway"
          ],
          "addresses": [
            "123.0.0.0/8"
          ]
        }
      }
    ],
    "outbound_rules": [
      {
        "protocol": "tcp",
        "ports": "80",
        "destinations": {
          "addresses": [
            "0.0.0.0/0",
            "::/0"
          ]
        }
      }
    ],
    "created_at": "2017-05-23T21:24:00Z",
    "vm_ids": [
      8043964
    ]
  }
}