netbox-client-ruby 0.5.6 → 0.7.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3aa57ef278da6adb8d9ce15c863b4dd039ed08504447f4f685769084115270f2
4
- data.tar.gz: '099904cdb69cb9169e200f0a61cebc1eab93a8ac24857688d0c42e18131a7257'
3
+ metadata.gz: 50a77d703f7329b04d26b28dee592d7dd55e560bfe3082c8c6e9f5f5a5dd1df1
4
+ data.tar.gz: 41d4fb8832e252d9eb7a5085c29e56850d4bdae105f4fa2b836671a60098bf9d
5
5
  SHA512:
6
- metadata.gz: 63597888ded26ba4e28121c5453caf16c613cb80cc966f5800eeb4473a8d777ccd1d0816b67bcf70b6dde61a8ca93cc5364d791a73b7c966b03cc8dff85fb357
7
- data.tar.gz: 3d8d4ebb1ba8d3110aa9d1bc9010a5d95f3e2c33af16628da92f19267bf7cad2923f8a26cfed35bba61584718d8c2d208f30dbb21996e32240de67aff8559e05
6
+ metadata.gz: afaf288b3771669f1f8606792046e0db0b89b6b77cfef65ce85224109a38a212b518dbaeacbd3c68d228aeade56e925b9c5eb3eab5f9bc649989fe51ad4f16b1
7
+ data.tar.gz: 695e673b4833f1d2de88d32fbcdec16fb850fb7fedff59cc983e5e98b1f71fd9462975e5452289633f7e399d419f110e7ef8169c7bd561b1c3bff6388a324ebd
@@ -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
@@ -14,7 +14,7 @@ jobs:
14
14
  fail-fast: false
15
15
  matrix:
16
16
  os: [ubuntu-latest]
17
- ruby: [2.5, 2.6, 2.7, 3.0]
17
+ ruby: [2.6, 2.7, 3.0]
18
18
  runs-on: ${{ matrix.os }}
19
19
  steps:
20
20
  - uses: actions/checkout@v2
data/README.md CHANGED
@@ -162,9 +162,14 @@ Not all objects which the Netbox API exposes are currently implemented. Implemen
162
162
  * Virtual Chassis: `NetboxClientRuby.dcim.virtual_chassis_list`
163
163
  (⚠️ Exception: The access is different and the class is called `VirtualChassisList` because the plural and singular
164
164
  names are the same and this poses a conflict.)
165
+ * Extras:
166
+ * Config Contexts: `NetboxClientRuby.extras.config_contexts`
167
+ * Journal Entries: `NetboxClientRuby.extras.journal_entries`
168
+ * Tags: `NetboxClientRuby.extras.tags`
165
169
  * IPAM:
166
170
  * Aggregates: `NetboxClientRuby.ipam.aggregates`
167
171
  * IP Addresses: `NetboxClientRuby.ipam.ip_addresses`
172
+ * IP Ranges: `NetboxClientRuby.ipam.ip_ranges`
168
173
  * Prefixes: `NetboxClientRuby.ipam.prefixes`
169
174
  * RIRs: `NetboxClientRuby.ipam.rirs`
170
175
  * Roles: `NetboxClientRuby.ipam.roles`
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.5.6
1
+ 0.7.0
@@ -0,0 +1,25 @@
1
+ require 'netbox_client_ruby/entity'
2
+
3
+ module NetboxClientRuby
4
+ module Extras
5
+ class ConfigContext
6
+ include Entity
7
+
8
+ id id: :id
9
+ deletable true
10
+ path 'extras/config-contexts/:id.json'
11
+ creation_path 'extras/config-contexts/'
12
+ object_fields(
13
+ regions: proc { |raw_data| DCIM::Region.new raw_data['id'] },
14
+ sites: proc { |raw_data| DCIM::Site.new raw_data['id'] },
15
+ roles: proc { |raw_data| DCIM::DeviceRole.new raw_data['id'] },
16
+ platforms: proc { |raw_data| DCIM::Platform.new raw_data['id'] },
17
+ cluster_groups: proc { |raw_data| Virtualization::ClusterGroup.new raw_data['id'] },
18
+ clusters: proc { |raw_data| Virtualization::Cluster.new raw_data['id'] },
19
+ tenant_groups: proc { |raw_data| Tenancy::TenantGroup.new raw_data['id'] },
20
+ tenants: proc { |raw_data| Tenancy::Tenant.new raw_data['id'] },
21
+ tags: proc { |raw_data| Tag.new raw_data['id'] }
22
+ )
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,21 @@
1
+ require 'netbox_client_ruby/entities'
2
+ require 'netbox_client_ruby/api/extras/config_context'
3
+
4
+ module NetboxClientRuby
5
+ module Extras
6
+ class ConfigContexts
7
+ include Entities
8
+
9
+ path 'extras/config-contexts.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
+ ConfigContext.new raw_entity['id']
18
+ end
19
+ end
20
+ end
21
+ end
@@ -1,3 +1,5 @@
1
+ require 'netbox_client_ruby/api/extras/config_context'
2
+ require 'netbox_client_ruby/api/extras/config_contexts'
1
3
  require 'netbox_client_ruby/api/extras/journal_entry'
2
4
  require 'netbox_client_ruby/api/extras/journal_entries'
3
5
  require 'netbox_client_ruby/api/extras/tag'
@@ -6,6 +8,7 @@ require 'netbox_client_ruby/api/extras/tags'
6
8
  module NetboxClientRuby
7
9
  module Extras
8
10
  {
11
+ config_contexts: ConfigContexts,
9
12
  journal_entries: JournalEntries,
10
13
  tags: Tags
11
14
  }.each_pair do |method_name, class_name|
@@ -14,6 +17,7 @@ module NetboxClientRuby
14
17
  end
15
18
 
16
19
  {
20
+ config_context: ConfigContext,
17
21
  journal_entry: JournalEntry,
18
22
  tag: Tag
19
23
  }.each_pair do |method_name, class_name|
@@ -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,
@@ -13,19 +13,19 @@ module NetboxClientRuby
13
13
  setting :rsa_private_key do
14
14
  # the default is intentionally not `~/.ssh/id_rsa`,
15
15
  # to not accidentally leak someone's main rsa private key
16
- setting :path, '~/.ssh/netbox_rsa'
16
+ setting :path, default: '~/.ssh/netbox_rsa'
17
17
  setting :password
18
18
  end
19
19
  end
20
20
  setting :pagination do
21
- setting :default_limit, 50
22
- setting :max_limit, MAX_SIGNED_64BIT_INT
21
+ setting :default_limit, default: 50
22
+ setting :max_limit, default: MAX_SIGNED_64BIT_INT
23
23
  end
24
24
  end
25
25
 
26
26
  setting :faraday do
27
- setting :adapter, :net_http
27
+ setting :adapter, default: :net_http
28
28
  setting :logger
29
- setting :request_options, open_timeout: 1, timeout: 5
29
+ setting :request_options, default: { open_timeout: 1, timeout: 5 }
30
30
  end
31
31
  end
@@ -23,10 +23,12 @@ Gem::Specification.new do |spec|
23
23
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
24
24
  spec.require_paths = ['lib']
25
25
 
26
- spec.add_runtime_dependency 'dry-configurable', '~> 0.1'
27
- spec.add_runtime_dependency 'faraday', '~> 0.11', '>= 0.11.0'
26
+ spec.required_ruby_version = '>= 2.6.0'
27
+
28
+ spec.add_runtime_dependency 'dry-configurable', '~> 0.13.0'
29
+ spec.add_runtime_dependency 'faraday', '>= 0.11.0', '< 2'
28
30
  spec.add_runtime_dependency 'faraday-detailed_logger', '~> 2.1'
29
- spec.add_runtime_dependency 'faraday_middleware', '~> 0.11'
31
+ spec.add_runtime_dependency 'faraday_middleware', '>= 0.11', '< 2'
30
32
  spec.add_runtime_dependency 'ipaddress', '~> 0.8', '>= 0.8.3'
31
33
  spec.add_runtime_dependency 'openssl', '~> 2.0', '>= 2.0.5'
32
34
 
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.5.6
4
+ version: 0.7.0
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: 2021-05-27 00:00:00.000000000 Z
11
+ date: 2022-07-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dry-configurable
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0.1'
19
+ version: 0.13.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '0.1'
26
+ version: 0.13.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: faraday
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -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: '0.11'
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: '0.11'
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
@@ -204,6 +210,7 @@ extensions: []
204
210
  extra_rdoc_files: []
205
211
  files:
206
212
  - ".dockerignore"
213
+ - ".github/workflows/codeql-analysis.yml"
207
214
  - ".github/workflows/gem-push.yml"
208
215
  - ".github/workflows/rspec.yml"
209
216
  - ".gitignore"
@@ -277,6 +284,8 @@ files:
277
284
  - lib/netbox_client_ruby/api/dcim/virtual_chassis.rb
278
285
  - lib/netbox_client_ruby/api/dcim/virtual_chassis_list.rb
279
286
  - lib/netbox_client_ruby/api/extras.rb
287
+ - lib/netbox_client_ruby/api/extras/config_context.rb
288
+ - lib/netbox_client_ruby/api/extras/config_contexts.rb
280
289
  - lib/netbox_client_ruby/api/extras/journal_entries.rb
281
290
  - lib/netbox_client_ruby/api/extras/journal_entry.rb
282
291
  - lib/netbox_client_ruby/api/extras/tag.rb
@@ -286,6 +295,8 @@ files:
286
295
  - lib/netbox_client_ruby/api/ipam/aggregates.rb
287
296
  - lib/netbox_client_ruby/api/ipam/ip_address.rb
288
297
  - lib/netbox_client_ruby/api/ipam/ip_addresses.rb
298
+ - lib/netbox_client_ruby/api/ipam/ip_range.rb
299
+ - lib/netbox_client_ruby/api/ipam/ip_ranges.rb
289
300
  - lib/netbox_client_ruby/api/ipam/prefix.rb
290
301
  - lib/netbox_client_ruby/api/ipam/prefixes.rb
291
302
  - lib/netbox_client_ruby/api/ipam/rir.rb
@@ -345,7 +356,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
345
356
  requirements:
346
357
  - - ">="
347
358
  - !ruby/object:Gem::Version
348
- version: '0'
359
+ version: 2.6.0
349
360
  required_rubygems_version: !ruby/object:Gem::Requirement
350
361
  requirements:
351
362
  - - ">="