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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ee4785cb42348dcbad1e9731b83a9e9b783f3eebe831dac544a771cff6a01829
4
- data.tar.gz: 6223d231b7a01a0eed99ec14ad7bfa5ccad45b41ff4b6e4b4a29bd64946cd184
3
+ metadata.gz: 03da27eff05412536d72c6e2036c787cde324c05ad84ace8f054c15589b1507f
4
+ data.tar.gz: 2e09404c869bbbb07e9f12f48a0d73fa390222ca50e12b272a9608eec319b78d
5
5
  SHA512:
6
- metadata.gz: 6c76128de7274e7dc083bae693958f8afad14231120d59c2a3ac169408962f739239c06ec3a30d2b1a34fa19fb555bbe2ee87deaec6464881faad4e992482a3c
7
- data.tar.gz: 7b6c865e1ab3287be9e8a23c29b9884cf0e98c0929af47ab577e567c51d3c075ee00b51653191267c8f0fde1032b7ba872221932850092643c5d8db1235fa130
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"]
@@ -4,5 +4,5 @@
4
4
  # Do not edit manually.
5
5
 
6
6
  module Archsight
7
- VERSION = "0.2.7"
7
+ VERSION = "0.2.8"
8
8
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: archsight
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.7
4
+ version: 0.2.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vincent Landgraf