lex-cloudflare 0.1.1 → 0.1.2
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 +7 -0
- data/CLAUDE.md +19 -9
- data/lib/legion/extensions/cloudflare/pages/client.rb +21 -0
- data/lib/legion/extensions/cloudflare/pages/runners/deployments.rb +51 -0
- data/lib/legion/extensions/cloudflare/pages/runners/domains.rb +45 -0
- data/lib/legion/extensions/cloudflare/pages/runners/projects.rb +40 -0
- data/lib/legion/extensions/cloudflare/pages.rb +15 -0
- data/lib/legion/extensions/cloudflare/version.rb +1 -1
- data/lib/legion/extensions/cloudflare/workers_routes/client.rb +17 -0
- data/lib/legion/extensions/cloudflare/workers_routes/runners/routes.rb +47 -0
- data/lib/legion/extensions/cloudflare/workers_routes.rb +13 -0
- data/lib/legion/extensions/cloudflare.rb +2 -0
- metadata +9 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: fd981cbafef97d803409aa71b857277154a77df490ef68a8fe5ffc7699ca341e
|
|
4
|
+
data.tar.gz: 4679f6ba9c963c81ef38a8fbfe9184ee49f742192c63f8084efa6d9816ca8f06
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3390890d65c1501e74251894f9e226f818bf09b76f6fabd08b1989a4cbd3c3afe158ab6e3a47d83037fc47ec5afc8f1d60e6d73c8345da908571684ce413ffa0
|
|
7
|
+
data.tar.gz: 4fa3e63a8e5811ac51972c44014563b52fad15c62adcf003a2286d4bd1b8f7c8706f3692229d4dc43971374dfa6dd493b80e64a514d0e0c2a3231f0919976579
|
data/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
## [Unreleased]
|
|
4
4
|
|
|
5
|
+
## [0.1.2] - 2026-03-24
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
- WorkersRoutes sub-module: zone-scoped Workers route CRUD (list, get, create, update, delete)
|
|
9
|
+
- Pages sub-module: account-scoped Pages projects, deployments (retry/rollback), and custom domains
|
|
10
|
+
- 32 new specs covering all WorkersRoutes and Pages runners and clients (197 total)
|
|
11
|
+
|
|
5
12
|
## [0.1.1] - 2026-03-24
|
|
6
13
|
|
|
7
14
|
### Added
|
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 12 sub-modules covering DNS, network security, Zero Trust, SSL, Vectorize, AI, Zones, Accounts, Workers Routes, and Pages via the Cloudflare REST API v4.
|
|
10
10
|
|
|
11
11
|
**GitHub**: https://github.com/LegionIO/lex-cloudflare
|
|
12
12
|
**License**: MIT
|
|
@@ -63,11 +63,19 @@ Legion::Extensions::Cloudflare
|
|
|
63
63
|
│ ├── Runners::Zones # Zone CRUD, activation check
|
|
64
64
|
│ ├── Runners::Settings # Zone settings list/get
|
|
65
65
|
│ └── Client
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
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
|
|
71
|
+
│ └── Client
|
|
72
|
+
├── WorkersRoutes/ # Zone-scoped Workers route management
|
|
73
|
+
│ ├── Runners::Routes # Route CRUD (pattern + script binding)
|
|
74
|
+
│ └── Client
|
|
75
|
+
└── Pages/ # Account-scoped Cloudflare Pages
|
|
76
|
+
├── Runners::Projects # Project CRUD
|
|
77
|
+
├── Runners::Deployments # Deployment list/get/delete/retry/rollback
|
|
78
|
+
├── Runners::Domains # Custom domain list/get/add/delete
|
|
71
79
|
└── Client
|
|
72
80
|
```
|
|
73
81
|
|
|
@@ -92,8 +100,8 @@ Base URL: `https://api.cloudflare.com/client/v4`
|
|
|
92
100
|
|
|
93
101
|
| Scope | Sub-modules | Path pattern |
|
|
94
102
|
|-------|-------------|--------------|
|
|
95
|
-
| Zone | Dns, Ssl, Zones | `/zones/{zone_id}/...` |
|
|
96
|
-
| Account | DnsFirewall, CustomNameservers, ZeroTrust, Vectorize, AiGateway, Ai, Accounts | `/accounts/{account_id}/...` |
|
|
103
|
+
| Zone | Dns, Ssl, Zones, WorkersRoutes | `/zones/{zone_id}/...` |
|
|
104
|
+
| Account | DnsFirewall, CustomNameservers, ZeroTrust, Vectorize, AiGateway, Ai, Accounts, Pages | `/accounts/{account_id}/...` |
|
|
97
105
|
| Top-level | Zones (list/create), Accounts (list/create) | `/zones`, `/accounts` |
|
|
98
106
|
|
|
99
107
|
## API Coverage
|
|
@@ -110,6 +118,8 @@ Base URL: `https://api.cloudflare.com/client/v4`
|
|
|
110
118
|
| Ai | Models, Finetunes | `run`, `search_models`, `model_schema`, `to_markdown`, `list_finetunes`, `create_finetune` |
|
|
111
119
|
| Zones | Zones, Settings | `list`, `get`, `create`, `update`, `delete`, `activation_check`, `list_settings`, `get_setting` |
|
|
112
120
|
| Accounts | Accounts, Members, Roles, Tokens | `list`, `get`, `create`, `update`, `delete`, `get_profile`, `list_members`, `add_member`, `list_roles`, `list_tokens`, `create_token` |
|
|
121
|
+
| WorkersRoutes | Routes | `list_routes`, `get_route`, `create_route`, `update_route`, `delete_route` |
|
|
122
|
+
| Pages | Projects, Deployments, Domains | `list_projects`, `get_project`, `create_project`, `list_deployments`, `retry_deployment`, `rollback_deployment`, `list_domains`, `add_domain` |
|
|
113
123
|
|
|
114
124
|
## Dependencies
|
|
115
125
|
|
|
@@ -119,7 +129,7 @@ Base URL: `https://api.cloudflare.com/client/v4`
|
|
|
119
129
|
|
|
120
130
|
## Development
|
|
121
131
|
|
|
122
|
-
|
|
132
|
+
197 specs total (0 failures).
|
|
123
133
|
|
|
124
134
|
```bash
|
|
125
135
|
bundle install
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative '../helpers/client'
|
|
4
|
+
require_relative '../base_client'
|
|
5
|
+
require_relative 'runners/projects'
|
|
6
|
+
require_relative 'runners/deployments'
|
|
7
|
+
require_relative 'runners/domains'
|
|
8
|
+
|
|
9
|
+
module Legion
|
|
10
|
+
module Extensions
|
|
11
|
+
module Cloudflare
|
|
12
|
+
module Pages
|
|
13
|
+
class Client < Legion::Extensions::Cloudflare::BaseClient
|
|
14
|
+
include Runners::Projects
|
|
15
|
+
include Runners::Deployments
|
|
16
|
+
include Runners::Domains
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Legion
|
|
4
|
+
module Extensions
|
|
5
|
+
module Cloudflare
|
|
6
|
+
module Pages
|
|
7
|
+
module Runners
|
|
8
|
+
module Deployments
|
|
9
|
+
extend Legion::Extensions::Cloudflare::Helpers::Client
|
|
10
|
+
|
|
11
|
+
def list_deployments(account_id:, project_name:, **)
|
|
12
|
+
response = client(**).get("/accounts/#{account_id}/pages/projects/#{project_name}/deployments")
|
|
13
|
+
{ result: response.body, status: response.status }
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def get_deployment(account_id:, project_name:, deployment_id:, **)
|
|
17
|
+
response = client(**).get(
|
|
18
|
+
"/accounts/#{account_id}/pages/projects/#{project_name}/deployments/#{deployment_id}"
|
|
19
|
+
)
|
|
20
|
+
{ result: response.body, status: response.status }
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def delete_deployment(account_id:, project_name:, deployment_id:, **)
|
|
24
|
+
response = client(**).delete(
|
|
25
|
+
"/accounts/#{account_id}/pages/projects/#{project_name}/deployments/#{deployment_id}"
|
|
26
|
+
)
|
|
27
|
+
{ result: response.body, status: response.status }
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def retry_deployment(account_id:, project_name:, deployment_id:, **)
|
|
31
|
+
response = client(**).post(
|
|
32
|
+
"/accounts/#{account_id}/pages/projects/#{project_name}/deployments/#{deployment_id}/retry"
|
|
33
|
+
)
|
|
34
|
+
{ result: response.body, status: response.status }
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def rollback_deployment(account_id:, project_name:, deployment_id:, **)
|
|
38
|
+
response = client(**).post(
|
|
39
|
+
"/accounts/#{account_id}/pages/projects/#{project_name}/deployments/#{deployment_id}/rollback"
|
|
40
|
+
)
|
|
41
|
+
{ result: response.body, status: response.status }
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
include Legion::Extensions::Helpers::Lex if Legion::Extensions.const_defined?(:Helpers) &&
|
|
45
|
+
Legion::Extensions::Helpers.const_defined?(:Lex)
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
end
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Legion
|
|
4
|
+
module Extensions
|
|
5
|
+
module Cloudflare
|
|
6
|
+
module Pages
|
|
7
|
+
module Runners
|
|
8
|
+
module Domains
|
|
9
|
+
extend Legion::Extensions::Cloudflare::Helpers::Client
|
|
10
|
+
|
|
11
|
+
def list_domains(account_id:, project_name:, **)
|
|
12
|
+
response = client(**).get("/accounts/#{account_id}/pages/projects/#{project_name}/domains")
|
|
13
|
+
{ result: response.body, status: response.status }
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def get_domain(account_id:, project_name:, domain_name:, **)
|
|
17
|
+
response = client(**).get(
|
|
18
|
+
"/accounts/#{account_id}/pages/projects/#{project_name}/domains/#{domain_name}"
|
|
19
|
+
)
|
|
20
|
+
{ result: response.body, status: response.status }
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def add_domain(account_id:, project_name:, name:, **)
|
|
24
|
+
response = client(**).post(
|
|
25
|
+
"/accounts/#{account_id}/pages/projects/#{project_name}/domains",
|
|
26
|
+
{ name: name }
|
|
27
|
+
)
|
|
28
|
+
{ result: response.body, status: response.status }
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def delete_domain(account_id:, project_name:, domain_name:, **)
|
|
32
|
+
response = client(**).delete(
|
|
33
|
+
"/accounts/#{account_id}/pages/projects/#{project_name}/domains/#{domain_name}"
|
|
34
|
+
)
|
|
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,40 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Legion
|
|
4
|
+
module Extensions
|
|
5
|
+
module Cloudflare
|
|
6
|
+
module Pages
|
|
7
|
+
module Runners
|
|
8
|
+
module Projects
|
|
9
|
+
extend Legion::Extensions::Cloudflare::Helpers::Client
|
|
10
|
+
|
|
11
|
+
def list_projects(account_id:, **)
|
|
12
|
+
response = client(**).get("/accounts/#{account_id}/pages/projects")
|
|
13
|
+
{ result: response.body, status: response.status }
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def get_project(account_id:, project_name:, **)
|
|
17
|
+
response = client(**).get("/accounts/#{account_id}/pages/projects/#{project_name}")
|
|
18
|
+
{ result: response.body, status: response.status }
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def create_project(account_id:, name:, production_branch: nil, **)
|
|
22
|
+
body = { name: name }
|
|
23
|
+
body[:production_branch] = production_branch if production_branch
|
|
24
|
+
response = client(**).post("/accounts/#{account_id}/pages/projects", body)
|
|
25
|
+
{ result: response.body, status: response.status }
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def delete_project(account_id:, project_name:, **)
|
|
29
|
+
response = client(**).delete("/accounts/#{account_id}/pages/projects/#{project_name}")
|
|
30
|
+
{ result: response.body, status: response.status }
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
include Legion::Extensions::Helpers::Lex if Legion::Extensions.const_defined?(:Helpers) &&
|
|
34
|
+
Legion::Extensions::Helpers.const_defined?(:Lex)
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'legion/extensions/cloudflare/pages/runners/projects'
|
|
4
|
+
require 'legion/extensions/cloudflare/pages/runners/deployments'
|
|
5
|
+
require 'legion/extensions/cloudflare/pages/runners/domains'
|
|
6
|
+
require 'legion/extensions/cloudflare/pages/client'
|
|
7
|
+
|
|
8
|
+
module Legion
|
|
9
|
+
module Extensions
|
|
10
|
+
module Cloudflare
|
|
11
|
+
module Pages
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative '../helpers/client'
|
|
4
|
+
require_relative '../base_client'
|
|
5
|
+
require_relative 'runners/routes'
|
|
6
|
+
|
|
7
|
+
module Legion
|
|
8
|
+
module Extensions
|
|
9
|
+
module Cloudflare
|
|
10
|
+
module WorkersRoutes
|
|
11
|
+
class Client < Legion::Extensions::Cloudflare::BaseClient
|
|
12
|
+
include Runners::Routes
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Legion
|
|
4
|
+
module Extensions
|
|
5
|
+
module Cloudflare
|
|
6
|
+
module WorkersRoutes
|
|
7
|
+
module Runners
|
|
8
|
+
module Routes
|
|
9
|
+
extend Legion::Extensions::Cloudflare::Helpers::Client
|
|
10
|
+
|
|
11
|
+
def list_routes(zone_id:, **)
|
|
12
|
+
response = client(**).get("/zones/#{zone_id}/workers/routes")
|
|
13
|
+
{ result: response.body, status: response.status }
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def get_route(zone_id:, route_id:, **)
|
|
17
|
+
response = client(**).get("/zones/#{zone_id}/workers/routes/#{route_id}")
|
|
18
|
+
{ result: response.body, status: response.status }
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def create_route(zone_id:, pattern:, script: nil, **)
|
|
22
|
+
body = { pattern: pattern }
|
|
23
|
+
body[:script] = script if script
|
|
24
|
+
response = client(**).post("/zones/#{zone_id}/workers/routes", body)
|
|
25
|
+
{ result: response.body, status: response.status }
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def update_route(zone_id:, route_id:, pattern:, script: nil, **)
|
|
29
|
+
body = { pattern: pattern }
|
|
30
|
+
body[:script] = script if script
|
|
31
|
+
response = client(**).put("/zones/#{zone_id}/workers/routes/#{route_id}", body)
|
|
32
|
+
{ result: response.body, status: response.status }
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def delete_route(zone_id:, route_id:, **)
|
|
36
|
+
response = client(**).delete("/zones/#{zone_id}/workers/routes/#{route_id}")
|
|
37
|
+
{ result: response.body, status: response.status }
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
include Legion::Extensions::Helpers::Lex if Legion::Extensions.const_defined?(:Helpers) &&
|
|
41
|
+
Legion::Extensions::Helpers.const_defined?(:Lex)
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'legion/extensions/cloudflare/workers_routes/runners/routes'
|
|
4
|
+
require 'legion/extensions/cloudflare/workers_routes/client'
|
|
5
|
+
|
|
6
|
+
module Legion
|
|
7
|
+
module Extensions
|
|
8
|
+
module Cloudflare
|
|
9
|
+
module WorkersRoutes
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -13,6 +13,8 @@ require_relative 'cloudflare/ai_gateway'
|
|
|
13
13
|
require_relative 'cloudflare/ai'
|
|
14
14
|
require_relative 'cloudflare/zones'
|
|
15
15
|
require_relative 'cloudflare/accounts'
|
|
16
|
+
require_relative 'cloudflare/workers_routes'
|
|
17
|
+
require_relative 'cloudflare/pages'
|
|
16
18
|
|
|
17
19
|
module Legion
|
|
18
20
|
module Extensions
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: lex-cloudflare
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Esity
|
|
@@ -71,6 +71,11 @@ files:
|
|
|
71
71
|
- lib/legion/extensions/cloudflare/dns_firewall/runners/analytics.rb
|
|
72
72
|
- lib/legion/extensions/cloudflare/dns_firewall/runners/clusters.rb
|
|
73
73
|
- lib/legion/extensions/cloudflare/helpers/client.rb
|
|
74
|
+
- lib/legion/extensions/cloudflare/pages.rb
|
|
75
|
+
- lib/legion/extensions/cloudflare/pages/client.rb
|
|
76
|
+
- lib/legion/extensions/cloudflare/pages/runners/deployments.rb
|
|
77
|
+
- lib/legion/extensions/cloudflare/pages/runners/domains.rb
|
|
78
|
+
- lib/legion/extensions/cloudflare/pages/runners/projects.rb
|
|
74
79
|
- lib/legion/extensions/cloudflare/ssl.rb
|
|
75
80
|
- lib/legion/extensions/cloudflare/ssl/client.rb
|
|
76
81
|
- lib/legion/extensions/cloudflare/ssl/runners/certificate_packs.rb
|
|
@@ -80,6 +85,9 @@ files:
|
|
|
80
85
|
- lib/legion/extensions/cloudflare/vectorize/runners/indexes.rb
|
|
81
86
|
- lib/legion/extensions/cloudflare/vectorize/runners/vectors.rb
|
|
82
87
|
- lib/legion/extensions/cloudflare/version.rb
|
|
88
|
+
- lib/legion/extensions/cloudflare/workers_routes.rb
|
|
89
|
+
- lib/legion/extensions/cloudflare/workers_routes/client.rb
|
|
90
|
+
- lib/legion/extensions/cloudflare/workers_routes/runners/routes.rb
|
|
83
91
|
- lib/legion/extensions/cloudflare/zero_trust.rb
|
|
84
92
|
- lib/legion/extensions/cloudflare/zero_trust/client.rb
|
|
85
93
|
- lib/legion/extensions/cloudflare/zero_trust/runners/devices.rb
|