opn_api 0.1.0 → 1.0.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/CHANGELOG.md +11 -1
- data/README.md +1 -1
- data/lib/opn_api/client.rb +3 -3
- data/lib/opn_api/config.rb +3 -3
- data/lib/opn_api/id_resolver.rb +1 -1
- data/lib/opn_api/service_reconfigure.rb +2 -2
- data/lib/opn_api/version.rb +1 -1
- metadata +3 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4849faffbc79c96ff2c9cd0b00d0b22ddb376fefc1179bef6759d87571becbce
|
|
4
|
+
data.tar.gz: 6b37d3cdb52fd5d71e4ad1a9daa1e01fd30a308344e49dad1be66016a26b3e9a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 04a49796e1ab3bf2a1fdbe5eb01ad7d7487c7396e54d5a020480c7113925afb5a3dfbeb1cbe6cfc08d72929684e4d0e6f2e99bb4cdce473f9ab46e36f0de1928
|
|
7
|
+
data.tar.gz: 8c3cded6629294868dfce670e77fd724f099018b03859efd0540fb70eb09d72ed000802fb77565a2487a50a8939d3440fa51b609052f15bc29b43cdc3a0124d7
|
data/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,16 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
|
|
6
6
|
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
-
## 0.
|
|
8
|
+
## [v1.0.0] - 2026-03-17
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
* Add GitHub Actions CI workflow
|
|
12
|
+
|
|
13
|
+
### Fixed
|
|
14
|
+
* Fix unit tests
|
|
15
|
+
|
|
16
|
+
## v0.1.0 - 2026-03-16
|
|
9
17
|
|
|
10
18
|
Initial release.
|
|
19
|
+
|
|
20
|
+
[v1.0.0]: https://github.com/markt-de/opn-api/compare/v0.1.0...v1.0.0
|
data/README.md
CHANGED
|
@@ -928,7 +928,7 @@ results = OpnApi::ServiceReconfigure[:haproxy].run
|
|
|
928
928
|
|
|
929
929
|
### Config loader
|
|
930
930
|
|
|
931
|
-
`OpnApi::Config` loads device credentials from YAML files with a hierarchical search path. Supports multiple devices and is compatible with puppet-opn's device file format.
|
|
931
|
+
`OpnApi::Config` loads device credentials from YAML files with a hierarchical search path. Supports multiple devices and is compatible with [puppet-opn's](https://github.com/markt-de/puppet-opn) device file format.
|
|
932
932
|
|
|
933
933
|
### ID resolver
|
|
934
934
|
|
data/lib/opn_api/client.rb
CHANGED
|
@@ -13,7 +13,7 @@ module OpnApi
|
|
|
13
13
|
#
|
|
14
14
|
# @example Direct instantiation
|
|
15
15
|
# client = OpnApi::Client.new(
|
|
16
|
-
# url: 'https://
|
|
16
|
+
# url: 'https://opnsense01.example.com/api',
|
|
17
17
|
# api_key: '+ABC...', api_secret: '+XYZ...',
|
|
18
18
|
# ssl_verify: false,
|
|
19
19
|
# )
|
|
@@ -21,12 +21,12 @@ module OpnApi
|
|
|
21
21
|
#
|
|
22
22
|
# @example From Config
|
|
23
23
|
# config = OpnApi::Config.new
|
|
24
|
-
# client = config.client_for('
|
|
24
|
+
# client = config.client_for('opnsense01')
|
|
25
25
|
class Client
|
|
26
26
|
DEFAULT_URL = 'http://localhost:80/api'
|
|
27
27
|
MAX_REDIRECTS = 5
|
|
28
28
|
|
|
29
|
-
# @param url [String] Base URL of the OPNsense API (e.g. 'https://
|
|
29
|
+
# @param url [String] Base URL of the OPNsense API (e.g. 'https://opnsense01.example.com/api')
|
|
30
30
|
# @param api_key [String] OPNsense API key
|
|
31
31
|
# @param api_secret [String] OPNsense API secret
|
|
32
32
|
# @param ssl_verify [Boolean] Whether to verify SSL certificates (default: true)
|
data/lib/opn_api/config.rb
CHANGED
|
@@ -23,12 +23,12 @@ module OpnApi
|
|
|
23
23
|
#
|
|
24
24
|
# @example
|
|
25
25
|
# config = OpnApi::Config.new
|
|
26
|
-
# config.device_names # => ['
|
|
27
|
-
# client = config.client_for('
|
|
26
|
+
# config.device_names # => ['opnsense01', 'backup']
|
|
27
|
+
# client = config.client_for('opnsense01')
|
|
28
28
|
#
|
|
29
29
|
# @example With explicit path (e.g. for puppet-opn integration)
|
|
30
30
|
# config = OpnApi::Config.new(config_dir: '/etc/puppetlabs/puppet/opn')
|
|
31
|
-
# client = config.client_for('
|
|
31
|
+
# client = config.client_for('opnsense01')
|
|
32
32
|
class Config
|
|
33
33
|
SYSTEM_DIR = '/etc/opn-api/devices'
|
|
34
34
|
USER_DIR = File.join(Dir.home, '.config', 'opn-api', 'devices')
|
data/lib/opn_api/id_resolver.rb
CHANGED
|
@@ -17,7 +17,7 @@ module OpnApi
|
|
|
17
17
|
# 'linkedServers' => { endpoint: 'haproxy/settings/search_servers', multiple: true },
|
|
18
18
|
# 'sslCA' => { endpoint: 'trust/ca/search', id_field: 'refid', name_field: 'descr' },
|
|
19
19
|
# }
|
|
20
|
-
# translated = OpnApi::IdResolver.translate_to_names(client, '
|
|
20
|
+
# translated = OpnApi::IdResolver.translate_to_names(client, 'opnsense01', relation_fields, config)
|
|
21
21
|
module IdResolver
|
|
22
22
|
UUID_RE = %r{\A[0-9a-f]{8}(-[0-9a-f]{4}){3}-[0-9a-f]{12}\z}
|
|
23
23
|
|
|
@@ -16,9 +16,9 @@ module OpnApi
|
|
|
16
16
|
# endpoint: 'ipsec/service/reconfigure',
|
|
17
17
|
# log_prefix: 'opn_ipsec')
|
|
18
18
|
#
|
|
19
|
-
# OpnApi::ServiceReconfigure[:ipsec].mark('
|
|
19
|
+
# OpnApi::ServiceReconfigure[:ipsec].mark('opnsense01', client)
|
|
20
20
|
# results = OpnApi::ServiceReconfigure[:ipsec].run
|
|
21
|
-
# # => { '
|
|
21
|
+
# # => { 'opnsense01' => :ok }
|
|
22
22
|
class ServiceReconfigure
|
|
23
23
|
# Global registry of named instances.
|
|
24
24
|
@registry = {}
|
data/lib/opn_api/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: opn_api
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 1.0.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- markt-de
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: bin
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies: []
|
|
13
12
|
description: |
|
|
14
13
|
A standalone Ruby library and command-line tool for communicating with
|
|
@@ -51,7 +50,6 @@ licenses:
|
|
|
51
50
|
- BSD-2-Clause
|
|
52
51
|
metadata:
|
|
53
52
|
rubygems_mfa_required: 'true'
|
|
54
|
-
post_install_message:
|
|
55
53
|
rdoc_options: []
|
|
56
54
|
require_paths:
|
|
57
55
|
- lib
|
|
@@ -66,8 +64,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
66
64
|
- !ruby/object:Gem::Version
|
|
67
65
|
version: '0'
|
|
68
66
|
requirements: []
|
|
69
|
-
rubygems_version:
|
|
70
|
-
signing_key:
|
|
67
|
+
rubygems_version: 4.0.6
|
|
71
68
|
specification_version: 4
|
|
72
69
|
summary: Ruby client library and CLI for the OPNsense REST API
|
|
73
70
|
test_files: []
|