Skip to content
  • Auto
  • Light
  • Dark

List

List All Firewalls
gpu_droplets.firewalls.list(FirewallListParams**kwargs) -> metaMetaPropertiesfirewallslistlinksPageLinksFirewallListResponse
get/v2/firewalls

To list all of the firewalls available on your account, send a GET request to /v2/firewalls.

Parameters
pageint
optional

Which 'page' of paginated results to return.

minimum1
per_pageint
optional

Number of items returned per page

minimum1
maximum200
Returns
FirewallListResponseclass
Hide ParametersShow Parameters
metatotalintMetaProperties

Information about the response itself.

firewallslist
optional
Optional[List[idstrcreated_atdatetimedroplet_idslistinbound_ruleslistnamestroutbound_ruleslistpending_changesliststatusliteraltagslistFirewall]]
Hide ParametersShow Parameters
idstr
optional

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

created_atdatetime
optional

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

formatdate-time
droplet_idslist
optional
Optional[List[int]]

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

Requires droplet:read scope.

inbound_ruleslist
optional
Optional[List[InboundRule]]
Hide ParametersShow Parameters
portsstr

The ports on which traffic will be allowed specified as a string containing a single port, a range (e.g. "8000-9000"), or "0" when all ports are open for a protocol. For ICMP rules this parameter will always return "0".

protocolliteral
Literal["tcp", "udp", "icmp"]

The type of traffic to be allowed. This may be one of tcp, udp, or icmp.

Hide ParametersShow Parameters
"tcp"
"udp"
"icmp"
sourcesaddresseslistdroplet_idslistkubernetes_idslistload_balancer_uidslisttagslistFirewallRuleTarget

An object specifying locations from which inbound traffic will be accepted.

namestr
optional

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 (-).

outbound_ruleslist
optional
Optional[List[OutboundRule]]
Hide ParametersShow Parameters
destinationsaddresseslistdroplet_idslistkubernetes_idslistload_balancer_uidslisttagslistFirewallRuleTarget

An object specifying locations to which outbound traffic that will be allowed.

portsstr

The ports on which traffic will be allowed specified as a string containing a single port, a range (e.g. "8000-9000"), or "0" when all ports are open for a protocol. For ICMP rules this parameter will always return "0".

protocolliteral
Literal["tcp", "udp", "icmp"]

The type of traffic to be allowed. This may be one of tcp, udp, or icmp.

Hide ParametersShow Parameters
"tcp"
"udp"
"icmp"
pending_changeslist
optional
Optional[List[PendingChange]]

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

Hide ParametersShow Parameters
droplet_idint
optional
removingbool
optional
statusstr
optional
statusliteral
optional
Optional[Literal["waiting", "succeeded", "failed"]]

A status string indicating the current state of the firewall. This can be "waiting", "succeeded", or "failed".

Hide ParametersShow Parameters
"waiting"
"succeeded"
"failed"
tagslist
optional
Optional[List[str]]

A flat array of tag names as strings to be applied to the resource. Tag names must exist in order to be referenced in a request.

Requires tag:create and tag:read scopes.

from do_gradientai import GradientAI

client = GradientAI()
firewalls = client.gpu_droplets.firewalls.list()
print(firewalls.meta)
200 Example
{
  "meta": {
    "total": 1
  },
  "firewalls": [
    {
      "droplet_ids": [
        8043964
      ],
      "inbound_rules": [
        {
          "ports": "8000",
          "protocol": "tcp",
          "sources": {
            "addresses": [
              "1.2.3.4",
              "18.0.0.0/8"
            ],
            "droplet_ids": [
              8043964
            ],
            "kubernetes_ids": [
              "41b74c5d-9bd0-5555-5555-a57c495b81a3"
            ],
            "load_balancer_uids": [
              "4de7ac8b-495b-4884-9a69-1050c6793cd6"
            ],
            "tags": [
              "base-image",
              "prod"
            ]
          }
        }
      ],
      "name": "firewall",
      "outbound_rules": [
        {
          "destinations": {
            "addresses": [
              "1.2.3.4",
              "18.0.0.0/8"
            ],
            "droplet_ids": [
              8043964
            ],
            "kubernetes_ids": [
              "41b74c5d-9bd0-5555-5555-a57c495b81a3"
            ],
            "load_balancer_uids": [
              "4de7ac8b-495b-4884-9a69-1050c6793cd6"
            ],
            "tags": [
              "base-image",
              "prod"
            ]
          },
          "ports": "8000",
          "protocol": "tcp"
        }
      ],
      "tags": [
        "base-image",
        "prod"
      ]
    }
  ],
  "links": {
    "pages": {
      "last": "https://api.digitalocean.com/v2/images?page=2",
      "next": "https://api.digitalocean.com/v2/images?page=2"
    }
  }
}