lex-cloudflare 0.1.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 +7 -0
- data/.github/workflows/ci.yml +34 -0
- data/.gitignore +12 -0
- data/.rspec +3 -0
- data/.rubocop.yml +66 -0
- data/CHANGELOG.md +14 -0
- data/CLAUDE.md +119 -0
- data/Dockerfile +6 -0
- data/Gemfile +12 -0
- data/LICENSE +21 -0
- data/README.md +98 -0
- data/lex-cloudflare.gemspec +30 -0
- data/lib/legion/extensions/cloudflare/ai/client.rb +29 -0
- data/lib/legion/extensions/cloudflare/ai/helpers/client.rb +24 -0
- data/lib/legion/extensions/cloudflare/ai/runners/finetunes.rb +40 -0
- data/lib/legion/extensions/cloudflare/ai/runners/models.rb +44 -0
- data/lib/legion/extensions/cloudflare/ai.rb +15 -0
- data/lib/legion/extensions/cloudflare/ai_gateway/client.rb +33 -0
- data/lib/legion/extensions/cloudflare/ai_gateway/helpers/client.rb +24 -0
- data/lib/legion/extensions/cloudflare/ai_gateway/runners/datasets.rb +44 -0
- data/lib/legion/extensions/cloudflare/ai_gateway/runners/evaluations.rb +39 -0
- data/lib/legion/extensions/cloudflare/ai_gateway/runners/gateways.rb +44 -0
- data/lib/legion/extensions/cloudflare/ai_gateway/runners/logs.rb +49 -0
- data/lib/legion/extensions/cloudflare/ai_gateway.rb +17 -0
- data/lib/legion/extensions/cloudflare/custom_nameservers/client.rb +27 -0
- data/lib/legion/extensions/cloudflare/custom_nameservers/helpers/client.rb +24 -0
- data/lib/legion/extensions/cloudflare/custom_nameservers/runners/nameservers.rb +34 -0
- data/lib/legion/extensions/cloudflare/custom_nameservers.rb +14 -0
- data/lib/legion/extensions/cloudflare/dns/client.rb +29 -0
- data/lib/legion/extensions/cloudflare/dns/helpers/client.rb +24 -0
- data/lib/legion/extensions/cloudflare/dns/runners/dnssec.rb +33 -0
- data/lib/legion/extensions/cloudflare/dns/runners/records.rb +44 -0
- data/lib/legion/extensions/cloudflare/dns.rb +15 -0
- data/lib/legion/extensions/cloudflare/dns_firewall/client.rb +29 -0
- data/lib/legion/extensions/cloudflare/dns_firewall/helpers/client.rb +24 -0
- data/lib/legion/extensions/cloudflare/dns_firewall/runners/analytics.rb +42 -0
- data/lib/legion/extensions/cloudflare/dns_firewall/runners/clusters.rb +45 -0
- data/lib/legion/extensions/cloudflare/dns_firewall.rb +15 -0
- data/lib/legion/extensions/cloudflare/ssl/client.rb +29 -0
- data/lib/legion/extensions/cloudflare/ssl/helpers/client.rb +24 -0
- data/lib/legion/extensions/cloudflare/ssl/runners/certificate_packs.rb +48 -0
- data/lib/legion/extensions/cloudflare/ssl/runners/universal.rb +44 -0
- data/lib/legion/extensions/cloudflare/ssl.rb +15 -0
- data/lib/legion/extensions/cloudflare/vectorize/client.rb +29 -0
- data/lib/legion/extensions/cloudflare/vectorize/helpers/client.rb +24 -0
- data/lib/legion/extensions/cloudflare/vectorize/runners/indexes.rb +61 -0
- data/lib/legion/extensions/cloudflare/vectorize/runners/vectors.rb +49 -0
- data/lib/legion/extensions/cloudflare/vectorize.rb +15 -0
- data/lib/legion/extensions/cloudflare/version.rb +9 -0
- data/lib/legion/extensions/cloudflare/zero_trust/client.rb +33 -0
- data/lib/legion/extensions/cloudflare/zero_trust/helpers/client.rb +24 -0
- data/lib/legion/extensions/cloudflare/zero_trust/runners/devices.rb +39 -0
- data/lib/legion/extensions/cloudflare/zero_trust/runners/dex_tests.rb +44 -0
- data/lib/legion/extensions/cloudflare/zero_trust/runners/ip_profiles.rb +44 -0
- data/lib/legion/extensions/cloudflare/zero_trust/runners/registrations.rb +44 -0
- data/lib/legion/extensions/cloudflare/zero_trust.rb +17 -0
- data/lib/legion/extensions/cloudflare.rb +19 -0
- metadata +116 -0
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Legion
|
|
4
|
+
module Extensions
|
|
5
|
+
module Cloudflare
|
|
6
|
+
module Ssl
|
|
7
|
+
module Runners
|
|
8
|
+
module CertificatePacks
|
|
9
|
+
extend Legion::Extensions::Cloudflare::Ssl::Helpers::Client
|
|
10
|
+
|
|
11
|
+
def list_packs(zone_id:, **)
|
|
12
|
+
response = client(**).get("/zones/#{zone_id}/ssl/certificate_packs")
|
|
13
|
+
{ result: response.body, status: response.status }
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def get_pack(zone_id:, certificate_pack_id:, **)
|
|
17
|
+
response = client(**).get("/zones/#{zone_id}/ssl/certificate_packs/#{certificate_pack_id}")
|
|
18
|
+
{ result: response.body, status: response.status }
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def order_pack(zone_id:, body:, **)
|
|
22
|
+
response = client(**).post("/zones/#{zone_id}/ssl/certificate_packs/order", body)
|
|
23
|
+
{ result: response.body, status: response.status }
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def update_pack(zone_id:, certificate_pack_id:, body: {}, **)
|
|
27
|
+
response = client(**).patch("/zones/#{zone_id}/ssl/certificate_packs/#{certificate_pack_id}", body)
|
|
28
|
+
{ result: response.body, status: response.status }
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def delete_pack(zone_id:, certificate_pack_id:, **)
|
|
32
|
+
response = client(**).delete("/zones/#{zone_id}/ssl/certificate_packs/#{certificate_pack_id}")
|
|
33
|
+
{ result: response.body, status: response.status }
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def quota(zone_id:, **)
|
|
37
|
+
response = client(**).get("/zones/#{zone_id}/ssl/certificate_packs/quota")
|
|
38
|
+
{ result: response.body, status: response.status }
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
include Legion::Extensions::Helpers::Lex if Legion::Extensions.const_defined?(:Helpers) &&
|
|
42
|
+
Legion::Extensions::Helpers.const_defined?(:Lex)
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Legion
|
|
4
|
+
module Extensions
|
|
5
|
+
module Cloudflare
|
|
6
|
+
module Ssl
|
|
7
|
+
module Runners
|
|
8
|
+
module Universal
|
|
9
|
+
extend Legion::Extensions::Cloudflare::Ssl::Helpers::Client
|
|
10
|
+
|
|
11
|
+
def get_universal_settings(zone_id:, **)
|
|
12
|
+
response = client(**).get("/zones/#{zone_id}/ssl/universal/settings")
|
|
13
|
+
{ result: response.body, status: response.status }
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def update_universal_settings(zone_id:, enabled:, **)
|
|
17
|
+
response = client(**).patch("/zones/#{zone_id}/ssl/universal/settings", { enabled: enabled })
|
|
18
|
+
{ result: response.body, status: response.status }
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def get_recommendation(zone_id:, **)
|
|
22
|
+
response = client(**).get("/zones/#{zone_id}/ssl/recommendation")
|
|
23
|
+
{ result: response.body, status: response.status }
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def list_verification(zone_id:, **)
|
|
27
|
+
response = client(**).get("/zones/#{zone_id}/ssl/verification")
|
|
28
|
+
{ result: response.body, status: response.status }
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def update_verification(zone_id:, certificate_pack_id:, validation_method:, **)
|
|
32
|
+
body = { validation_method: validation_method }
|
|
33
|
+
response = client(**).patch("/zones/#{zone_id}/ssl/verification/#{certificate_pack_id}", body)
|
|
34
|
+
{ result: response.body, status: response.status }
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
include Legion::Extensions::Helpers::Lex if Legion::Extensions.const_defined?(:Helpers) &&
|
|
38
|
+
Legion::Extensions::Helpers.const_defined?(:Lex)
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'legion/extensions/cloudflare/ssl/helpers/client'
|
|
4
|
+
require 'legion/extensions/cloudflare/ssl/runners/certificate_packs'
|
|
5
|
+
require 'legion/extensions/cloudflare/ssl/runners/universal'
|
|
6
|
+
require 'legion/extensions/cloudflare/ssl/client'
|
|
7
|
+
|
|
8
|
+
module Legion
|
|
9
|
+
module Extensions
|
|
10
|
+
module Cloudflare
|
|
11
|
+
module Ssl
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative 'helpers/client'
|
|
4
|
+
require_relative 'runners/indexes'
|
|
5
|
+
require_relative 'runners/vectors'
|
|
6
|
+
|
|
7
|
+
module Legion
|
|
8
|
+
module Extensions
|
|
9
|
+
module Cloudflare
|
|
10
|
+
module Vectorize
|
|
11
|
+
class Client
|
|
12
|
+
include Helpers::Client
|
|
13
|
+
include Runners::Indexes
|
|
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
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'faraday'
|
|
4
|
+
|
|
5
|
+
module Legion
|
|
6
|
+
module Extensions
|
|
7
|
+
module Cloudflare
|
|
8
|
+
module Vectorize
|
|
9
|
+
module Helpers
|
|
10
|
+
module Client
|
|
11
|
+
def client(api_token:, **)
|
|
12
|
+
Faraday.new(url: 'https://api.cloudflare.com/client/v4') do |conn|
|
|
13
|
+
conn.request :json
|
|
14
|
+
conn.response :json, content_type: /\bjson$/
|
|
15
|
+
conn.headers['Content-Type'] = 'application/json'
|
|
16
|
+
conn.headers['Authorization'] = "Bearer #{api_token}"
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Legion
|
|
4
|
+
module Extensions
|
|
5
|
+
module Cloudflare
|
|
6
|
+
module Vectorize
|
|
7
|
+
module Runners
|
|
8
|
+
module Indexes
|
|
9
|
+
extend Legion::Extensions::Cloudflare::Vectorize::Helpers::Client
|
|
10
|
+
|
|
11
|
+
def list_indexes(account_id:, **)
|
|
12
|
+
response = client(**).get("/accounts/#{account_id}/vectorize/v2/indexes")
|
|
13
|
+
{ result: response.body, status: response.status }
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def get_index(account_id:, index_name:, **)
|
|
17
|
+
response = client(**).get("/accounts/#{account_id}/vectorize/v2/indexes/#{index_name}")
|
|
18
|
+
{ result: response.body, status: response.status }
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def create_index(account_id:, name:, config:, description: nil, **)
|
|
22
|
+
body = { name: name, config: config, description: description }.compact
|
|
23
|
+
response = client(**).post("/accounts/#{account_id}/vectorize/v2/indexes", body)
|
|
24
|
+
{ result: response.body, status: response.status }
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def delete_index(account_id:, index_name:, **)
|
|
28
|
+
response = client(**).delete("/accounts/#{account_id}/vectorize/v2/indexes/#{index_name}")
|
|
29
|
+
{ result: response.body, status: response.status }
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def index_info(account_id:, index_name:, **)
|
|
33
|
+
response = client(**).get("/accounts/#{account_id}/vectorize/v2/indexes/#{index_name}/info")
|
|
34
|
+
{ result: response.body, status: response.status }
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def list_metadata_indexes(account_id:, index_name:, **)
|
|
38
|
+
response = client(**).get("/accounts/#{account_id}/vectorize/v2/indexes/#{index_name}/metadata_index/list")
|
|
39
|
+
{ result: response.body, status: response.status }
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def create_metadata_index(account_id:, index_name:, property_name:, index_type:, **)
|
|
43
|
+
body = { propertyName: property_name, indexType: index_type }
|
|
44
|
+
response = client(**).post("/accounts/#{account_id}/vectorize/v2/indexes/#{index_name}/metadata_index/create", body)
|
|
45
|
+
{ result: response.body, status: response.status }
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def delete_metadata_index(account_id:, index_name:, property_name:, **)
|
|
49
|
+
body = { propertyName: property_name }
|
|
50
|
+
response = client(**).post("/accounts/#{account_id}/vectorize/v2/indexes/#{index_name}/metadata_index/delete", body)
|
|
51
|
+
{ result: response.body, status: response.status }
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
include Legion::Extensions::Helpers::Lex if Legion::Extensions.const_defined?(:Helpers) &&
|
|
55
|
+
Legion::Extensions::Helpers.const_defined?(:Lex)
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
end
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Legion
|
|
4
|
+
module Extensions
|
|
5
|
+
module Cloudflare
|
|
6
|
+
module Vectorize
|
|
7
|
+
module Runners
|
|
8
|
+
module Vectors
|
|
9
|
+
extend Legion::Extensions::Cloudflare::Vectorize::Helpers::Client
|
|
10
|
+
|
|
11
|
+
def insert(account_id:, index_name:, body:, **)
|
|
12
|
+
response = client(**).post("/accounts/#{account_id}/vectorize/v2/indexes/#{index_name}/insert", body)
|
|
13
|
+
{ result: response.body, status: response.status }
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def upsert(account_id:, index_name:, body:, **)
|
|
17
|
+
response = client(**).post("/accounts/#{account_id}/vectorize/v2/indexes/#{index_name}/upsert", body)
|
|
18
|
+
{ result: response.body, status: response.status }
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def query(account_id:, index_name:, vector:, top_k: nil, filter: nil, return_metadata: nil, return_values: nil, **)
|
|
22
|
+
body = { vector: vector, topK: top_k, filter: filter, returnMetadata: return_metadata, returnValues: return_values }.compact
|
|
23
|
+
response = client(**).post("/accounts/#{account_id}/vectorize/v2/indexes/#{index_name}/query", body)
|
|
24
|
+
{ result: response.body, status: response.status }
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def get_by_ids(account_id:, index_name:, ids:, **)
|
|
28
|
+
response = client(**).post("/accounts/#{account_id}/vectorize/v2/indexes/#{index_name}/get_by_ids", { ids: ids })
|
|
29
|
+
{ result: response.body, status: response.status }
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def delete_by_ids(account_id:, index_name:, ids:, **)
|
|
33
|
+
response = client(**).post("/accounts/#{account_id}/vectorize/v2/indexes/#{index_name}/delete_by_ids", { ids: ids })
|
|
34
|
+
{ result: response.body, status: response.status }
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def list_vectors(account_id:, index_name:, **)
|
|
38
|
+
response = client(**).get("/accounts/#{account_id}/vectorize/v2/indexes/#{index_name}/list")
|
|
39
|
+
{ result: response.body, status: response.status }
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
include Legion::Extensions::Helpers::Lex if Legion::Extensions.const_defined?(:Helpers) &&
|
|
43
|
+
Legion::Extensions::Helpers.const_defined?(:Lex)
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'legion/extensions/cloudflare/vectorize/helpers/client'
|
|
4
|
+
require 'legion/extensions/cloudflare/vectorize/runners/indexes'
|
|
5
|
+
require 'legion/extensions/cloudflare/vectorize/runners/vectors'
|
|
6
|
+
require 'legion/extensions/cloudflare/vectorize/client'
|
|
7
|
+
|
|
8
|
+
module Legion
|
|
9
|
+
module Extensions
|
|
10
|
+
module Cloudflare
|
|
11
|
+
module Vectorize
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative 'helpers/client'
|
|
4
|
+
require_relative 'runners/devices'
|
|
5
|
+
require_relative 'runners/registrations'
|
|
6
|
+
require_relative 'runners/dex_tests'
|
|
7
|
+
require_relative 'runners/ip_profiles'
|
|
8
|
+
|
|
9
|
+
module Legion
|
|
10
|
+
module Extensions
|
|
11
|
+
module Cloudflare
|
|
12
|
+
module ZeroTrust
|
|
13
|
+
class Client
|
|
14
|
+
include Helpers::Client
|
|
15
|
+
include Runners::Devices
|
|
16
|
+
include Runners::Registrations
|
|
17
|
+
include Runners::DexTests
|
|
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
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'faraday'
|
|
4
|
+
|
|
5
|
+
module Legion
|
|
6
|
+
module Extensions
|
|
7
|
+
module Cloudflare
|
|
8
|
+
module ZeroTrust
|
|
9
|
+
module Helpers
|
|
10
|
+
module Client
|
|
11
|
+
def client(api_token:, **)
|
|
12
|
+
Faraday.new(url: 'https://api.cloudflare.com/client/v4') do |conn|
|
|
13
|
+
conn.request :json
|
|
14
|
+
conn.response :json, content_type: /\bjson$/
|
|
15
|
+
conn.headers['Content-Type'] = 'application/json'
|
|
16
|
+
conn.headers['Authorization'] = "Bearer #{api_token}"
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Legion
|
|
4
|
+
module Extensions
|
|
5
|
+
module Cloudflare
|
|
6
|
+
module ZeroTrust
|
|
7
|
+
module Runners
|
|
8
|
+
module Devices
|
|
9
|
+
extend Legion::Extensions::Cloudflare::ZeroTrust::Helpers::Client
|
|
10
|
+
|
|
11
|
+
def list_devices(account_id:, per_page: nil, search: nil, **)
|
|
12
|
+
params = { per_page: per_page, search: search }.compact
|
|
13
|
+
response = client(**).get("/accounts/#{account_id}/devices/physical-devices", params)
|
|
14
|
+
{ result: response.body, status: response.status }
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def get_device(account_id:, device_id:, **)
|
|
18
|
+
response = client(**).get("/accounts/#{account_id}/devices/physical-devices/#{device_id}")
|
|
19
|
+
{ result: response.body, status: response.status }
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def delete_device(account_id:, device_id:, **)
|
|
23
|
+
response = client(**).delete("/accounts/#{account_id}/devices/physical-devices/#{device_id}")
|
|
24
|
+
{ result: response.body, status: response.status }
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def revoke_device(account_id:, device_id:, **)
|
|
28
|
+
response = client(**).post("/accounts/#{account_id}/devices/physical-devices/#{device_id}/revoke")
|
|
29
|
+
{ result: response.body, status: response.status }
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
include Legion::Extensions::Helpers::Lex if Legion::Extensions.const_defined?(:Helpers) &&
|
|
33
|
+
Legion::Extensions::Helpers.const_defined?(:Lex)
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Legion
|
|
4
|
+
module Extensions
|
|
5
|
+
module Cloudflare
|
|
6
|
+
module ZeroTrust
|
|
7
|
+
module Runners
|
|
8
|
+
module DexTests
|
|
9
|
+
extend Legion::Extensions::Cloudflare::ZeroTrust::Helpers::Client
|
|
10
|
+
|
|
11
|
+
def list_dex_tests(account_id:, page: nil, per_page: nil, **)
|
|
12
|
+
params = { page: page, per_page: per_page }.compact
|
|
13
|
+
response = client(**).get("/accounts/#{account_id}/dex/devices/dex_tests", params)
|
|
14
|
+
{ result: response.body, status: response.status }
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def get_dex_test(account_id:, dex_test_id:, **)
|
|
18
|
+
response = client(**).get("/accounts/#{account_id}/dex/devices/dex_tests/#{dex_test_id}")
|
|
19
|
+
{ result: response.body, status: response.status }
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def create_dex_test(account_id:, body:, **)
|
|
23
|
+
response = client(**).post("/accounts/#{account_id}/dex/devices/dex_tests", body)
|
|
24
|
+
{ result: response.body, status: response.status }
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def update_dex_test(account_id:, dex_test_id:, body:, **)
|
|
28
|
+
response = client(**).put("/accounts/#{account_id}/dex/devices/dex_tests/#{dex_test_id}", body)
|
|
29
|
+
{ result: response.body, status: response.status }
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def delete_dex_test(account_id:, dex_test_id:, **)
|
|
33
|
+
response = client(**).delete("/accounts/#{account_id}/dex/devices/dex_tests/#{dex_test_id}")
|
|
34
|
+
{ result: response.body, status: response.status }
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
include Legion::Extensions::Helpers::Lex if Legion::Extensions.const_defined?(:Helpers) &&
|
|
38
|
+
Legion::Extensions::Helpers.const_defined?(:Lex)
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Legion
|
|
4
|
+
module Extensions
|
|
5
|
+
module Cloudflare
|
|
6
|
+
module ZeroTrust
|
|
7
|
+
module Runners
|
|
8
|
+
module IpProfiles
|
|
9
|
+
extend Legion::Extensions::Cloudflare::ZeroTrust::Helpers::Client
|
|
10
|
+
|
|
11
|
+
def list_ip_profiles(account_id:, per_page: nil, **)
|
|
12
|
+
params = { per_page: per_page }.compact
|
|
13
|
+
response = client(**).get("/accounts/#{account_id}/devices/ip-profiles", params)
|
|
14
|
+
{ result: response.body, status: response.status }
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def get_ip_profile(account_id:, profile_id:, **)
|
|
18
|
+
response = client(**).get("/accounts/#{account_id}/devices/ip-profiles/#{profile_id}")
|
|
19
|
+
{ result: response.body, status: response.status }
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def create_ip_profile(account_id:, body:, **)
|
|
23
|
+
response = client(**).post("/accounts/#{account_id}/devices/ip-profiles", body)
|
|
24
|
+
{ result: response.body, status: response.status }
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def update_ip_profile(account_id:, profile_id:, body:, **)
|
|
28
|
+
response = client(**).patch("/accounts/#{account_id}/devices/ip-profiles/#{profile_id}", body)
|
|
29
|
+
{ result: response.body, status: response.status }
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def delete_ip_profile(account_id:, profile_id:, **)
|
|
33
|
+
response = client(**).delete("/accounts/#{account_id}/devices/ip-profiles/#{profile_id}")
|
|
34
|
+
{ result: response.body, status: response.status }
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
include Legion::Extensions::Helpers::Lex if Legion::Extensions.const_defined?(:Helpers) &&
|
|
38
|
+
Legion::Extensions::Helpers.const_defined?(:Lex)
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Legion
|
|
4
|
+
module Extensions
|
|
5
|
+
module Cloudflare
|
|
6
|
+
module ZeroTrust
|
|
7
|
+
module Runners
|
|
8
|
+
module Registrations
|
|
9
|
+
extend Legion::Extensions::Cloudflare::ZeroTrust::Helpers::Client
|
|
10
|
+
|
|
11
|
+
def list_registrations(account_id:, per_page: nil, search: nil, **)
|
|
12
|
+
params = { per_page: per_page, search: search }.compact
|
|
13
|
+
response = client(**).get("/accounts/#{account_id}/devices/registrations", params)
|
|
14
|
+
{ result: response.body, status: response.status }
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def get_registration(account_id:, registration_id:, **)
|
|
18
|
+
response = client(**).get("/accounts/#{account_id}/devices/registrations/#{registration_id}")
|
|
19
|
+
{ result: response.body, status: response.status }
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def delete_registration(account_id:, registration_id:, **)
|
|
23
|
+
response = client(**).delete("/accounts/#{account_id}/devices/registrations/#{registration_id}")
|
|
24
|
+
{ result: response.body, status: response.status }
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def revoke_registrations(account_id:, ids:, **)
|
|
28
|
+
response = client(**).post("/accounts/#{account_id}/devices/registrations/revoke", nil, { id: ids })
|
|
29
|
+
{ result: response.body, status: response.status }
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def unrevoke_registrations(account_id:, ids:, **)
|
|
33
|
+
response = client(**).post("/accounts/#{account_id}/devices/registrations/unrevoke", nil, { id: ids })
|
|
34
|
+
{ result: response.body, status: response.status }
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
include Legion::Extensions::Helpers::Lex if Legion::Extensions.const_defined?(:Helpers) &&
|
|
38
|
+
Legion::Extensions::Helpers.const_defined?(:Lex)
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'legion/extensions/cloudflare/zero_trust/helpers/client'
|
|
4
|
+
require 'legion/extensions/cloudflare/zero_trust/runners/devices'
|
|
5
|
+
require 'legion/extensions/cloudflare/zero_trust/runners/registrations'
|
|
6
|
+
require 'legion/extensions/cloudflare/zero_trust/runners/dex_tests'
|
|
7
|
+
require 'legion/extensions/cloudflare/zero_trust/runners/ip_profiles'
|
|
8
|
+
require 'legion/extensions/cloudflare/zero_trust/client'
|
|
9
|
+
|
|
10
|
+
module Legion
|
|
11
|
+
module Extensions
|
|
12
|
+
module Cloudflare
|
|
13
|
+
module ZeroTrust
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative 'cloudflare/version'
|
|
4
|
+
require_relative 'cloudflare/dns'
|
|
5
|
+
require_relative 'cloudflare/dns_firewall'
|
|
6
|
+
require_relative 'cloudflare/custom_nameservers'
|
|
7
|
+
require_relative 'cloudflare/zero_trust'
|
|
8
|
+
require_relative 'cloudflare/ssl'
|
|
9
|
+
require_relative 'cloudflare/vectorize'
|
|
10
|
+
require_relative 'cloudflare/ai_gateway'
|
|
11
|
+
require_relative 'cloudflare/ai'
|
|
12
|
+
|
|
13
|
+
module Legion
|
|
14
|
+
module Extensions
|
|
15
|
+
module Cloudflare
|
|
16
|
+
extend Legion::Extensions::Core if Legion::Extensions.const_defined? :Core
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|