Files
ubicloud/serializers/firewall.rb
Burak Velioglu eea0664c05 Add location to firewall serialization
As firewall is updated to be location based resource, location
is added to its' serialization.
2024-07-31 14:26:54 +03:00

24 lines
645 B
Ruby

# frozen_string_literal: true
class Serializers::Firewall < Serializers::Base
def self.serialize_internal(firewall, options = {})
base = {
id: firewall.ubid,
name: firewall.name,
description: firewall.description,
location: firewall.display_location,
firewall_rules: Serializers::FirewallRule.serialize(firewall.firewall_rules.sort_by { |fwr| fwr.cidr.version && fwr.cidr.to_s })
}
if options[:include_path]
base[:path] = firewall.path
end
if options[:detailed]
base[:private_subnets] = Serializers::PrivateSubnet.serialize(firewall.private_subnets)
end
base
end
end