{"command":{"effect":"write","timeoutSeconds":30,"inputSchema":{"type":"object","description":"To create a new firewall, send a POST request to `/v2/firewalls`. The request\nmust contain at least one inbound or outbound access rule.\n","properties":{"body":{"allOf":[{"$ref":"#/definitions/firewall"},{"required":["name"]},{"anyOf":[{"title":"Inbound Rules","required":["inbound_rules"]},{"title":"Outbound Rules","required":["outbound_rules"]}]}],"examples":[{"name":"firewall","inbound_rules":[{"protocol":"tcp","ports":"80","action":"allow","sources":{"load_balancer_uids":["4de7ac8b-495b-4884-9a69-1050c6793cd6"]}},{"protocol":"tcp","ports":"22","action":"allow","sources":{"tags":["gateway"],"addresses":["18.0.0.0/8"]}}],"outbound_rules":[{"protocol":"tcp","ports":"80","action":"allow","destinations":{"addresses":["0.0.0.0/0","::/0"]}}],"droplet_ids":[8043964]}]}},"required":[],"additionalProperties":false,"definitions":{"firewall":{"type":"object","allOf":[{"properties":{"name":{"type":"string","description":"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\\.-]+$","examples":["firewall"]},"droplet_ids":{"type":["array","null"],"description":"An array containing the IDs of the Droplets assigned to the firewall. <br><br>Requires `droplet:read` scope.","items":{"type":"integer"},"examples":[[8043964]]},"tags":{"allOf":[{"$ref":"#/definitions/existing_tags_array"},{"description":"An array containing the names of the Tags assigned to the firewall. <br><br>Requires `tag:read` scope.","examples":["gateway"]}]}}},{"$ref":"#/definitions/firewall_rules"}]},"existing_tags_array":{"type":["array","null"],"items":{"type":"string"},"description":"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. <br><br>Requires `tag:create` and `tag:read` scopes.","examples":[["base-image","prod"]]},"firewall_rules":{"type":"object","properties":{"inbound_rules":{"type":["array","null"],"items":{"allOf":[{"$ref":"#/definitions/firewall_rule_base"},{"properties":{"sources":{"allOf":[{"$ref":"#/definitions/firewall_rule_target"},{"description":"An object specifying locations from which inbound traffic will be accepted."}]}},"required":["sources"]}]}},"outbound_rules":{"type":["array","null"],"items":{"allOf":[{"$ref":"#/definitions/firewall_rule_base"},{"properties":{"destinations":{"allOf":[{"$ref":"#/definitions/firewall_rule_target"},{"description":"An object specifying locations to which outbound traffic that will be allowed."}]}},"required":["destinations"]}]}}}},"firewall_rule_base":{"type":"object","properties":{"protocol":{"type":"string","enum":["tcp","udp","icmp"],"description":"The type of traffic to be allowed. This may be one of `tcp`, `udp`, or `icmp`.","examples":["tcp"]},"ports":{"type":"string","description":"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\".","examples":["8000"]},"action":{"type":"string","enum":["allow","deny"],"default":"allow","description":"The action to be taken when traffic matches the rule. This may be one of `allow` or `deny`. For backward compatibility, this field is optional. When not set, it defaults to `allow`.","examples":["allow"]}},"required":["protocol","ports"]},"firewall_rule_target":{"type":"object","properties":{"addresses":{"type":"array","items":{"type":"string"},"description":"An array of strings containing the IPv4 addresses, IPv6 addresses, IPv4 CIDRs, and/or IPv6 CIDRs to which the firewall will allow traffic.","examples":[["1.2.3.4","18.0.0.0/8"]]},"droplet_ids":{"type":"array","items":{"type":"integer"},"description":"An array containing the IDs of the Droplets to which the firewall will allow traffic.","examples":[[8043964]]},"load_balancer_uids":{"type":"array","items":{"type":"string"},"description":"An array containing the IDs of the load balancers to which the firewall will allow traffic.","examples":[["4de7ac8b-495b-4884-9a69-1050c6793cd6"]]},"kubernetes_ids":{"type":"array","items":{"type":"string"},"description":"An array containing the IDs of the Kubernetes clusters to which the firewall will allow traffic.","examples":[["41b74c5d-9bd0-5555-5555-a57c495b81a3"]]},"tags":{"allOf":[{"$ref":"#/definitions/existing_tags_array"},{"description":"An array containing the names of Tags corresponding to groups of Droplets to which the firewall will allow traffic.","examples":[["frontend"]]}]}}}}},"name":"Create a New Firewall","id":"digitalocean.firewalls_create","example":{},"maxRequests":1,"summary":false}}