netbox-client-ruby 0.0.4 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- 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
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4db0c7461a73226465cf363e1d36a4a0ae09e312
|
4
|
+
data.tar.gz: 57a277a47aae7aa4b061fda4c9a30621ef3957f5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fb67919777abcd7de549a6477dde74f309c3942e31929896c739bd58a6c6e484f929ab73a888e15664af7fced94dbd7aa5fe6288718b55b9145ee2ea3eafeec4
|
7
|
+
data.tar.gz: 81ac1560d1839a15c74a6a4398fa782b8bf8edf83267e18235ef115cadc8fb3559b809a19449d786b6483fe99d974259aa39fb39a9b401edf18e4dba05c04b7b
|
data/.travis.yml
CHANGED
data/Dockerfile
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
FROM ruby:2.3.4-alpine
|
2
|
-
MAINTAINER development@nine.ch
|
3
2
|
|
4
3
|
RUN apk add --no-cache git
|
5
4
|
|
@@ -7,6 +6,6 @@ RUN mkdir /app
|
|
7
6
|
WORKDIR /app
|
8
7
|
|
9
8
|
COPY . ./
|
10
|
-
RUN bundle install --jobs 4 --quiet
|
9
|
+
RUN bundle install --jobs 4 --quiet --deployment
|
11
10
|
|
12
11
|
CMD docker/start.sh
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0
|
1
|
+
0.1.0
|
data/docker-compose.yml
CHANGED
data/docker/start.test.sh
CHANGED
@@ -5,14 +5,14 @@ require 'netbox_client_ruby/communication'
|
|
5
5
|
|
6
6
|
module NetboxClientRuby
|
7
7
|
def self.dcim
|
8
|
-
@dcim ||= NetboxClientRuby::DCIM
|
8
|
+
@dcim ||= NetboxClientRuby::DCIM
|
9
9
|
end
|
10
10
|
|
11
11
|
def self.tenancy
|
12
|
-
@tenancy ||= NetboxClientRuby::Tenancy
|
12
|
+
@tenancy ||= NetboxClientRuby::Tenancy
|
13
13
|
end
|
14
14
|
|
15
15
|
def self.ipam
|
16
|
-
@ipam ||= NetboxClientRuby::IPAM
|
16
|
+
@ipam ||= NetboxClientRuby::IPAM
|
17
17
|
end
|
18
18
|
end
|
@@ -6,6 +6,8 @@ require 'netbox_client_ruby/api/dcim/device_type'
|
|
6
6
|
require 'netbox_client_ruby/api/dcim/device_types'
|
7
7
|
require 'netbox_client_ruby/api/dcim/interface'
|
8
8
|
require 'netbox_client_ruby/api/dcim/interfaces'
|
9
|
+
require 'netbox_client_ruby/api/dcim/inventory_item'
|
10
|
+
require 'netbox_client_ruby/api/dcim/inventory_items'
|
9
11
|
require 'netbox_client_ruby/api/dcim/manufacturer'
|
10
12
|
require 'netbox_client_ruby/api/dcim/manufacturers'
|
11
13
|
require 'netbox_client_ruby/api/dcim/platform'
|
@@ -19,21 +21,21 @@ require 'netbox_client_ruby/api/dcim/sites'
|
|
19
21
|
require 'netbox_client_ruby/communication'
|
20
22
|
|
21
23
|
module NetboxClientRuby
|
22
|
-
|
24
|
+
module DCIM
|
23
25
|
{
|
24
26
|
devices: Devices,
|
25
27
|
device_roles: DeviceRoles,
|
26
28
|
device_types: DeviceTypes,
|
27
29
|
interfaces: Interfaces,
|
30
|
+
inventory_items: InventoryItems,
|
28
31
|
manufacturers: Manufacturers,
|
29
32
|
platforms: Platforms,
|
30
33
|
racks: Racks,
|
31
34
|
regions: Regions,
|
32
35
|
sites: Sites
|
33
36
|
}.each_pair do |method_name, class_name|
|
34
|
-
define_method(method_name)
|
35
|
-
|
36
|
-
end
|
37
|
+
define_method(method_name) { class_name.new }
|
38
|
+
module_function(method_name)
|
37
39
|
end
|
38
40
|
|
39
41
|
{
|
@@ -41,15 +43,15 @@ module NetboxClientRuby
|
|
41
43
|
device_role: DeviceRole,
|
42
44
|
device_type: DeviceType,
|
43
45
|
interface: Interface,
|
46
|
+
inventory_item: InventoryItem,
|
44
47
|
manufacturer: Manufacturer,
|
45
48
|
platform: Platform,
|
46
49
|
rack: Rack,
|
47
50
|
region: Region,
|
48
51
|
site: Site
|
49
52
|
}.each_pair do |method_name, class_name|
|
50
|
-
define_method(method_name)
|
51
|
-
|
52
|
-
end
|
53
|
+
define_method(method_name) { |id| class_name.new id }
|
54
|
+
module_function(method_name)
|
53
55
|
end
|
54
56
|
end
|
55
57
|
end
|
@@ -8,24 +8,26 @@ require 'netbox_client_ruby/api/dcim/rack'
|
|
8
8
|
require 'netbox_client_ruby/api/ipam/ip_address'
|
9
9
|
|
10
10
|
module NetboxClientRuby
|
11
|
-
|
12
|
-
|
11
|
+
module DCIM
|
12
|
+
class Device
|
13
|
+
include Entity
|
13
14
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
15
|
+
id id: :id
|
16
|
+
deletable true
|
17
|
+
path 'dcim/devices/:id.json'
|
18
|
+
creation_path 'dcim/devices/'
|
19
|
+
object_fields(
|
20
|
+
device_type: proc { |raw_data| DeviceType.new raw_data['id'] },
|
21
|
+
device_role: proc { |raw_data| DeviceRole.new raw_data['id'] },
|
22
|
+
tenant: proc { |raw_data| Tenancy::Tenant.new raw_data['id'] },
|
23
|
+
platform: proc { |raw_data| Platform.new raw_data['id'] },
|
24
|
+
site: proc { |raw_data| Site.new raw_data['id'] },
|
25
|
+
rack: proc { |raw_data| Rack.new raw_data['id'] },
|
26
|
+
parent_device: proc { |raw_data| Device.new raw_data['id'] },
|
27
|
+
primary_ip: proc { |raw_data| IPAM::IpAddress.new raw_data['id'] },
|
28
|
+
primary_ip4: proc { |raw_data| IPAM::IpAddress.new raw_data['id'] },
|
29
|
+
primary_ip6: proc { |raw_data| IPAM::IpAddress.new raw_data['id'] }
|
30
|
+
)
|
31
|
+
end
|
30
32
|
end
|
31
33
|
end
|
@@ -1,12 +1,14 @@
|
|
1
1
|
require 'netbox_client_ruby/entity'
|
2
2
|
|
3
3
|
module NetboxClientRuby
|
4
|
-
|
5
|
-
|
4
|
+
module DCIM
|
5
|
+
class DeviceRole
|
6
|
+
include Entity
|
6
7
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
8
|
+
id id: :id
|
9
|
+
deletable true
|
10
|
+
path 'dcim/device-roles/:id.json'
|
11
|
+
creation_path 'dcim/device-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/dcim/device_type'
|
3
3
|
|
4
4
|
module NetboxClientRuby
|
5
|
-
|
6
|
-
|
5
|
+
module DCIM
|
6
|
+
class DeviceRoles
|
7
|
+
include Entities
|
7
8
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
path 'dcim/device-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
|
+
DeviceRole.new raw_entity['id']
|
18
|
+
end
|
17
19
|
end
|
18
20
|
end
|
19
21
|
end
|
@@ -2,25 +2,27 @@ require 'netbox_client_ruby/entity'
|
|
2
2
|
require 'netbox_client_ruby/api/dcim/manufacturer'
|
3
3
|
|
4
4
|
module NetboxClientRuby
|
5
|
-
|
6
|
-
|
5
|
+
module DCIM
|
6
|
+
class InterfaceOrdering
|
7
|
+
attr_reader :value, :label
|
7
8
|
|
8
|
-
|
9
|
-
|
10
|
-
|
9
|
+
def initialize(raw_data)
|
10
|
+
@value = raw_data['value']
|
11
|
+
@label = raw_data['label']
|
12
|
+
end
|
11
13
|
end
|
12
|
-
end
|
13
14
|
|
14
|
-
|
15
|
-
|
15
|
+
class DeviceType
|
16
|
+
include Entity
|
16
17
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
18
|
+
id id: :id
|
19
|
+
deletable true
|
20
|
+
path 'dcim/device-types/:id.json'
|
21
|
+
creation_path 'dcim/device-types/'
|
22
|
+
object_fields(
|
23
|
+
manufacturer: proc { |raw_data| Manufacturer.new raw_data['id'] },
|
24
|
+
interface_ordering: InterfaceOrdering
|
25
|
+
)
|
26
|
+
end
|
25
27
|
end
|
26
28
|
end
|
@@ -2,18 +2,20 @@ require 'netbox_client_ruby/entities'
|
|
2
2
|
require 'netbox_client_ruby/api/dcim/device_type'
|
3
3
|
|
4
4
|
module NetboxClientRuby
|
5
|
-
|
6
|
-
|
5
|
+
module DCIM
|
6
|
+
class DeviceTypes
|
7
|
+
include Entities
|
7
8
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
path 'dcim/device-types.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
|
+
DeviceType.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/dcim/device'
|
3
3
|
|
4
4
|
module NetboxClientRuby
|
5
|
-
|
6
|
-
|
5
|
+
module DCIM
|
6
|
+
class Devices
|
7
|
+
include Entities
|
7
8
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
path 'dcim/devices.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
|
+
Device.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/dcim/device'
|
3
3
|
|
4
4
|
module NetboxClientRuby
|
5
|
-
|
6
|
-
|
5
|
+
module DCIM
|
6
|
+
class Interface
|
7
|
+
include Entity
|
7
8
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
9
|
+
id id: :id
|
10
|
+
deletable true
|
11
|
+
path 'dcim/interfaces/:id.json'
|
12
|
+
creation_path 'dcim/interfaces/'
|
13
|
+
object_fields device: proc { |raw_data| Device.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/dcim/interface'
|
3
3
|
|
4
4
|
module NetboxClientRuby
|
5
|
-
|
6
|
-
|
5
|
+
module DCIM
|
6
|
+
class Interfaces
|
7
|
+
include Entities
|
7
8
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
path 'dcim/interfaces.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
|
+
Interface.new raw_entity['id']
|
18
|
+
end
|
17
19
|
end
|
18
20
|
end
|
19
21
|
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'netbox_client_ruby/entity'
|
2
|
+
require 'netbox_client_ruby/api/dcim/device'
|
3
|
+
|
4
|
+
module NetboxClientRuby
|
5
|
+
module DCIM
|
6
|
+
class InventoryItem
|
7
|
+
include Entity
|
8
|
+
|
9
|
+
id id: :id
|
10
|
+
deletable true
|
11
|
+
path 'dcim/inventory-items/:id.json'
|
12
|
+
creation_path 'dcim/inventory-items/'
|
13
|
+
object_fields device: proc { |raw_data| Device.new raw_data['id'] },
|
14
|
+
manufacturer: proc { |raw_data| Manufacturer.new raw_data['id'] }
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'netbox_client_ruby/entities'
|
2
|
+
require 'netbox_client_ruby/api/dcim/inventory_item'
|
3
|
+
|
4
|
+
module NetboxClientRuby
|
5
|
+
module DCIM
|
6
|
+
class InventoryItems
|
7
|
+
include Entities
|
8
|
+
|
9
|
+
path 'dcim/inventory-items.json'
|
10
|
+
data_key 'results'
|
11
|
+
count_key 'count'
|
12
|
+
entity_creator :entity_creator
|
13
|
+
|
14
|
+
private
|
15
|
+
|
16
|
+
def entity_creator(raw_entity)
|
17
|
+
InventoryItem.new raw_entity['id']
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -1,12 +1,14 @@
|
|
1
1
|
require 'netbox_client_ruby/entity'
|
2
2
|
|
3
3
|
module NetboxClientRuby
|
4
|
-
|
5
|
-
|
4
|
+
module DCIM
|
5
|
+
class Manufacturer
|
6
|
+
include Entity
|
6
7
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
8
|
+
id id: :id
|
9
|
+
deletable true
|
10
|
+
path 'dcim/manufacturers/:id.json'
|
11
|
+
creation_path 'dcim/manufacturers/'
|
12
|
+
end
|
11
13
|
end
|
12
14
|
end
|