netbox-client-ruby 0.6.0 → 0.7.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/codeql-analysis.yml +42 -0
- data/.github/workflows/gem-push.yml +2 -3
- data/README.md +1 -0
- data/VERSION +1 -1
- data/lib/netbox_client_ruby/api/ipam/ip_range.rb +35 -0
- data/lib/netbox_client_ruby/api/ipam/ip_ranges.rb +21 -0
- data/lib/netbox_client_ruby/api/ipam.rb +4 -0
- data/netbox-client-ruby.gemspec +3 -3
- metadata +17 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9075ab76145ae776124b677d6f9fe153814c935f59f65d6cef91bb7b109142ba
|
4
|
+
data.tar.gz: 7b997c7871a522f8a4d7c0646ca1bbbccda499015993fbf697b2bacaa3cf3a1a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8a511e9b441dfd386dd84745082e29cda53ff3e15c5028339634e79629a8876b28940264be490e53a49a8b21ac4e9cfef4a9fa0b1acc076bdc9f659fb131227c
|
7
|
+
data.tar.gz: ca9f3347ff273b877639194adbff12dbad0a6f8962e93e490ae47dfafd27362569e731e5c61c6f1b7e393b32fe394758cb7cd5768f28efd2e1fc058c9dcfedac
|
@@ -0,0 +1,42 @@
|
|
1
|
+
name: "CodeQL"
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches: [ master ]
|
6
|
+
pull_request:
|
7
|
+
# The branches below must be a subset of the branches above
|
8
|
+
branches: [ master ]
|
9
|
+
schedule:
|
10
|
+
- cron: '25 2 * * 6'
|
11
|
+
|
12
|
+
jobs:
|
13
|
+
analyze:
|
14
|
+
name: Analyze
|
15
|
+
runs-on: ubuntu-latest
|
16
|
+
permissions:
|
17
|
+
actions: read
|
18
|
+
contents: read
|
19
|
+
security-events: write
|
20
|
+
|
21
|
+
strategy:
|
22
|
+
fail-fast: false
|
23
|
+
matrix:
|
24
|
+
language: [ 'ruby' ]
|
25
|
+
|
26
|
+
steps:
|
27
|
+
- name: Checkout repository
|
28
|
+
uses: actions/checkout@v2
|
29
|
+
|
30
|
+
# Initializes the CodeQL tools for scanning.
|
31
|
+
- name: Initialize CodeQL
|
32
|
+
uses: github/codeql-action/init@v1
|
33
|
+
with:
|
34
|
+
languages: ${{ matrix.language }}
|
35
|
+
# If you wish to specify custom queries, you can do so here or in a config file.
|
36
|
+
# By default, queries listed here will override any specified in a config file.
|
37
|
+
# Prefix the list here with "+" to use these queries and those in the config file.
|
38
|
+
# queries: ./path/to/local/query, your-org/your-repo/queries@main
|
39
|
+
- name: Autobuild
|
40
|
+
uses: github/codeql-action/autobuild@v1
|
41
|
+
- name: Perform CodeQL Analysis
|
42
|
+
uses: github/codeql-action/analyze@v1
|
@@ -11,10 +11,9 @@ jobs:
|
|
11
11
|
runs-on: ubuntu-latest
|
12
12
|
steps:
|
13
13
|
- uses: actions/checkout@v2
|
14
|
-
-
|
15
|
-
uses: actions/setup-ruby@v1
|
14
|
+
- uses: ruby/setup-ruby@v1
|
16
15
|
with:
|
17
|
-
ruby-version: 2.6
|
16
|
+
ruby-version: 2.6
|
18
17
|
- name: Publish to RubyGems
|
19
18
|
run: |
|
20
19
|
mkdir -p $HOME/.gem
|
data/README.md
CHANGED
@@ -169,6 +169,7 @@ Not all objects which the Netbox API exposes are currently implemented. Implemen
|
|
169
169
|
* IPAM:
|
170
170
|
* Aggregates: `NetboxClientRuby.ipam.aggregates`
|
171
171
|
* IP Addresses: `NetboxClientRuby.ipam.ip_addresses`
|
172
|
+
* IP Ranges: `NetboxClientRuby.ipam.ip_ranges`
|
172
173
|
* Prefixes: `NetboxClientRuby.ipam.prefixes`
|
173
174
|
* RIRs: `NetboxClientRuby.ipam.rirs`
|
174
175
|
* Roles: `NetboxClientRuby.ipam.roles`
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.7.1
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'netbox_client_ruby/entity'
|
2
|
+
require 'netbox_client_ruby/api/ipam/role'
|
3
|
+
require 'netbox_client_ruby/api/ipam/vrf'
|
4
|
+
require 'netbox_client_ruby/api/tenancy/tenant'
|
5
|
+
require 'ipaddress'
|
6
|
+
|
7
|
+
module NetboxClientRuby
|
8
|
+
module IPAM
|
9
|
+
class IpRange
|
10
|
+
include Entity
|
11
|
+
|
12
|
+
id id: :id
|
13
|
+
deletable true
|
14
|
+
path 'ipam/ip-ranges/:id.json'
|
15
|
+
creation_path 'ipam/ip-ranges/'
|
16
|
+
object_fields(
|
17
|
+
vrf: proc { |raw_data| Vrf.new raw_data['id'] },
|
18
|
+
tenant: proc { |raw_data| Tenancy::Tenant.new raw_data['id'] },
|
19
|
+
role: proc { |raw_data| Role.new raw_data['id'] },
|
20
|
+
status: proc { |raw_data| IpRangeStatus.new raw_data },
|
21
|
+
start_address: proc { |raw_data| IPAddress.parse raw_data },
|
22
|
+
end_address: proc { |raw_data| IPAddress.parse raw_data }
|
23
|
+
)
|
24
|
+
end
|
25
|
+
|
26
|
+
class IpRangeStatus
|
27
|
+
attr_reader :value, :label
|
28
|
+
|
29
|
+
def initialize(raw_data)
|
30
|
+
@value = raw_data['value']
|
31
|
+
@label = raw_data['label']
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'netbox_client_ruby/entities'
|
2
|
+
require 'netbox_client_ruby/api/ipam/ip_range'
|
3
|
+
|
4
|
+
module NetboxClientRuby
|
5
|
+
module IPAM
|
6
|
+
class IpRanges
|
7
|
+
include Entities
|
8
|
+
|
9
|
+
path 'ipam/ip-ranges.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
|
+
IpRange.new raw_entity['id']
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -2,6 +2,8 @@ require 'netbox_client_ruby/api/ipam/aggregate'
|
|
2
2
|
require 'netbox_client_ruby/api/ipam/aggregates'
|
3
3
|
require 'netbox_client_ruby/api/ipam/ip_addresses'
|
4
4
|
require 'netbox_client_ruby/api/ipam/ip_address'
|
5
|
+
require 'netbox_client_ruby/api/ipam/ip_ranges'
|
6
|
+
require 'netbox_client_ruby/api/ipam/ip_range'
|
5
7
|
require 'netbox_client_ruby/api/ipam/prefix'
|
6
8
|
require 'netbox_client_ruby/api/ipam/prefixes'
|
7
9
|
require 'netbox_client_ruby/api/ipam/rir'
|
@@ -23,6 +25,7 @@ module NetboxClientRuby
|
|
23
25
|
{
|
24
26
|
aggregates: Aggregates,
|
25
27
|
ip_addresses: IpAddresses,
|
28
|
+
ip_ranges: IpRanges,
|
26
29
|
prefixes: Prefixes,
|
27
30
|
rirs: Rirs,
|
28
31
|
roles: Roles,
|
@@ -37,6 +40,7 @@ module NetboxClientRuby
|
|
37
40
|
{
|
38
41
|
aggregate: Aggregate,
|
39
42
|
ip_address: IpAddress,
|
43
|
+
ip_range: IpRange,
|
40
44
|
prefix: Prefix,
|
41
45
|
rir: Rir,
|
42
46
|
role: Role,
|
data/netbox-client-ruby.gemspec
CHANGED
@@ -26,11 +26,11 @@ Gem::Specification.new do |spec|
|
|
26
26
|
spec.required_ruby_version = '>= 2.6.0'
|
27
27
|
|
28
28
|
spec.add_runtime_dependency 'dry-configurable', '~> 0.13.0'
|
29
|
-
spec.add_runtime_dependency 'faraday', '
|
29
|
+
spec.add_runtime_dependency 'faraday', '>= 0.11.0', '< 2'
|
30
30
|
spec.add_runtime_dependency 'faraday-detailed_logger', '~> 2.1'
|
31
|
-
spec.add_runtime_dependency 'faraday_middleware', '
|
31
|
+
spec.add_runtime_dependency 'faraday_middleware', '>= 0.11', '< 2'
|
32
32
|
spec.add_runtime_dependency 'ipaddress', '~> 0.8', '>= 0.8.3'
|
33
|
-
spec.add_runtime_dependency 'openssl', '
|
33
|
+
spec.add_runtime_dependency 'openssl', '>= 2.0.5'
|
34
34
|
|
35
35
|
spec.add_development_dependency 'bundler', '~> 2.1'
|
36
36
|
spec.add_development_dependency 'pry', '~> 0.10'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: netbox-client-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Christian Mäder
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-12-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dry-configurable
|
@@ -31,9 +31,9 @@ dependencies:
|
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: 0.11.0
|
34
|
-
- - "
|
34
|
+
- - "<"
|
35
35
|
- !ruby/object:Gem::Version
|
36
|
-
version: '
|
36
|
+
version: '2'
|
37
37
|
type: :runtime
|
38
38
|
prerelease: false
|
39
39
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -41,9 +41,9 @@ dependencies:
|
|
41
41
|
- - ">="
|
42
42
|
- !ruby/object:Gem::Version
|
43
43
|
version: 0.11.0
|
44
|
-
- - "
|
44
|
+
- - "<"
|
45
45
|
- !ruby/object:Gem::Version
|
46
|
-
version: '
|
46
|
+
version: '2'
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: faraday-detailed_logger
|
49
49
|
requirement: !ruby/object:Gem::Requirement
|
@@ -62,16 +62,22 @@ dependencies:
|
|
62
62
|
name: faraday_middleware
|
63
63
|
requirement: !ruby/object:Gem::Requirement
|
64
64
|
requirements:
|
65
|
-
- - "
|
65
|
+
- - ">="
|
66
66
|
- !ruby/object:Gem::Version
|
67
67
|
version: '0.11'
|
68
|
+
- - "<"
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: '2'
|
68
71
|
type: :runtime
|
69
72
|
prerelease: false
|
70
73
|
version_requirements: !ruby/object:Gem::Requirement
|
71
74
|
requirements:
|
72
|
-
- - "
|
75
|
+
- - ">="
|
73
76
|
- !ruby/object:Gem::Version
|
74
77
|
version: '0.11'
|
78
|
+
- - "<"
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
version: '2'
|
75
81
|
- !ruby/object:Gem::Dependency
|
76
82
|
name: ipaddress
|
77
83
|
requirement: !ruby/object:Gem::Requirement
|
@@ -96,9 +102,6 @@ dependencies:
|
|
96
102
|
name: openssl
|
97
103
|
requirement: !ruby/object:Gem::Requirement
|
98
104
|
requirements:
|
99
|
-
- - "~>"
|
100
|
-
- !ruby/object:Gem::Version
|
101
|
-
version: '2.0'
|
102
105
|
- - ">="
|
103
106
|
- !ruby/object:Gem::Version
|
104
107
|
version: 2.0.5
|
@@ -106,9 +109,6 @@ dependencies:
|
|
106
109
|
prerelease: false
|
107
110
|
version_requirements: !ruby/object:Gem::Requirement
|
108
111
|
requirements:
|
109
|
-
- - "~>"
|
110
|
-
- !ruby/object:Gem::Version
|
111
|
-
version: '2.0'
|
112
112
|
- - ">="
|
113
113
|
- !ruby/object:Gem::Version
|
114
114
|
version: 2.0.5
|
@@ -204,6 +204,7 @@ extensions: []
|
|
204
204
|
extra_rdoc_files: []
|
205
205
|
files:
|
206
206
|
- ".dockerignore"
|
207
|
+
- ".github/workflows/codeql-analysis.yml"
|
207
208
|
- ".github/workflows/gem-push.yml"
|
208
209
|
- ".github/workflows/rspec.yml"
|
209
210
|
- ".gitignore"
|
@@ -288,6 +289,8 @@ files:
|
|
288
289
|
- lib/netbox_client_ruby/api/ipam/aggregates.rb
|
289
290
|
- lib/netbox_client_ruby/api/ipam/ip_address.rb
|
290
291
|
- lib/netbox_client_ruby/api/ipam/ip_addresses.rb
|
292
|
+
- lib/netbox_client_ruby/api/ipam/ip_range.rb
|
293
|
+
- lib/netbox_client_ruby/api/ipam/ip_ranges.rb
|
291
294
|
- lib/netbox_client_ruby/api/ipam/prefix.rb
|
292
295
|
- lib/netbox_client_ruby/api/ipam/prefixes.rb
|
293
296
|
- lib/netbox_client_ruby/api/ipam/rir.rb
|