netbox-client-ruby 0.0.4 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/.travis.yml +3 -0
- data/Dockerfile +1 -2
- data/VERSION +1 -1
- data/docker-compose.yml +1 -1
- data/docker/start.test.sh +1 -1
- data/lib/netbox_client_ruby/api.rb +3 -3
- data/lib/netbox_client_ruby/api/dcim.rb +9 -7
- data/lib/netbox_client_ruby/api/dcim/device.rb +20 -18
- data/lib/netbox_client_ruby/api/dcim/device_role.rb +8 -6
- data/lib/netbox_client_ruby/api/dcim/device_roles.rb +11 -9
- data/lib/netbox_client_ruby/api/dcim/device_type.rb +18 -16
- data/lib/netbox_client_ruby/api/dcim/device_types.rb +11 -9
- data/lib/netbox_client_ruby/api/dcim/devices.rb +11 -9
- data/lib/netbox_client_ruby/api/dcim/interface.rb +9 -7
- data/lib/netbox_client_ruby/api/dcim/interfaces.rb +11 -9
- data/lib/netbox_client_ruby/api/dcim/inventory_item.rb +17 -0
- data/lib/netbox_client_ruby/api/dcim/inventory_items.rb +21 -0
- data/lib/netbox_client_ruby/api/dcim/manufacturer.rb +8 -6
- data/lib/netbox_client_ruby/api/dcim/manufacturers.rb +11 -9
- data/lib/netbox_client_ruby/api/dcim/platform.rb +8 -6
- data/lib/netbox_client_ruby/api/dcim/platforms.rb +11 -9
- data/lib/netbox_client_ruby/api/dcim/rack.rb +8 -6
- data/lib/netbox_client_ruby/api/dcim/racks.rb +11 -9
- data/lib/netbox_client_ruby/api/dcim/region.rb +9 -7
- data/lib/netbox_client_ruby/api/dcim/regions.rb +11 -9
- data/lib/netbox_client_ruby/api/dcim/site.rb +10 -8
- data/lib/netbox_client_ruby/api/dcim/sites.rb +11 -9
- data/lib/netbox_client_ruby/api/ipam.rb +5 -7
- data/lib/netbox_client_ruby/api/ipam/aggregate.rb +9 -7
- data/lib/netbox_client_ruby/api/ipam/aggregates.rb +11 -9
- data/lib/netbox_client_ruby/api/ipam/ip_address.rb +25 -23
- data/lib/netbox_client_ruby/api/ipam/ip_addresses.rb +11 -9
- data/lib/netbox_client_ruby/api/ipam/prefix.rb +35 -33
- data/lib/netbox_client_ruby/api/ipam/prefixes.rb +11 -9
- data/lib/netbox_client_ruby/api/ipam/rir.rb +8 -6
- data/lib/netbox_client_ruby/api/ipam/rirs.rb +11 -9
- data/lib/netbox_client_ruby/api/ipam/role.rb +8 -6
- data/lib/netbox_client_ruby/api/ipam/roles.rb +11 -9
- data/lib/netbox_client_ruby/api/ipam/vlan.rb +30 -28
- data/lib/netbox_client_ruby/api/ipam/vlan_group.rb +9 -7
- data/lib/netbox_client_ruby/api/ipam/vlan_groups.rb +11 -9
- data/lib/netbox_client_ruby/api/ipam/vlans.rb +11 -9
- data/lib/netbox_client_ruby/api/ipam/vrf.rb +9 -7
- data/lib/netbox_client_ruby/api/ipam/vrfs.rb +11 -9
- data/lib/netbox_client_ruby/api/tenancy.rb +13 -13
- data/lib/netbox_client_ruby/api/tenancy/tenant.rb +9 -7
- data/lib/netbox_client_ruby/api/tenancy/tenant_group.rb +8 -6
- data/lib/netbox_client_ruby/api/tenancy/tenant_groups.rb +11 -9
- data/lib/netbox_client_ruby/api/tenancy/tenants.rb +11 -9
- metadata +4 -2
@@ -2,18 +2,20 @@ require 'netbox_client_ruby/entities'
|
|
2
2
|
require 'netbox_client_ruby/api/ipam/prefix'
|
3
3
|
|
4
4
|
module NetboxClientRuby
|
5
|
-
|
6
|
-
|
5
|
+
module IPAM
|
6
|
+
class Prefixes
|
7
|
+
include Entities
|
7
8
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
path 'ipam/prefixes.json'
|
10
|
+
data_key 'results'
|
11
|
+
count_key 'count'
|
12
|
+
entity_creator :entity_creator
|
12
13
|
|
13
|
-
|
14
|
+
private
|
14
15
|
|
15
|
-
|
16
|
-
|
16
|
+
def entity_creator(raw_entity)
|
17
|
+
Prefix.new raw_entity['id']
|
18
|
+
end
|
17
19
|
end
|
18
20
|
end
|
19
21
|
end
|
@@ -1,12 +1,14 @@
|
|
1
1
|
require 'netbox_client_ruby/entity'
|
2
2
|
|
3
3
|
module NetboxClientRuby
|
4
|
-
|
5
|
-
|
4
|
+
module IPAM
|
5
|
+
class Rir
|
6
|
+
include Entity
|
6
7
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
8
|
+
id id: :id
|
9
|
+
deletable true
|
10
|
+
path 'ipam/rirs/:id.json'
|
11
|
+
creation_path 'ipam/rirs/'
|
12
|
+
end
|
11
13
|
end
|
12
14
|
end
|
@@ -2,18 +2,20 @@ require 'netbox_client_ruby/entities'
|
|
2
2
|
require 'netbox_client_ruby/api/ipam/rir'
|
3
3
|
|
4
4
|
module NetboxClientRuby
|
5
|
-
|
6
|
-
|
5
|
+
module IPAM
|
6
|
+
class Rirs
|
7
|
+
include Entities
|
7
8
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
path 'ipam/rirs.json'
|
10
|
+
data_key 'results'
|
11
|
+
count_key 'count'
|
12
|
+
entity_creator :entity_creator
|
12
13
|
|
13
|
-
|
14
|
+
private
|
14
15
|
|
15
|
-
|
16
|
-
|
16
|
+
def entity_creator(raw_entity)
|
17
|
+
Rir.new raw_entity['id']
|
18
|
+
end
|
17
19
|
end
|
18
20
|
end
|
19
21
|
end
|
@@ -1,12 +1,14 @@
|
|
1
1
|
require 'netbox_client_ruby/entity'
|
2
2
|
|
3
3
|
module NetboxClientRuby
|
4
|
-
|
5
|
-
|
4
|
+
module IPAM
|
5
|
+
class Role
|
6
|
+
include Entity
|
6
7
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
8
|
+
id id: :id
|
9
|
+
deletable true
|
10
|
+
path 'ipam/roles/:id.json'
|
11
|
+
creation_path 'ipam/roles/'
|
12
|
+
end
|
11
13
|
end
|
12
14
|
end
|
@@ -2,18 +2,20 @@ require 'netbox_client_ruby/entities'
|
|
2
2
|
require 'netbox_client_ruby/api/ipam/role'
|
3
3
|
|
4
4
|
module NetboxClientRuby
|
5
|
-
|
6
|
-
|
5
|
+
module IPAM
|
6
|
+
class Roles
|
7
|
+
include Entities
|
7
8
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
path 'ipam/roles.json'
|
10
|
+
data_key 'results'
|
11
|
+
count_key 'count'
|
12
|
+
entity_creator :entity_creator
|
12
13
|
|
13
|
-
|
14
|
+
private
|
14
15
|
|
15
|
-
|
16
|
-
|
16
|
+
def entity_creator(raw_entity)
|
17
|
+
Role.new raw_entity['id']
|
18
|
+
end
|
17
19
|
end
|
18
20
|
end
|
19
21
|
end
|
@@ -4,37 +4,39 @@ require 'netbox_client_ruby/api/ipam/role'
|
|
4
4
|
require 'netbox_client_ruby/api/ipam/vlan_group'
|
5
5
|
|
6
6
|
module NetboxClientRuby
|
7
|
-
|
8
|
-
|
7
|
+
module IPAM
|
8
|
+
class Vlan
|
9
|
+
include Entity
|
9
10
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
11
|
+
id id: :id
|
12
|
+
deletable true
|
13
|
+
path 'ipam/vlans/:id.json'
|
14
|
+
creation_path 'ipam/vlans/'
|
15
|
+
object_fields(
|
16
|
+
tenant: proc { |raw_data| Tenancy::Tenant.new raw_data['id'] },
|
17
|
+
role: proc { |raw_data| Role.new raw_data['id'] },
|
18
|
+
status: proc { |raw_data| VlanStatus.new raw_data['value'] },
|
19
|
+
group: proc { |raw_data| VlanGroup.new raw_data['id'] }
|
20
|
+
)
|
21
|
+
readonly_fields :display_name
|
22
|
+
end
|
22
23
|
|
23
|
-
|
24
|
-
|
24
|
+
class VlanStatus
|
25
|
+
attr_reader :value, :label
|
25
26
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
27
|
+
def initialize(status_value)
|
28
|
+
@value = status_value
|
29
|
+
@label = case status_value
|
30
|
+
when 1 then
|
31
|
+
'Active'.freeze
|
32
|
+
when 2 then
|
33
|
+
'Reserved'.freeze
|
34
|
+
when 3 then
|
35
|
+
'Deprecated'.freeze
|
36
|
+
else
|
37
|
+
'UNDEFINED'.freeze
|
38
|
+
end
|
39
|
+
end
|
38
40
|
end
|
39
41
|
end
|
40
42
|
end
|
@@ -2,13 +2,15 @@ require 'netbox_client_ruby/entity'
|
|
2
2
|
require 'netbox_client_ruby/api/dcim/site'
|
3
3
|
|
4
4
|
module NetboxClientRuby
|
5
|
-
|
6
|
-
|
5
|
+
module IPAM
|
6
|
+
class VlanGroup
|
7
|
+
include Entity
|
7
8
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
9
|
+
id id: :id
|
10
|
+
deletable true
|
11
|
+
path 'ipam/vlan-groups/:id.json'
|
12
|
+
creation_path 'ipam/vlan-groups/'
|
13
|
+
object_fields site: proc { |raw_data| Site.new raw_data['id'] }
|
14
|
+
end
|
13
15
|
end
|
14
16
|
end
|
@@ -2,18 +2,20 @@ require 'netbox_client_ruby/entities'
|
|
2
2
|
require 'netbox_client_ruby/api/ipam/vlan_group'
|
3
3
|
|
4
4
|
module NetboxClientRuby
|
5
|
-
|
6
|
-
|
5
|
+
module IPAM
|
6
|
+
class VlanGroups
|
7
|
+
include Entities
|
7
8
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
path 'ipam/vlan-groups.json'
|
10
|
+
data_key 'results'
|
11
|
+
count_key 'count'
|
12
|
+
entity_creator :entity_creator
|
12
13
|
|
13
|
-
|
14
|
+
private
|
14
15
|
|
15
|
-
|
16
|
-
|
16
|
+
def entity_creator(raw_entity)
|
17
|
+
VlanGroup.new raw_entity['id']
|
18
|
+
end
|
17
19
|
end
|
18
20
|
end
|
19
21
|
end
|
@@ -2,18 +2,20 @@ require 'netbox_client_ruby/entities'
|
|
2
2
|
require 'netbox_client_ruby/api/ipam/vlan'
|
3
3
|
|
4
4
|
module NetboxClientRuby
|
5
|
-
|
6
|
-
|
5
|
+
module IPAM
|
6
|
+
class Vlans
|
7
|
+
include Entities
|
7
8
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
path 'ipam/vlans.json'
|
10
|
+
data_key 'results'
|
11
|
+
count_key 'count'
|
12
|
+
entity_creator :entity_creator
|
12
13
|
|
13
|
-
|
14
|
+
private
|
14
15
|
|
15
|
-
|
16
|
-
|
16
|
+
def entity_creator(raw_entity)
|
17
|
+
Vlan.new raw_entity['id']
|
18
|
+
end
|
17
19
|
end
|
18
20
|
end
|
19
21
|
end
|
@@ -2,13 +2,15 @@ require 'netbox_client_ruby/entity'
|
|
2
2
|
require 'netbox_client_ruby/api/tenancy/tenant'
|
3
3
|
|
4
4
|
module NetboxClientRuby
|
5
|
-
|
6
|
-
|
5
|
+
module IPAM
|
6
|
+
class Vrf
|
7
|
+
include Entity
|
7
8
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
9
|
+
id id: :id
|
10
|
+
deletable true
|
11
|
+
path 'ipam/vrfs/:id.json'
|
12
|
+
creation_path 'ipam/vrfs/'
|
13
|
+
object_fields tenant: proc { |raw_data| Tenancy::Tenant.new raw_data['id'] }
|
14
|
+
end
|
13
15
|
end
|
14
16
|
end
|
@@ -2,18 +2,20 @@ require 'netbox_client_ruby/entities'
|
|
2
2
|
require 'netbox_client_ruby/api/ipam/vrf'
|
3
3
|
|
4
4
|
module NetboxClientRuby
|
5
|
-
|
6
|
-
|
5
|
+
module IPAM
|
6
|
+
class Vrfs
|
7
|
+
include Entities
|
7
8
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
path 'ipam/vrfs.json'
|
10
|
+
data_key 'results'
|
11
|
+
count_key 'count'
|
12
|
+
entity_creator :entity_creator
|
12
13
|
|
13
|
-
|
14
|
+
private
|
14
15
|
|
15
|
-
|
16
|
-
|
16
|
+
def entity_creator(raw_entity)
|
17
|
+
Vrf.new raw_entity['id']
|
18
|
+
end
|
17
19
|
end
|
18
20
|
end
|
19
21
|
end
|
@@ -5,21 +5,21 @@ require 'netbox_client_ruby/api/tenancy/tenant_groups'
|
|
5
5
|
require 'netbox_client_ruby/communication'
|
6
6
|
|
7
7
|
module NetboxClientRuby
|
8
|
-
|
9
|
-
|
10
|
-
Tenants
|
8
|
+
module Tenancy
|
9
|
+
{
|
10
|
+
tenants: Tenants,
|
11
|
+
tenant_groups: TenantGroups
|
12
|
+
}.each_pair do |method_name, class_name|
|
13
|
+
define_method(method_name) { class_name.new }
|
14
|
+
module_function(method_name)
|
11
15
|
end
|
12
16
|
|
13
|
-
|
14
|
-
Tenant
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
end
|
20
|
-
|
21
|
-
def tenant_group
|
22
|
-
TenantGroup.new
|
17
|
+
{
|
18
|
+
tenant: Tenant,
|
19
|
+
tenant_group: TenantGroup
|
20
|
+
}.each_pair do |method_name, class_name|
|
21
|
+
define_method(method_name) { |id| class_name.new id }
|
22
|
+
module_function(method_name)
|
23
23
|
end
|
24
24
|
end
|
25
25
|
end
|
@@ -2,13 +2,15 @@ require 'netbox_client_ruby/entity'
|
|
2
2
|
require 'netbox_client_ruby/api/tenancy/tenant_group'
|
3
3
|
|
4
4
|
module NetboxClientRuby
|
5
|
-
|
6
|
-
|
5
|
+
module Tenancy
|
6
|
+
class Tenant
|
7
|
+
include Entity
|
7
8
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
9
|
+
id id: :id
|
10
|
+
deletable true
|
11
|
+
path 'tenancy/tenants/:id.json'
|
12
|
+
creation_path 'tenancy/tenants/'
|
13
|
+
object_fields group: proc { |raw_data| TenantGroup.new raw_data['id'] }
|
14
|
+
end
|
13
15
|
end
|
14
16
|
end
|
@@ -1,12 +1,14 @@
|
|
1
1
|
require 'netbox_client_ruby/entity'
|
2
2
|
|
3
3
|
module NetboxClientRuby
|
4
|
-
|
5
|
-
|
4
|
+
module Tenancy
|
5
|
+
class TenantGroup
|
6
|
+
include Entity
|
6
7
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
8
|
+
id id: :id
|
9
|
+
deletable true
|
10
|
+
path 'tenancy/tenant-groups/:id.json'
|
11
|
+
creation_path 'tenancy/tenant-groups/'
|
12
|
+
end
|
11
13
|
end
|
12
14
|
end
|
@@ -2,18 +2,20 @@ require 'netbox_client_ruby/entities'
|
|
2
2
|
require 'netbox_client_ruby/api/tenancy/tenant_group'
|
3
3
|
|
4
4
|
module NetboxClientRuby
|
5
|
-
|
6
|
-
|
5
|
+
module Tenancy
|
6
|
+
class TenantGroups
|
7
|
+
include Entities
|
7
8
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
path 'tenancy/tenant-groups.json'
|
10
|
+
data_key 'results'
|
11
|
+
count_key 'count'
|
12
|
+
entity_creator :entity_creator
|
12
13
|
|
13
|
-
|
14
|
+
private
|
14
15
|
|
15
|
-
|
16
|
-
|
16
|
+
def entity_creator(raw_entity)
|
17
|
+
TenantGroup.new raw_entity['id']
|
18
|
+
end
|
17
19
|
end
|
18
20
|
end
|
19
21
|
end
|