lex-cloudflare 0.1.0 → 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 +16 -0
- data/CLAUDE.md +31 -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/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/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/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/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 +6 -0
- metadata +21 -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
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'faraday'
|
|
4
|
+
|
|
5
|
+
module Legion
|
|
6
|
+
module Extensions
|
|
7
|
+
module Cloudflare
|
|
8
|
+
module Helpers
|
|
9
|
+
module Client
|
|
10
|
+
def client(api_token:, **)
|
|
11
|
+
Faraday.new(url: 'https://api.cloudflare.com/client/v4') do |conn|
|
|
12
|
+
conn.request :json
|
|
13
|
+
conn.response :json, content_type: /\bjson$/
|
|
14
|
+
conn.headers['Content-Type'] = 'application/json'
|
|
15
|
+
conn.headers['Authorization'] = "Bearer #{api_token}"
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
@@ -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
|
|
@@ -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/certificate_packs'
|
|
5
6
|
require_relative 'runners/universal'
|
|
6
7
|
|
|
@@ -8,20 +9,9 @@ module Legion
|
|
|
8
9
|
module Extensions
|
|
9
10
|
module Cloudflare
|
|
10
11
|
module Ssl
|
|
11
|
-
class Client
|
|
12
|
-
include Helpers::Client
|
|
12
|
+
class Client < Legion::Extensions::Cloudflare::BaseClient
|
|
13
13
|
include Runners::CertificatePacks
|
|
14
14
|
include Runners::Universal
|
|
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 Ssl
|
|
7
7
|
module Runners
|
|
8
8
|
module CertificatePacks
|
|
9
|
-
extend Legion::Extensions::Cloudflare::
|
|
9
|
+
extend Legion::Extensions::Cloudflare::Helpers::Client
|
|
10
10
|
|
|
11
11
|
def list_packs(zone_id:, **)
|
|
12
12
|
response = client(**).get("/zones/#{zone_id}/ssl/certificate_packs")
|
|
@@ -6,7 +6,7 @@ module Legion
|
|
|
6
6
|
module Ssl
|
|
7
7
|
module Runners
|
|
8
8
|
module Universal
|
|
9
|
-
extend Legion::Extensions::Cloudflare::
|
|
9
|
+
extend Legion::Extensions::Cloudflare::Helpers::Client
|
|
10
10
|
|
|
11
11
|
def get_universal_settings(zone_id:, **)
|
|
12
12
|
response = client(**).get("/zones/#{zone_id}/ssl/universal/settings")
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require 'legion/extensions/cloudflare/ssl/helpers/client'
|
|
4
3
|
require 'legion/extensions/cloudflare/ssl/runners/certificate_packs'
|
|
5
4
|
require 'legion/extensions/cloudflare/ssl/runners/universal'
|
|
6
5
|
require 'legion/extensions/cloudflare/ssl/client'
|
|
@@ -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/indexes'
|
|
5
6
|
require_relative 'runners/vectors'
|
|
6
7
|
|
|
@@ -8,20 +9,9 @@ module Legion
|
|
|
8
9
|
module Extensions
|
|
9
10
|
module Cloudflare
|
|
10
11
|
module Vectorize
|
|
11
|
-
class Client
|
|
12
|
-
include Helpers::Client
|
|
12
|
+
class Client < Legion::Extensions::Cloudflare::BaseClient
|
|
13
13
|
include Runners::Indexes
|
|
14
14
|
include Runners::Vectors
|
|
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 Vectorize
|
|
7
7
|
module Runners
|
|
8
8
|
module Indexes
|
|
9
|
-
extend Legion::Extensions::Cloudflare::
|
|
9
|
+
extend Legion::Extensions::Cloudflare::Helpers::Client
|
|
10
10
|
|
|
11
11
|
def list_indexes(account_id:, **)
|
|
12
12
|
response = client(**).get("/accounts/#{account_id}/vectorize/v2/indexes")
|
|
@@ -6,7 +6,7 @@ module Legion
|
|
|
6
6
|
module Vectorize
|
|
7
7
|
module Runners
|
|
8
8
|
module Vectors
|
|
9
|
-
extend Legion::Extensions::Cloudflare::
|
|
9
|
+
extend Legion::Extensions::Cloudflare::Helpers::Client
|
|
10
10
|
|
|
11
11
|
def insert(account_id:, index_name:, body:, **)
|
|
12
12
|
response = client(**).post("/accounts/#{account_id}/vectorize/v2/indexes/#{index_name}/insert", body)
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require 'legion/extensions/cloudflare/vectorize/helpers/client'
|
|
4
3
|
require 'legion/extensions/cloudflare/vectorize/runners/indexes'
|
|
5
4
|
require 'legion/extensions/cloudflare/vectorize/runners/vectors'
|
|
6
5
|
require 'legion/extensions/cloudflare/vectorize/client'
|
|
@@ -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
|
|
@@ -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/devices'
|
|
5
6
|
require_relative 'runners/registrations'
|
|
6
7
|
require_relative 'runners/dex_tests'
|
|
@@ -10,22 +11,11 @@ module Legion
|
|
|
10
11
|
module Extensions
|
|
11
12
|
module Cloudflare
|
|
12
13
|
module ZeroTrust
|
|
13
|
-
class Client
|
|
14
|
-
include Helpers::Client
|
|
14
|
+
class Client < Legion::Extensions::Cloudflare::BaseClient
|
|
15
15
|
include Runners::Devices
|
|
16
16
|
include Runners::Registrations
|
|
17
17
|
include Runners::DexTests
|
|
18
18
|
include Runners::IpProfiles
|
|
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 ZeroTrust
|
|
7
7
|
module Runners
|
|
8
8
|
module Devices
|
|
9
|
-
extend Legion::Extensions::Cloudflare::
|
|
9
|
+
extend Legion::Extensions::Cloudflare::Helpers::Client
|
|
10
10
|
|
|
11
11
|
def list_devices(account_id:, per_page: nil, search: nil, **)
|
|
12
12
|
params = { per_page: per_page, search: search }.compact
|
|
@@ -6,7 +6,7 @@ module Legion
|
|
|
6
6
|
module ZeroTrust
|
|
7
7
|
module Runners
|
|
8
8
|
module DexTests
|
|
9
|
-
extend Legion::Extensions::Cloudflare::
|
|
9
|
+
extend Legion::Extensions::Cloudflare::Helpers::Client
|
|
10
10
|
|
|
11
11
|
def list_dex_tests(account_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 ZeroTrust
|
|
7
7
|
module Runners
|
|
8
8
|
module IpProfiles
|
|
9
|
-
extend Legion::Extensions::Cloudflare::
|
|
9
|
+
extend Legion::Extensions::Cloudflare::Helpers::Client
|
|
10
10
|
|
|
11
11
|
def list_ip_profiles(account_id:, per_page: nil, **)
|
|
12
12
|
params = { per_page: per_page }.compact
|
|
@@ -6,7 +6,7 @@ module Legion
|
|
|
6
6
|
module ZeroTrust
|
|
7
7
|
module Runners
|
|
8
8
|
module Registrations
|
|
9
|
-
extend Legion::Extensions::Cloudflare::
|
|
9
|
+
extend Legion::Extensions::Cloudflare::Helpers::Client
|
|
10
10
|
|
|
11
11
|
def list_registrations(account_id:, per_page: nil, search: nil, **)
|
|
12
12
|
params = { per_page: per_page, search: search }.compact
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require 'legion/extensions/cloudflare/zero_trust/helpers/client'
|
|
4
3
|
require 'legion/extensions/cloudflare/zero_trust/runners/devices'
|
|
5
4
|
require 'legion/extensions/cloudflare/zero_trust/runners/registrations'
|
|
6
5
|
require 'legion/extensions/cloudflare/zero_trust/runners/dex_tests'
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative '../helpers/client'
|
|
4
|
+
require_relative '../base_client'
|
|
5
|
+
require_relative 'runners/zones'
|
|
6
|
+
require_relative 'runners/settings'
|
|
7
|
+
|
|
8
|
+
module Legion
|
|
9
|
+
module Extensions
|
|
10
|
+
module Cloudflare
|
|
11
|
+
module Zones
|
|
12
|
+
class Client < Legion::Extensions::Cloudflare::BaseClient
|
|
13
|
+
include Runners::Zones
|
|
14
|
+
include Runners::Settings
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Legion
|
|
4
|
+
module Extensions
|
|
5
|
+
module Cloudflare
|
|
6
|
+
module Zones
|
|
7
|
+
module Runners
|
|
8
|
+
module Settings
|
|
9
|
+
extend Legion::Extensions::Cloudflare::Helpers::Client
|
|
10
|
+
|
|
11
|
+
def list_settings(zone_id:, **)
|
|
12
|
+
response = client(**).get("/zones/#{zone_id}/settings")
|
|
13
|
+
{ result: response.body, status: response.status }
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def get_setting(zone_id:, setting_id:, **)
|
|
17
|
+
response = client(**).get("/zones/#{zone_id}/settings/#{setting_id}")
|
|
18
|
+
{ result: response.body, status: response.status }
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
include Legion::Extensions::Helpers::Lex if Legion::Extensions.const_defined?(:Helpers) &&
|
|
22
|
+
Legion::Extensions::Helpers.const_defined?(:Lex)
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Legion
|
|
4
|
+
module Extensions
|
|
5
|
+
module Cloudflare
|
|
6
|
+
module Zones
|
|
7
|
+
module Runners
|
|
8
|
+
module Zones
|
|
9
|
+
extend Legion::Extensions::Cloudflare::Helpers::Client
|
|
10
|
+
|
|
11
|
+
def list(page: nil, per_page: nil, name: nil, status: nil, **)
|
|
12
|
+
params = { page: page, per_page: per_page, name: name, status: status }.compact
|
|
13
|
+
response = client(**).get('/zones', params)
|
|
14
|
+
{ result: response.body, status: response.status }
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def get(zone_id:, **)
|
|
18
|
+
response = client(**).get("/zones/#{zone_id}")
|
|
19
|
+
{ result: response.body, status: response.status }
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def create(name:, account_id: nil, type: nil, **)
|
|
23
|
+
body = { name: name }
|
|
24
|
+
body[:account] = { id: account_id } if account_id
|
|
25
|
+
body[:type] = type if type
|
|
26
|
+
response = client(**).post('/zones', body)
|
|
27
|
+
{ result: response.body, status: response.status }
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def update(zone_id:, body:, **)
|
|
31
|
+
response = client(**).patch("/zones/#{zone_id}", body)
|
|
32
|
+
{ result: response.body, status: response.status }
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def delete(zone_id:, **)
|
|
36
|
+
response = client(**).delete("/zones/#{zone_id}")
|
|
37
|
+
{ result: response.body, status: response.status }
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def activation_check(zone_id:, **)
|
|
41
|
+
response = client(**).put("/zones/#{zone_id}/activation_check")
|
|
42
|
+
{ result: response.body, status: response.status }
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
include Legion::Extensions::Helpers::Lex if Legion::Extensions.const_defined?(:Helpers) &&
|
|
46
|
+
Legion::Extensions::Helpers.const_defined?(:Lex)
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'legion/extensions/cloudflare/zones/runners/zones'
|
|
4
|
+
require 'legion/extensions/cloudflare/zones/runners/settings'
|
|
5
|
+
require 'legion/extensions/cloudflare/zones/client'
|
|
6
|
+
|
|
7
|
+
module Legion
|
|
8
|
+
module Extensions
|
|
9
|
+
module Cloudflare
|
|
10
|
+
module Zones
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require_relative 'cloudflare/version'
|
|
4
|
+
require_relative 'cloudflare/helpers/client'
|
|
5
|
+
require_relative 'cloudflare/base_client'
|
|
4
6
|
require_relative 'cloudflare/dns'
|
|
5
7
|
require_relative 'cloudflare/dns_firewall'
|
|
6
8
|
require_relative 'cloudflare/custom_nameservers'
|
|
@@ -9,6 +11,10 @@ require_relative 'cloudflare/ssl'
|
|
|
9
11
|
require_relative 'cloudflare/vectorize'
|
|
10
12
|
require_relative 'cloudflare/ai_gateway'
|
|
11
13
|
require_relative 'cloudflare/ai'
|
|
14
|
+
require_relative 'cloudflare/zones'
|
|
15
|
+
require_relative 'cloudflare/accounts'
|
|
16
|
+
require_relative 'cloudflare/workers_routes'
|
|
17
|
+
require_relative 'cloudflare/pages'
|
|
12
18
|
|
|
13
19
|
module Legion
|
|
14
20
|
module Extensions
|