Files
ubicloud/routes/project/firewall.rb
Jeremy Evans a02b5e060a Use r.web and r.api
These are faster and simpler equivalents of r.on web? and r.on api?
that are supported by the host_routing plugin.
2024-12-18 11:04:28 -08:00

33 lines
851 B
Ruby

# frozen_string_literal: true
class Clover
hash_branch(:project_prefix, "firewall") do |r|
r.get true do
dataset = firewall_list_dataset
if api?
firewall_list_api_response(dataset)
else
authorized_firewalls = dataset.all
@firewalls = Serializers::Firewall.serialize(authorized_firewalls, {include_path: true})
view "networking/firewall/index"
end
end
r.web do
r.get "create" do
authorize("Firewall:create", @project.id)
@option_tree, @option_parents = generate_firewall_options
@default_location = @project.default_location
view "networking/firewall/create"
end
r.post true do
@location = LocationNameConverter.to_internal_name(r.params["location"])
firewall_post(r.params["name"])
end
end
end
end