lex-cloudflare 0.1.0 → 0.1.1
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 +9 -0
- data/CLAUDE.md +21 -8
- data/lib/legion/extensions/cloudflare/accounts/client.rb +23 -0
- data/lib/legion/extensions/cloudflare/accounts/runners/accounts.rb +55 -0
- data/lib/legion/extensions/cloudflare/accounts/runners/members.rb +45 -0
- data/lib/legion/extensions/cloudflare/accounts/runners/roles.rb +29 -0
- data/lib/legion/extensions/cloudflare/accounts/runners/tokens.rb +41 -0
- data/lib/legion/extensions/cloudflare/accounts.rb +16 -0
- data/lib/legion/extensions/cloudflare/ai/client.rb +3 -13
- data/lib/legion/extensions/cloudflare/ai/runners/finetunes.rb +1 -1
- data/lib/legion/extensions/cloudflare/ai/runners/models.rb +1 -1
- data/lib/legion/extensions/cloudflare/ai.rb +0 -1
- data/lib/legion/extensions/cloudflare/ai_gateway/client.rb +3 -13
- data/lib/legion/extensions/cloudflare/ai_gateway/runners/datasets.rb +1 -1
- data/lib/legion/extensions/cloudflare/ai_gateway/runners/evaluations.rb +1 -1
- data/lib/legion/extensions/cloudflare/ai_gateway/runners/gateways.rb +1 -1
- data/lib/legion/extensions/cloudflare/ai_gateway/runners/logs.rb +1 -1
- data/lib/legion/extensions/cloudflare/ai_gateway.rb +0 -1
- data/lib/legion/extensions/cloudflare/base_client.rb +21 -0
- data/lib/legion/extensions/cloudflare/custom_nameservers/client.rb +3 -13
- data/lib/legion/extensions/cloudflare/custom_nameservers/runners/nameservers.rb +1 -1
- data/lib/legion/extensions/cloudflare/custom_nameservers.rb +0 -1
- data/lib/legion/extensions/cloudflare/dns/client.rb +3 -13
- data/lib/legion/extensions/cloudflare/dns/runners/dnssec.rb +1 -1
- data/lib/legion/extensions/cloudflare/dns/runners/records.rb +1 -1
- data/lib/legion/extensions/cloudflare/dns.rb +0 -1
- data/lib/legion/extensions/cloudflare/dns_firewall/client.rb +3 -13
- data/lib/legion/extensions/cloudflare/dns_firewall/runners/analytics.rb +1 -1
- data/lib/legion/extensions/cloudflare/dns_firewall/runners/clusters.rb +1 -1
- data/lib/legion/extensions/cloudflare/dns_firewall.rb +0 -1
- data/lib/legion/extensions/cloudflare/helpers/client.rb +22 -0
- data/lib/legion/extensions/cloudflare/ssl/client.rb +3 -13
- data/lib/legion/extensions/cloudflare/ssl/runners/certificate_packs.rb +1 -1
- data/lib/legion/extensions/cloudflare/ssl/runners/universal.rb +1 -1
- data/lib/legion/extensions/cloudflare/ssl.rb +0 -1
- data/lib/legion/extensions/cloudflare/vectorize/client.rb +3 -13
- data/lib/legion/extensions/cloudflare/vectorize/runners/indexes.rb +1 -1
- data/lib/legion/extensions/cloudflare/vectorize/runners/vectors.rb +1 -1
- data/lib/legion/extensions/cloudflare/vectorize.rb +0 -1
- data/lib/legion/extensions/cloudflare/version.rb +1 -1
- data/lib/legion/extensions/cloudflare/zero_trust/client.rb +3 -13
- data/lib/legion/extensions/cloudflare/zero_trust/runners/devices.rb +1 -1
- data/lib/legion/extensions/cloudflare/zero_trust/runners/dex_tests.rb +1 -1
- data/lib/legion/extensions/cloudflare/zero_trust/runners/ip_profiles.rb +1 -1
- data/lib/legion/extensions/cloudflare/zero_trust/runners/registrations.rb +1 -1
- data/lib/legion/extensions/cloudflare/zero_trust.rb +0 -1
- data/lib/legion/extensions/cloudflare/zones/client.rb +19 -0
- data/lib/legion/extensions/cloudflare/zones/runners/settings.rb +28 -0
- data/lib/legion/extensions/cloudflare/zones/runners/zones.rb +52 -0
- data/lib/legion/extensions/cloudflare/zones.rb +14 -0
- data/lib/legion/extensions/cloudflare.rb +4 -0
- metadata +13 -9
- data/lib/legion/extensions/cloudflare/ai/helpers/client.rb +0 -24
- data/lib/legion/extensions/cloudflare/ai_gateway/helpers/client.rb +0 -24
- data/lib/legion/extensions/cloudflare/custom_nameservers/helpers/client.rb +0 -24
- data/lib/legion/extensions/cloudflare/dns/helpers/client.rb +0 -24
- data/lib/legion/extensions/cloudflare/dns_firewall/helpers/client.rb +0 -24
- data/lib/legion/extensions/cloudflare/ssl/helpers/client.rb +0 -24
- data/lib/legion/extensions/cloudflare/vectorize/helpers/client.rb +0 -24
- data/lib/legion/extensions/cloudflare/zero_trust/helpers/client.rb +0 -24
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 905688c2d1b9cdcf44b2fc5fe2b0026441fc8d2e99e62ffe4171655daae295f4
|
|
4
|
+
data.tar.gz: 6124eb6862a427248fa191e8c3d55c82c8b64d99913de5f612761ef762d72875
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f289ed87b24a4b25b690e1c64ed85b67c06291ceebd94d566266d32c996a67288cb4c004250d9600d03dee92ee106aa77c774a9dc9962f8ea850b2d84a58d794
|
|
7
|
+
data.tar.gz: 1f5d2d7efb53ba7edc6acb61d5c6e5f0e35db084f019c4aeee6ddd29d3aa3ad669d667d429358ebfbc0155f91a9b92ee1217fb613164ec8df3d541cbbdad65b2
|
data/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
## [Unreleased]
|
|
4
4
|
|
|
5
|
+
## [0.1.1] - 2026-03-24
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
- Zones sub-module: zone CRUD, activation check, and zone settings (list/get)
|
|
9
|
+
- Accounts sub-module: account CRUD, profile, members, roles, and API token management
|
|
10
|
+
- 45 new specs covering all Zones and Accounts runners and clients (165 total)
|
|
11
|
+
|
|
12
|
+
## [0.1.0] - 2026-03-24
|
|
13
|
+
|
|
5
14
|
### Added
|
|
6
15
|
- Initial implementation with Dns, DnsFirewall, CustomNameservers, ZeroTrust, Ssl, Vectorize, AiGateway, and Ai sub-modules
|
|
7
16
|
- Dns: DNS records CRUD and DNSSEC management (zone-scoped)
|
data/CLAUDE.md
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
## Purpose
|
|
8
8
|
|
|
9
|
-
Monolith Legion Extension connecting LegionIO to Cloudflare services. Implements
|
|
9
|
+
Monolith Legion Extension connecting LegionIO to Cloudflare services. Implements 10 sub-modules covering DNS, network security, Zero Trust, SSL, Vectorize, AI, Zones, and Accounts via the Cloudflare REST API v4.
|
|
10
10
|
|
|
11
11
|
**GitHub**: https://github.com/LegionIO/lex-cloudflare
|
|
12
12
|
**License**: MIT
|
|
@@ -54,10 +54,20 @@ Legion::Extensions::Cloudflare
|
|
|
54
54
|
│ ├── Runners::Datasets # Dataset CRUD
|
|
55
55
|
│ ├── Runners::Evaluations # Evaluation CRUD
|
|
56
56
|
│ └── Client
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
57
|
+
├── Ai/ # Account-scoped Workers AI
|
|
58
|
+
│ ├── Helpers::Client
|
|
59
|
+
│ ├── Runners::Models # Model execution, search, schema, markdown conversion
|
|
60
|
+
│ ├── Runners::Finetunes # Finetune management, public listing
|
|
61
|
+
│ └── Client
|
|
62
|
+
├── Zones/ # Zone lifecycle management
|
|
63
|
+
│ ├── Runners::Zones # Zone CRUD, activation check
|
|
64
|
+
│ ├── Runners::Settings # Zone settings list/get
|
|
65
|
+
│ └── Client
|
|
66
|
+
└── Accounts/ # Account and IAM management
|
|
67
|
+
├── Runners::Accounts # Account CRUD, profile
|
|
68
|
+
├── Runners::Members # Member invite/update/remove
|
|
69
|
+
├── Runners::Roles # Role list/get
|
|
70
|
+
├── Runners::Tokens # API token CRUD
|
|
61
71
|
└── Client
|
|
62
72
|
```
|
|
63
73
|
|
|
@@ -82,8 +92,9 @@ Base URL: `https://api.cloudflare.com/client/v4`
|
|
|
82
92
|
|
|
83
93
|
| Scope | Sub-modules | Path pattern |
|
|
84
94
|
|-------|-------------|--------------|
|
|
85
|
-
| Zone | Dns, Ssl | `/zones/{zone_id}/...` |
|
|
86
|
-
| Account | DnsFirewall, CustomNameservers, ZeroTrust, Vectorize, AiGateway, Ai | `/accounts/{account_id}/...` |
|
|
95
|
+
| Zone | Dns, Ssl, Zones | `/zones/{zone_id}/...` |
|
|
96
|
+
| Account | DnsFirewall, CustomNameservers, ZeroTrust, Vectorize, AiGateway, Ai, Accounts | `/accounts/{account_id}/...` |
|
|
97
|
+
| Top-level | Zones (list/create), Accounts (list/create) | `/zones`, `/accounts` |
|
|
87
98
|
|
|
88
99
|
## API Coverage
|
|
89
100
|
|
|
@@ -97,6 +108,8 @@ Base URL: `https://api.cloudflare.com/client/v4`
|
|
|
97
108
|
| Vectorize | Indexes, Vectors | `list_indexes`, `create_index`, `query`, `insert`, `upsert`, `get_by_ids`, `list_metadata_indexes` |
|
|
98
109
|
| AiGateway | Gateways, Logs, Datasets, Evaluations | `list_gateways`, `create_gateway`, `list_logs`, `patch_log`, `list_datasets`, `list_evaluations` |
|
|
99
110
|
| Ai | Models, Finetunes | `run`, `search_models`, `model_schema`, `to_markdown`, `list_finetunes`, `create_finetune` |
|
|
111
|
+
| Zones | Zones, Settings | `list`, `get`, `create`, `update`, `delete`, `activation_check`, `list_settings`, `get_setting` |
|
|
112
|
+
| Accounts | Accounts, Members, Roles, Tokens | `list`, `get`, `create`, `update`, `delete`, `get_profile`, `list_members`, `add_member`, `list_roles`, `list_tokens`, `create_token` |
|
|
100
113
|
|
|
101
114
|
## Dependencies
|
|
102
115
|
|
|
@@ -106,7 +119,7 @@ Base URL: `https://api.cloudflare.com/client/v4`
|
|
|
106
119
|
|
|
107
120
|
## Development
|
|
108
121
|
|
|
109
|
-
|
|
122
|
+
165 specs total (0 failures).
|
|
110
123
|
|
|
111
124
|
```bash
|
|
112
125
|
bundle install
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative '../helpers/client'
|
|
4
|
+
require_relative '../base_client'
|
|
5
|
+
require_relative 'runners/accounts'
|
|
6
|
+
require_relative 'runners/members'
|
|
7
|
+
require_relative 'runners/roles'
|
|
8
|
+
require_relative 'runners/tokens'
|
|
9
|
+
|
|
10
|
+
module Legion
|
|
11
|
+
module Extensions
|
|
12
|
+
module Cloudflare
|
|
13
|
+
module Accounts
|
|
14
|
+
class Client < Legion::Extensions::Cloudflare::BaseClient
|
|
15
|
+
include Runners::Accounts
|
|
16
|
+
include Runners::Members
|
|
17
|
+
include Runners::Roles
|
|
18
|
+
include Runners::Tokens
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Legion
|
|
4
|
+
module Extensions
|
|
5
|
+
module Cloudflare
|
|
6
|
+
module Accounts
|
|
7
|
+
module Runners
|
|
8
|
+
module Accounts
|
|
9
|
+
extend Legion::Extensions::Cloudflare::Helpers::Client
|
|
10
|
+
|
|
11
|
+
def list(page: nil, per_page: nil, name: nil, **)
|
|
12
|
+
params = { page: page, per_page: per_page, name: name }.compact
|
|
13
|
+
response = client(**).get('/accounts', params)
|
|
14
|
+
{ result: response.body, status: response.status }
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def get(account_id:, **)
|
|
18
|
+
response = client(**).get("/accounts/#{account_id}")
|
|
19
|
+
{ result: response.body, status: response.status }
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def create(name:, type: nil, **)
|
|
23
|
+
body = { name: name, type: type }.compact
|
|
24
|
+
response = client(**).post('/accounts', body)
|
|
25
|
+
{ result: response.body, status: response.status }
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def update(account_id:, body:, **)
|
|
29
|
+
response = client(**).put("/accounts/#{account_id}", body)
|
|
30
|
+
{ result: response.body, status: response.status }
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def delete(account_id:, **)
|
|
34
|
+
response = client(**).delete("/accounts/#{account_id}")
|
|
35
|
+
{ result: response.body, status: response.status }
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def get_profile(account_id:, **)
|
|
39
|
+
response = client(**).get("/accounts/#{account_id}/profile")
|
|
40
|
+
{ result: response.body, status: response.status }
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def update_profile(account_id:, body:, **)
|
|
44
|
+
response = client(**).put("/accounts/#{account_id}/profile", body)
|
|
45
|
+
{ result: response.body, status: response.status }
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
include Legion::Extensions::Helpers::Lex if Legion::Extensions.const_defined?(:Helpers) &&
|
|
49
|
+
Legion::Extensions::Helpers.const_defined?(:Lex)
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
end
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Legion
|
|
4
|
+
module Extensions
|
|
5
|
+
module Cloudflare
|
|
6
|
+
module Accounts
|
|
7
|
+
module Runners
|
|
8
|
+
module Members
|
|
9
|
+
extend Legion::Extensions::Cloudflare::Helpers::Client
|
|
10
|
+
|
|
11
|
+
def list_members(account_id:, page: nil, per_page: nil, status: nil, **)
|
|
12
|
+
params = { page: page, per_page: per_page, status: status }.compact
|
|
13
|
+
response = client(**).get("/accounts/#{account_id}/members", params)
|
|
14
|
+
{ result: response.body, status: response.status }
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def get_member(account_id:, member_id:, **)
|
|
18
|
+
response = client(**).get("/accounts/#{account_id}/members/#{member_id}")
|
|
19
|
+
{ result: response.body, status: response.status }
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def add_member(account_id:, email:, roles:, **)
|
|
23
|
+
body = { email: email, roles: roles }
|
|
24
|
+
response = client(**).post("/accounts/#{account_id}/members", body)
|
|
25
|
+
{ result: response.body, status: response.status }
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def update_member(account_id:, member_id:, body:, **)
|
|
29
|
+
response = client(**).put("/accounts/#{account_id}/members/#{member_id}", body)
|
|
30
|
+
{ result: response.body, status: response.status }
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def remove_member(account_id:, member_id:, **)
|
|
34
|
+
response = client(**).delete("/accounts/#{account_id}/members/#{member_id}")
|
|
35
|
+
{ result: response.body, status: response.status }
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
include Legion::Extensions::Helpers::Lex if Legion::Extensions.const_defined?(:Helpers) &&
|
|
39
|
+
Legion::Extensions::Helpers.const_defined?(:Lex)
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
end
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Legion
|
|
4
|
+
module Extensions
|
|
5
|
+
module Cloudflare
|
|
6
|
+
module Accounts
|
|
7
|
+
module Runners
|
|
8
|
+
module Roles
|
|
9
|
+
extend Legion::Extensions::Cloudflare::Helpers::Client
|
|
10
|
+
|
|
11
|
+
def list_roles(account_id:, page: nil, per_page: nil, **)
|
|
12
|
+
params = { page: page, per_page: per_page }.compact
|
|
13
|
+
response = client(**).get("/accounts/#{account_id}/roles", params)
|
|
14
|
+
{ result: response.body, status: response.status }
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def get_role(account_id:, role_id:, **)
|
|
18
|
+
response = client(**).get("/accounts/#{account_id}/roles/#{role_id}")
|
|
19
|
+
{ result: response.body, status: response.status }
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
include Legion::Extensions::Helpers::Lex if Legion::Extensions.const_defined?(:Helpers) &&
|
|
23
|
+
Legion::Extensions::Helpers.const_defined?(:Lex)
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Legion
|
|
4
|
+
module Extensions
|
|
5
|
+
module Cloudflare
|
|
6
|
+
module Accounts
|
|
7
|
+
module Runners
|
|
8
|
+
module Tokens
|
|
9
|
+
extend Legion::Extensions::Cloudflare::Helpers::Client
|
|
10
|
+
|
|
11
|
+
def list_tokens(account_id:, page: nil, per_page: nil, **)
|
|
12
|
+
params = { page: page, per_page: per_page }.compact
|
|
13
|
+
response = client(**).get("/accounts/#{account_id}/tokens", params)
|
|
14
|
+
{ result: response.body, status: response.status }
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def get_token(account_id:, token_id:, **)
|
|
18
|
+
response = client(**).get("/accounts/#{account_id}/tokens/#{token_id}")
|
|
19
|
+
{ result: response.body, status: response.status }
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def create_token(account_id:, name:, policies:, expires_on: nil, not_before: nil, condition: nil, **)
|
|
23
|
+
body = { name: name, policies: policies, expires_on: expires_on,
|
|
24
|
+
not_before: not_before, condition: condition }.compact
|
|
25
|
+
response = client(**).post("/accounts/#{account_id}/tokens", body)
|
|
26
|
+
{ result: response.body, status: response.status }
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def update_token(account_id:, token_id:, body:, **)
|
|
30
|
+
response = client(**).put("/accounts/#{account_id}/tokens/#{token_id}", body)
|
|
31
|
+
{ result: response.body, status: response.status }
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
include Legion::Extensions::Helpers::Lex if Legion::Extensions.const_defined?(:Helpers) &&
|
|
35
|
+
Legion::Extensions::Helpers.const_defined?(:Lex)
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'legion/extensions/cloudflare/accounts/runners/accounts'
|
|
4
|
+
require 'legion/extensions/cloudflare/accounts/runners/members'
|
|
5
|
+
require 'legion/extensions/cloudflare/accounts/runners/roles'
|
|
6
|
+
require 'legion/extensions/cloudflare/accounts/runners/tokens'
|
|
7
|
+
require 'legion/extensions/cloudflare/accounts/client'
|
|
8
|
+
|
|
9
|
+
module Legion
|
|
10
|
+
module Extensions
|
|
11
|
+
module Cloudflare
|
|
12
|
+
module Accounts
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require_relative 'helpers/client'
|
|
3
|
+
require_relative '../helpers/client'
|
|
4
|
+
require_relative '../base_client'
|
|
4
5
|
require_relative 'runners/models'
|
|
5
6
|
require_relative 'runners/finetunes'
|
|
6
7
|
|
|
@@ -8,20 +9,9 @@ module Legion
|
|
|
8
9
|
module Extensions
|
|
9
10
|
module Cloudflare
|
|
10
11
|
module Ai
|
|
11
|
-
class Client
|
|
12
|
-
include Helpers::Client
|
|
12
|
+
class Client < Legion::Extensions::Cloudflare::BaseClient
|
|
13
13
|
include Runners::Models
|
|
14
14
|
include Runners::Finetunes
|
|
15
|
-
|
|
16
|
-
attr_reader :opts
|
|
17
|
-
|
|
18
|
-
def initialize(api_token:, **extra)
|
|
19
|
-
@opts = { api_token: api_token, **extra }.compact
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
def client(**override)
|
|
23
|
-
super(**@opts, **override)
|
|
24
|
-
end
|
|
25
15
|
end
|
|
26
16
|
end
|
|
27
17
|
end
|
|
@@ -6,7 +6,7 @@ module Legion
|
|
|
6
6
|
module Ai
|
|
7
7
|
module Runners
|
|
8
8
|
module Finetunes
|
|
9
|
-
extend Legion::Extensions::Cloudflare::
|
|
9
|
+
extend Legion::Extensions::Cloudflare::Helpers::Client
|
|
10
10
|
|
|
11
11
|
def list_finetunes(account_id:, **)
|
|
12
12
|
response = client(**).get("/accounts/#{account_id}/ai/finetunes")
|
|
@@ -6,7 +6,7 @@ module Legion
|
|
|
6
6
|
module Ai
|
|
7
7
|
module Runners
|
|
8
8
|
module Models
|
|
9
|
-
extend Legion::Extensions::Cloudflare::
|
|
9
|
+
extend Legion::Extensions::Cloudflare::Helpers::Client
|
|
10
10
|
|
|
11
11
|
def run(account_id:, model_name:, body:, **)
|
|
12
12
|
response = client(**).post("/accounts/#{account_id}/ai/run/#{model_name}", body)
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require_relative 'helpers/client'
|
|
3
|
+
require_relative '../helpers/client'
|
|
4
|
+
require_relative '../base_client'
|
|
4
5
|
require_relative 'runners/gateways'
|
|
5
6
|
require_relative 'runners/logs'
|
|
6
7
|
require_relative 'runners/datasets'
|
|
@@ -10,22 +11,11 @@ module Legion
|
|
|
10
11
|
module Extensions
|
|
11
12
|
module Cloudflare
|
|
12
13
|
module AiGateway
|
|
13
|
-
class Client
|
|
14
|
-
include Helpers::Client
|
|
14
|
+
class Client < Legion::Extensions::Cloudflare::BaseClient
|
|
15
15
|
include Runners::Gateways
|
|
16
16
|
include Runners::Logs
|
|
17
17
|
include Runners::Datasets
|
|
18
18
|
include Runners::Evaluations
|
|
19
|
-
|
|
20
|
-
attr_reader :opts
|
|
21
|
-
|
|
22
|
-
def initialize(api_token:, **extra)
|
|
23
|
-
@opts = { api_token: api_token, **extra }.compact
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
def client(**override)
|
|
27
|
-
super(**@opts, **override)
|
|
28
|
-
end
|
|
29
19
|
end
|
|
30
20
|
end
|
|
31
21
|
end
|
|
@@ -6,7 +6,7 @@ module Legion
|
|
|
6
6
|
module AiGateway
|
|
7
7
|
module Runners
|
|
8
8
|
module Datasets
|
|
9
|
-
extend Legion::Extensions::Cloudflare::
|
|
9
|
+
extend Legion::Extensions::Cloudflare::Helpers::Client
|
|
10
10
|
|
|
11
11
|
def list_datasets(account_id:, gateway_id:, page: nil, per_page: nil, search: nil, **)
|
|
12
12
|
params = { page: page, per_page: per_page, search: search }.compact
|
|
@@ -6,7 +6,7 @@ module Legion
|
|
|
6
6
|
module AiGateway
|
|
7
7
|
module Runners
|
|
8
8
|
module Evaluations
|
|
9
|
-
extend Legion::Extensions::Cloudflare::
|
|
9
|
+
extend Legion::Extensions::Cloudflare::Helpers::Client
|
|
10
10
|
|
|
11
11
|
def list_evaluations(account_id:, gateway_id:, page: nil, per_page: nil, **)
|
|
12
12
|
params = { page: page, per_page: per_page }.compact
|
|
@@ -6,7 +6,7 @@ module Legion
|
|
|
6
6
|
module AiGateway
|
|
7
7
|
module Runners
|
|
8
8
|
module Gateways
|
|
9
|
-
extend Legion::Extensions::Cloudflare::
|
|
9
|
+
extend Legion::Extensions::Cloudflare::Helpers::Client
|
|
10
10
|
|
|
11
11
|
def list_gateways(account_id:, page: nil, per_page: nil, search: nil, **)
|
|
12
12
|
params = { page: page, per_page: per_page, search: search }.compact
|
|
@@ -6,7 +6,7 @@ module Legion
|
|
|
6
6
|
module AiGateway
|
|
7
7
|
module Runners
|
|
8
8
|
module Logs
|
|
9
|
-
extend Legion::Extensions::Cloudflare::
|
|
9
|
+
extend Legion::Extensions::Cloudflare::Helpers::Client
|
|
10
10
|
|
|
11
11
|
def list_logs(account_id:, gateway_id:, page: nil, per_page: nil, **)
|
|
12
12
|
params = { page: page, per_page: per_page }.compact
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require 'legion/extensions/cloudflare/ai_gateway/helpers/client'
|
|
4
3
|
require 'legion/extensions/cloudflare/ai_gateway/runners/gateways'
|
|
5
4
|
require 'legion/extensions/cloudflare/ai_gateway/runners/logs'
|
|
6
5
|
require 'legion/extensions/cloudflare/ai_gateway/runners/datasets'
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Legion
|
|
4
|
+
module Extensions
|
|
5
|
+
module Cloudflare
|
|
6
|
+
class BaseClient
|
|
7
|
+
include Helpers::Client
|
|
8
|
+
|
|
9
|
+
attr_reader :opts
|
|
10
|
+
|
|
11
|
+
def initialize(api_token:, **extra)
|
|
12
|
+
@opts = { api_token: api_token, **extra }.compact
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def client(**override)
|
|
16
|
+
super(**@opts, **override)
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
@@ -1,25 +1,15 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require_relative 'helpers/client'
|
|
3
|
+
require_relative '../helpers/client'
|
|
4
|
+
require_relative '../base_client'
|
|
4
5
|
require_relative 'runners/nameservers'
|
|
5
6
|
|
|
6
7
|
module Legion
|
|
7
8
|
module Extensions
|
|
8
9
|
module Cloudflare
|
|
9
10
|
module CustomNameservers
|
|
10
|
-
class Client
|
|
11
|
-
include Helpers::Client
|
|
11
|
+
class Client < Legion::Extensions::Cloudflare::BaseClient
|
|
12
12
|
include Runners::Nameservers
|
|
13
|
-
|
|
14
|
-
attr_reader :opts
|
|
15
|
-
|
|
16
|
-
def initialize(api_token:, **extra)
|
|
17
|
-
@opts = { api_token: api_token, **extra }.compact
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
def client(**override)
|
|
21
|
-
super(**@opts, **override)
|
|
22
|
-
end
|
|
23
13
|
end
|
|
24
14
|
end
|
|
25
15
|
end
|
|
@@ -6,7 +6,7 @@ module Legion
|
|
|
6
6
|
module CustomNameservers
|
|
7
7
|
module Runners
|
|
8
8
|
module Nameservers
|
|
9
|
-
extend Legion::Extensions::Cloudflare::
|
|
9
|
+
extend Legion::Extensions::Cloudflare::Helpers::Client
|
|
10
10
|
|
|
11
11
|
def list(account_id:, **)
|
|
12
12
|
response = client(**).get("/accounts/#{account_id}/custom_ns")
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require_relative 'helpers/client'
|
|
3
|
+
require_relative '../helpers/client'
|
|
4
|
+
require_relative '../base_client'
|
|
4
5
|
require_relative 'runners/records'
|
|
5
6
|
require_relative 'runners/dnssec'
|
|
6
7
|
|
|
@@ -8,20 +9,9 @@ module Legion
|
|
|
8
9
|
module Extensions
|
|
9
10
|
module Cloudflare
|
|
10
11
|
module Dns
|
|
11
|
-
class Client
|
|
12
|
-
include Helpers::Client
|
|
12
|
+
class Client < Legion::Extensions::Cloudflare::BaseClient
|
|
13
13
|
include Runners::Records
|
|
14
14
|
include Runners::Dnssec
|
|
15
|
-
|
|
16
|
-
attr_reader :opts
|
|
17
|
-
|
|
18
|
-
def initialize(api_token:, **extra)
|
|
19
|
-
@opts = { api_token: api_token, **extra }.compact
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
def client(**override)
|
|
23
|
-
super(**@opts, **override)
|
|
24
|
-
end
|
|
25
15
|
end
|
|
26
16
|
end
|
|
27
17
|
end
|
|
@@ -6,7 +6,7 @@ module Legion
|
|
|
6
6
|
module Dns
|
|
7
7
|
module Runners
|
|
8
8
|
module Dnssec
|
|
9
|
-
extend Legion::Extensions::Cloudflare::
|
|
9
|
+
extend Legion::Extensions::Cloudflare::Helpers::Client
|
|
10
10
|
|
|
11
11
|
def get_dnssec(zone_id:, **)
|
|
12
12
|
response = client(**).get("/zones/#{zone_id}/dnssec")
|
|
@@ -6,7 +6,7 @@ module Legion
|
|
|
6
6
|
module Dns
|
|
7
7
|
module Runners
|
|
8
8
|
module Records
|
|
9
|
-
extend Legion::Extensions::Cloudflare::
|
|
9
|
+
extend Legion::Extensions::Cloudflare::Helpers::Client
|
|
10
10
|
|
|
11
11
|
def list(zone_id:, type: nil, name: nil, page: nil, per_page: nil, **)
|
|
12
12
|
params = { type: type, name: name, page: page, per_page: per_page }.compact
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require_relative 'helpers/client'
|
|
3
|
+
require_relative '../helpers/client'
|
|
4
|
+
require_relative '../base_client'
|
|
4
5
|
require_relative 'runners/clusters'
|
|
5
6
|
require_relative 'runners/analytics'
|
|
6
7
|
|
|
@@ -8,20 +9,9 @@ module Legion
|
|
|
8
9
|
module Extensions
|
|
9
10
|
module Cloudflare
|
|
10
11
|
module DnsFirewall
|
|
11
|
-
class Client
|
|
12
|
-
include Helpers::Client
|
|
12
|
+
class Client < Legion::Extensions::Cloudflare::BaseClient
|
|
13
13
|
include Runners::Clusters
|
|
14
14
|
include Runners::Analytics
|
|
15
|
-
|
|
16
|
-
attr_reader :opts
|
|
17
|
-
|
|
18
|
-
def initialize(api_token:, **extra)
|
|
19
|
-
@opts = { api_token: api_token, **extra }.compact
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
def client(**override)
|
|
23
|
-
super(**@opts, **override)
|
|
24
|
-
end
|
|
25
15
|
end
|
|
26
16
|
end
|
|
27
17
|
end
|
|
@@ -6,7 +6,7 @@ module Legion
|
|
|
6
6
|
module DnsFirewall
|
|
7
7
|
module Runners
|
|
8
8
|
module Analytics
|
|
9
|
-
extend Legion::Extensions::Cloudflare::
|
|
9
|
+
extend Legion::Extensions::Cloudflare::Helpers::Client
|
|
10
10
|
|
|
11
11
|
def report(account_id:, dns_firewall_id:, **)
|
|
12
12
|
response = client(**).get("/accounts/#{account_id}/dns_firewall/#{dns_firewall_id}/dns_analytics/report")
|
|
@@ -6,7 +6,7 @@ module Legion
|
|
|
6
6
|
module DnsFirewall
|
|
7
7
|
module Runners
|
|
8
8
|
module Clusters
|
|
9
|
-
extend Legion::Extensions::Cloudflare::
|
|
9
|
+
extend Legion::Extensions::Cloudflare::Helpers::Client
|
|
10
10
|
|
|
11
11
|
def list(account_id:, page: nil, per_page: nil, **)
|
|
12
12
|
params = { page: page, per_page: per_page }.compact
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require 'legion/extensions/cloudflare/dns_firewall/helpers/client'
|
|
4
3
|
require 'legion/extensions/cloudflare/dns_firewall/runners/clusters'
|
|
5
4
|
require 'legion/extensions/cloudflare/dns_firewall/runners/analytics'
|
|
6
5
|
require 'legion/extensions/cloudflare/dns_firewall/client'
|