diff --git a/lib/netbox_client_ruby/api/ipam.rb b/lib/netbox_client_ruby/api/ipam.rb index ac7257f..9ab47af 100644 --- a/lib/netbox_client_ruby/api/ipam.rb +++ b/lib/netbox_client_ruby/api/ipam.rb @@ -12,7 +12,8 @@ module IPAM services: Services, vlans: Vlans, vlan_groups: VlanGroups, - vrfs: Vrfs + vrfs: Vrfs, + asns: Asns }.each_pair do |method_name, class_name| define_method(method_name) { class_name.new } module_function(method_name) @@ -28,7 +29,8 @@ module IPAM service: Service, vlan: Vlan, vlan_group: VlanGroup, - vrf: Vrf + vrf: Vrf, + asn: Asn }.each_pair do |method_name, class_name| define_method(method_name) { |id| class_name.new id } module_function(method_name) diff --git a/lib/netbox_client_ruby/api/ipam/asn.rb b/lib/netbox_client_ruby/api/ipam/asn.rb new file mode 100644 index 0000000..7df5db5 --- /dev/null +++ b/lib/netbox_client_ruby/api/ipam/asn.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +module NetboxClientRuby + module IPAM + class Asn + include Entity + + id id: :id + deletable true + path 'ipam/asns/:id/' + creation_path 'ipam/asns/' + object_fields( + tenant: proc { |raw_data| Tenancy::Tenant.new raw_data['id'] } + ) + end + + end +end diff --git a/lib/netbox_client_ruby/api/ipam/asns.rb b/lib/netbox_client_ruby/api/ipam/asns.rb new file mode 100644 index 0000000..b0f6a4c --- /dev/null +++ b/lib/netbox_client_ruby/api/ipam/asns.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +module NetboxClientRuby + module IPAM + class Asns + include Entities + + path 'ipam/asns/' + data_key 'results' + count_key 'count' + entity_creator :entity_creator + + private + + def entity_creator(raw_entity) + Asn.new raw_entity['id'] + end + end + end +end