archsight 0.2.7 → 0.2.8
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/lib/archsight/import/handlers/rest_api_index.rb +16 -5
- data/lib/archsight/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 03da27eff05412536d72c6e2036c787cde324c05ad84ace8f054c15589b1507f
|
|
4
|
+
data.tar.gz: 2e09404c869bbbb07e9f12f48a0d73fa390222ca50e12b272a9608eec319b78d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: fe1962993bdd6dca5af552044f8bdec012b286d54a54338f3fc5704ef9247701813f0132683f2dd8462be66f2d45cb4ba1e5e7381c6ac7977fb6994cc6e0c41c
|
|
7
|
+
data.tar.gz: 94d83e2b0f58073f4286e24bbfd27ecf7b84f7e83d86ed259b2af4e8b0069969fd218ca614d5ba682478db0b858bef48256c1ef707ad02c9d0c0fbaafa3357a1
|
|
@@ -18,6 +18,10 @@ require_relative "../registry"
|
|
|
18
18
|
# import/config/skipVisibility - Comma-separated visibilities to skip (e.g., "public-preview")
|
|
19
19
|
# import/config/childCacheTime - Cache time for generated child imports (e.g., "1h", "30m")
|
|
20
20
|
#
|
|
21
|
+
# APIs whose "gate" value isn't a recognized status (General-Availability,
|
|
22
|
+
# Early-Access, Development, or their GA/EA/DEV aliases) are skipped, since
|
|
23
|
+
# they can't be represented by the ApplicationInterface status annotation.
|
|
24
|
+
#
|
|
21
25
|
# Output:
|
|
22
26
|
# Generates Import:RestApi:* resources for each API in the index
|
|
23
27
|
#
|
|
@@ -36,6 +40,8 @@ require_relative "../registry"
|
|
|
36
40
|
# ]
|
|
37
41
|
# }
|
|
38
42
|
class Archsight::Import::Handlers::RestApiIndex < Archsight::Import::Handler
|
|
43
|
+
VALID_GATES = %w[General-Availability Early-Access Development GA EA DEV].freeze
|
|
44
|
+
|
|
39
45
|
def execute
|
|
40
46
|
@index_url = config("indexUrl")
|
|
41
47
|
raise "Missing required config: indexUrl" unless @index_url
|
|
@@ -55,10 +61,10 @@ class Archsight::Import::Handlers::RestApiIndex < Archsight::Import::Handler
|
|
|
55
61
|
return
|
|
56
62
|
end
|
|
57
63
|
|
|
58
|
-
# Filter APIs by visibility
|
|
64
|
+
# Filter APIs by visibility and gate
|
|
59
65
|
original_count = apis.size
|
|
60
66
|
apis = filter_apis(apis)
|
|
61
|
-
progress.update("Filtered to #{apis.size} APIs (skipped #{original_count - apis.size} by visibility)") if apis.size < original_count
|
|
67
|
+
progress.update("Filtered to #{apis.size} APIs (skipped #{original_count - apis.size} by visibility/gate)") if apis.size < original_count
|
|
62
68
|
|
|
63
69
|
# Generate child imports
|
|
64
70
|
progress.update("Generating #{apis.size} import resources")
|
|
@@ -107,14 +113,19 @@ class Archsight::Import::Handlers::RestApiIndex < Archsight::Import::Handler
|
|
|
107
113
|
end
|
|
108
114
|
|
|
109
115
|
def filter_apis(apis)
|
|
110
|
-
return apis if @skip_visibilities.empty?
|
|
111
|
-
|
|
112
116
|
apis.reject do |api|
|
|
113
117
|
visibility = api["visibility"]&.downcase
|
|
114
|
-
@skip_visibilities.any? { |skip| visibility == skip.downcase }
|
|
118
|
+
skipped_by_visibility = @skip_visibilities.any? { |skip| visibility == skip.downcase }
|
|
119
|
+
skipped_by_visibility || !valid_gate?(api["gate"])
|
|
115
120
|
end
|
|
116
121
|
end
|
|
117
122
|
|
|
123
|
+
def valid_gate?(gate)
|
|
124
|
+
return true if gate.nil? # falls back to "GA" default in generate_api_imports
|
|
125
|
+
|
|
126
|
+
VALID_GATES.any? { |valid| gate.casecmp?(valid) }
|
|
127
|
+
end
|
|
128
|
+
|
|
118
129
|
def generate_api_imports(apis)
|
|
119
130
|
yaml_documents = apis.map do |api|
|
|
120
131
|
api_name = api["name"]
|
data/lib/archsight/version.rb
CHANGED