Files
ubicloud/serializers/vm.rb
Furkan Sahin f85be7e4c5 Integrate PG with AWS instance sizes
On the AWS side, we are limited on the VM size configuration with disk
sizes. Therefore, we are introducing the limitations here. We are also
making only standard SKU available. For now, we will only support a
single disk size per instance size which also is supported up to 16
vcpu.
2025-04-02 12:34:20 +02:00

38 lines
915 B
Ruby

# frozen_string_literal: true
class Serializers::Vm < Serializers::Base
def self.serialize_internal(vm, options = {})
base = {
id: vm.ubid,
name: vm.name,
state: vm.display_state,
location: vm.display_location,
size: vm.display_size,
unix_user: vm.unix_user,
storage_size_gib: vm.storage_size_gib,
ip6: vm.ip6,
ip4_enabled: vm.ip4_enabled,
ip4: vm.ephemeral_net4
}
if options[:include_path]
base[:path] = vm.path
end
if options[:detailed]
base.merge!(
firewalls: Serializers::Firewall.serialize(vm.firewalls, {include_path: true}),
private_ipv4: vm.private_ipv4,
private_ipv6: vm.private_ipv6,
subnet: vm.nics.first.private_subnet.name
)
end
if options[:load_balancer]
base[:load_balancer_state] = vm.load_balancer_vm_ports.first&.state
end
base
end
end