{"command":{"effect":"write","timeoutSeconds":30,"inputSchema":{"type":"object","description":"To add additional access rules to a firewall, send a POST request to\n`/v2/firewalls/$FIREWALL_ID/rules`. The body of the request may include an\ninbound_rules and/or outbound_rules attribute containing an array of rules to\nbe added.\n\nNo response body will be sent back, but the response code will indicate\nsuccess. Specifically, the response code will be a 204, which means that the\naction was successful with no returned body data.\n","properties":{"path":{"type":"object","properties":{"firewall_id":{"type":"string","format":"uuid","examples":["bb4b2611-3d72-467b-8602-280330ecd65c"],"description":"A unique ID that can be used to identify and reference a firewall."}},"required":["firewall_id"],"additionalProperties":false},"body":{"allOf":[{"$ref":"#/definitions/firewall_rules"},{"anyOf":[{"title":"Inbound Rules","required":["inbound_rules"]},{"title":"Outbound Rules","required":["outbound_rules"]}]}],"examples":[{"inbound_rules":[{"protocol":"tcp","ports":"3306","action":"allow","sources":{"droplet_ids":[49696269]}}],"outbound_rules":[{"protocol":"tcp","ports":"3306","action":"allow","destinations":{"droplet_ids":[49696269]}}]}]}},"required":["path"],"additionalProperties":false,"definitions":{"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"]]}]}}},"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"]]}}},"name":"Add Rules to a Firewall","id":"digitalocean.firewalls_add_rules","example":{"path":{"firewall_id":"bb4b2611-3d72-467b-8602-280330ecd65c"}},"maxRequests":1,"summary":false}}