5
5
using System . Collections . Frozen ;
6
6
using System . ComponentModel . DataAnnotations ;
7
7
using Elastic . Markdown . Suggestions ;
8
- using EnumFastToStringGenerated ;
9
8
using YamlDotNet . Core ;
10
9
using YamlDotNet . Core . Events ;
11
10
using YamlDotNet . Serialization ;
12
11
13
12
namespace Elastic . Markdown . Myst . FrontMatter ;
14
13
15
- [ EnumGenerator ]
16
- public enum Product
17
- {
18
- [ Display ( Name = "apm" , Description = "APM" ) ]
19
- Apm ,
20
-
21
- [ Display ( Name = "apm-dotnet-agent" , Description = "APM .NET Agent" ) ]
22
- ApmDotnetAgent ,
23
-
24
- [ Display ( Name = "apm-android-agent" , Description = "APM Android Agent" ) ]
25
- ApmAndroidAgent ,
26
-
27
- [ Display ( Name = "apm-attacher" , Description = "APM Attacher" ) ]
28
- ApmAttacher ,
29
-
30
- [ Display ( Name = "apm-aws-lambda-extension" , Description = "APM AWS Lambda extension" ) ]
31
- ApmAwsLambdaExtension ,
32
-
33
- [ Display ( Name = "apm-go-agent" , Description = "APM Go Agent" ) ]
34
- ApmGoAgent ,
35
-
36
- [ Display ( Name = "apm-ios-agent" , Description = "APM iOS Agent" ) ]
37
- ApmIosAgent ,
38
-
39
- [ Display ( Name = "apm-java-agent" , Description = "APM Java Agent" ) ]
40
- ApmJavaAgent ,
41
-
42
- [ Display ( Name = "apm-node-agent" , Description = "APM Node.js Agent" ) ]
43
- ApmNodeAgent ,
44
-
45
- [ Display ( Name = "apm-php-agent" , Description = "APM PHP Agent" ) ]
46
- ApmPhpAgent ,
47
-
48
- [ Display ( Name = "apm-python-agent" , Description = "APM Python Agent" ) ]
49
- ApmPythonAgent ,
50
-
51
- [ Display ( Name = "apm-ruby-agent" , Description = "APM Ruby Agent" ) ]
52
- ApmRubyAgent ,
53
-
54
- [ Display ( Name = "apm-rum-agent" , Description = "APM RUM Agent" ) ]
55
- ApmRumAgent ,
56
-
57
- [ Display ( Name = "beats-logging-plugin" , Description = "Beats Logging plugin" ) ]
58
- BeatsLoggingPlugin ,
59
-
60
- [ Display ( Name = "cloud-control-ecctl" , Description = "Cloud Control ECCTL" ) ]
61
- CloudControlEcctl ,
62
-
63
- [ Display ( Name = "cloud-enterprise" , Description = "Cloud Enterprise" ) ]
64
- CloudEnterprise ,
65
-
66
- [ Display ( Name = "cloud-hosted" , Description = "Cloud Hosted" ) ]
67
- CloudHosted ,
68
-
69
- [ Display ( Name = "cloud-kubernetes" , Description = "Cloud Kubernetes" ) ]
70
- CloudKubernetes ,
71
-
72
- [ Display ( Name = "cloud-native-ingest" , Description = "Cloud Native Ingest" ) ]
73
- CloudNativeIngest ,
74
-
75
- [ Display ( Name = "cloud-serverless" , Description = "Cloud Serverless" ) ]
76
- CloudServerless ,
77
-
78
- [ Display ( Name = "cloud-terraform" , Description = "Cloud Terraform" ) ]
79
- CloudTerraform ,
80
-
81
- [ Display ( Name = "ecs-logging" , Description = "ECS Logging" ) ]
82
- EcsLogging ,
83
-
84
- [ Display ( Name = "ecs-logging-dotnet" , Description = "ECS Logging .NET" ) ]
85
- EcsLoggingDotnet ,
86
-
87
- [ Display ( Name = "ecs-logging-go-logrus" , Description = "ECS Logging Go Logrus" ) ]
88
- EcsLoggingGoLogrus ,
89
-
90
- [ Display ( Name = "ecs-logging-go-zap" , Description = "ECS Logging Go Zap" ) ]
91
- EcsLoggingGoZap ,
92
-
93
- [ Display ( Name = "ecs-logging-go-zerolog" , Description = "ECS Logging Go Zerolog" ) ]
94
- EcsLoggingGoZerolog ,
95
-
96
- [ Display ( Name = "ecs-logging-java" , Description = "ECS Logging Java" ) ]
97
- EcsLoggingJava ,
98
-
99
- [ Display ( Name = "ecs-logging-node" , Description = "ECS Logging Node.js" ) ]
100
- EcsLoggingNode ,
101
-
102
- [ Display ( Name = "ecs-logging-php" , Description = "ECS Logging PHP" ) ]
103
- EcsLoggingPhp ,
104
-
105
- [ Display ( Name = "ecs-logging-python" , Description = "ECS Logging Python" ) ]
106
- EcsLoggingPython ,
107
-
108
- [ Display ( Name = "ecs-logging-ruby" , Description = "ECS Logging Ruby" ) ]
109
- EcsLoggingRuby ,
110
-
111
- [ Display ( Name = "elastic-agent" , Description = "Elastic Agent" ) ]
112
- ElasticAgent ,
113
-
114
- [ Display ( Name = "ecs" , Description = "Elastic Common Schema (ECS)" ) ]
115
- Ecs ,
116
-
117
- [ Display ( Name = "elastic-products-platform" , Description = "Elastic Products platform" ) ]
118
- ElasticProductsPlatform ,
119
-
120
- [ Display ( Name = "elastic-stack" , Description = "Elastic Stack" ) ]
121
- ElasticStack ,
122
-
123
- [ Display ( Name = "elasticsearch" , Description = "Elasticsearch" ) ]
124
- Elasticsearch ,
125
-
126
- [ Display ( Name = "elasticsearch-dotnet-client" , Description = "Elasticsearch .NET Client" ) ]
127
- ElasticsearchDotnetClient ,
14
+ public record Product ( string Id , string DisplayName ) ;
128
15
129
- [ Display ( Name = "elasticsearch-apache-hadoop" , Description = "Elasticsearch Apache Hadoop" ) ]
130
- ElasticsearchApacheHadoop ,
131
-
132
- [ Display ( Name = "elasticsearch-cloud-hosted-heroku" , Description = "Elasticsearch Cloud Hosted Heroku" ) ]
133
- ElasticsearchCloudHostedHeroku ,
134
-
135
- [ Display ( Name = "elasticsearch-community-clients" , Description = "Elasticsearch community clients" ) ]
136
- ElasticsearchCommunityClients ,
137
-
138
- [ Display ( Name = "elasticsearch-curator" , Description = "Elasticsearch Curator" ) ]
139
- ElasticsearchCurator ,
140
-
141
- [ Display ( Name = "elasticsearch-eland-python-client" , Description = "Elasticsearch Eland Python Client" ) ]
142
- ElasticsearchElandPythonClient ,
143
-
144
- [ Display ( Name = "elasticsearch-go-client" , Description = "Elasticsearch Go Client" ) ]
145
- ElasticsearchGoClient ,
146
-
147
- [ Display ( Name = "elasticsearch-groovy-client" , Description = "Elasticsearch Groovy Client" ) ]
148
- ElasticsearchGroovyClient ,
149
-
150
- [ Display ( Name = "elasticsearch-java-client" , Description = "Elasticsearch Java Client" ) ]
151
- ElasticsearchJavaClient ,
152
-
153
- [ Display ( Name = "elasticsearch-java-script-client" , Description = "Elasticsearch JavaScript Client" ) ]
154
- ElasticsearchJavaScriptClient ,
155
-
156
- [ Display ( Name = "elasticsearch-painless-scripting-language" , Description = "Elasticsearch Painless scripting language" ) ]
157
- ElasticsearchPainlessScriptingLanguage ,
158
-
159
- [ Display ( Name = "elasticsearch-perl-client" , Description = "Elasticsearch Perl Client" ) ]
160
- ElasticsearchPerlClient ,
161
-
162
- [ Display ( Name = "elasticsearch-php-client" , Description = "Elasticsearch PHP Client" ) ]
163
- ElasticsearchPhpClient ,
164
-
165
- [ Display ( Name = "elasticsearch-plugins" , Description = "Elasticsearch plugins" ) ]
166
- ElasticsearchPlugins ,
167
-
168
- [ Display ( Name = "elasticsearch-python-client" , Description = "Elasticsearch Python Client" ) ]
169
- ElasticsearchPythonClient ,
170
-
171
- [ Display ( Name = "elasticsearch-resiliency-status" , Description = "Elasticsearch Resiliency Status" ) ]
172
- ElasticsearchResiliencyStatus ,
173
-
174
- [ Display ( Name = "elasticsearch-ruby-client" , Description = "Elasticsearch Ruby Client" ) ]
175
- ElasticsearchRubyClient ,
176
-
177
- [ Display ( Name = "elasticsearch-rust-client" , Description = "Elasticsearch Rust Client" ) ]
178
- ElasticsearchRustClient ,
179
-
180
- [ Display ( Name = "fleet" , Description = "Fleet" ) ]
181
- Fleet ,
182
-
183
- [ Display ( Name = "ingest" , Description = "Ingest" ) ]
184
- Ingest ,
185
-
186
- [ Display ( Name = "integrations" , Description = "Integrations" ) ]
187
- Integrations ,
188
-
189
- [ Display ( Name = "kibana" , Description = "Kibana" ) ]
190
- Kibana ,
191
-
192
- [ Display ( Name = "logstash" , Description = "Logstash" ) ]
193
- Logstash ,
194
-
195
- [ Display ( Name = "machine-learning" , Description = "Machine Learning" ) ]
196
- MachineLearning ,
197
-
198
- [ Display ( Name = "observability" , Description = "Observability" ) ]
199
- Observability ,
200
-
201
- [ Display ( Name = "reference-architectures" , Description = "Reference Architectures" ) ]
202
- ReferenceArchitectures ,
203
-
204
- [ Display ( Name = "search-ui" , Description = "Search UI" ) ]
205
- SearchUi ,
206
-
207
- [ Display ( Name = "security" , Description = "Security" ) ]
208
- Security ,
209
-
210
- [ Display ( Name = "edot-collector" , Description = "Elastic Distribution of OpenTelemetry Collector" ) ]
211
- EdotCollector ,
212
-
213
- [ Display ( Name = "edot-java" , Description = "Elastic Distribution of OpenTelemetry Java" ) ]
214
- EdotJava ,
215
-
216
- [ Display ( Name = "edot-dotnet" , Description = "Elastic Distribution of OpenTelemetry .NET" ) ]
217
- EdotDotnet ,
218
-
219
- [ Display ( Name = "edot-nodejs" , Description = "Elastic Distribution of OpenTelemetry Node.js" ) ]
220
- EdotNodeJs ,
221
-
222
- [ Display ( Name = "edot-php" , Description = "Elastic Distribution of OpenTelemetry PHP" ) ]
223
- EdotPhp ,
224
-
225
- [ Display ( Name = "edot-python" , Description = "Elastic Distribution of OpenTelemetry Python" ) ]
226
- EdotPython ,
227
-
228
- [ Display ( Name = "edot-android" , Description = "Elastic Distribution of OpenTelemetry Android" ) ]
229
- EdotAndroid ,
230
-
231
- [ Display ( Name = "edot-ios" , Description = "Elastic Distribution of OpenTelemetry iOS" ) ]
232
- EdotIos ,
16
+ public static class Products
17
+ {
18
+ public static FrozenSet < Product > All { get ; } = [
19
+ new ( "apm" , "APM" ) ,
20
+ new ( "apm-dotnet-agent" , "APM .NET Agent" ) ,
21
+ new ( "apm-android-agent" , "APM Android Agent" ) ,
22
+ new ( "apm-attacher" , "APM Attacher" ) ,
23
+ new ( "apm-aws-lambda-extension" , "APM AWS Lambda extension" ) ,
24
+ new ( "apm-go-agent" , "APM Go Agent" ) ,
25
+ new ( "apm-ios-agent" , "APM iOS Agent" ) ,
26
+ new ( "apm-java-agent" , "APM Java Agent" ) ,
27
+ new ( "apm-node-agent" , "APM Node.js Agent" ) ,
28
+ new ( "apm-php-agent" , "APM PHP Agent" ) ,
29
+ new ( "apm-python-agent" , "APM Python Agent" ) ,
30
+ new ( "apm-ruby-agent" , "APM Ruby Agent" ) ,
31
+ new ( "apm-rum-agent" , "APM RUM Agent" ) ,
32
+ new ( "beats-logging-plugin" , "Beats Logging plugin" ) ,
33
+ new ( "cloud-control-ecctl" , "Cloud Control ECCTL" ) ,
34
+ new ( "cloud-enterprise" , "Cloud Enterprise" ) ,
35
+ new ( "cloud-hosted" , "Cloud Hosted" ) ,
36
+ new ( "cloud-kubernetes" , "Cloud Kubernetes" ) ,
37
+ new ( "cloud-native-ingest" , "Cloud Native Ingest" ) ,
38
+ new ( "cloud-serverless" , "Cloud Serverless" ) ,
39
+ new ( "cloud-terraform" , "Cloud Terraform" ) ,
40
+ new ( "ecs-logging" , "ECS Logging" ) ,
41
+ new ( "ecs-logging-dotnet" , "ECS Logging .NET" ) ,
42
+ new ( "ecs-logging-go-logrus" , "ECS Logging Go Logrus" ) ,
43
+ new ( "ecs-logging-go-zap" , "ECS Logging Go Zap" ) ,
44
+ new ( "ecs-logging-go-zerolog" , "ECS Logging Go Zerolog" ) ,
45
+ new ( "ecs-logging-java" , "ECS Logging Java" ) ,
46
+ new ( "ecs-logging-node" , "ECS Logging Node.js" ) ,
47
+ new ( "ecs-logging-php" , "ECS Logging PHP" ) ,
48
+ new ( "ecs-logging-python" , "ECS Logging Python" ) ,
49
+ new ( "ecs-logging-ruby" , "ECS Logging Ruby" ) ,
50
+ new ( "elastic-agent" , "Elastic Agent" ) ,
51
+ new ( "ecs" , "Elastic Common Schema (ECS)" ) ,
52
+ new ( "elastic-products-platform" , "Elastic Products platform" ) ,
53
+ new ( "elastic-stack" , "Elastic Stack" ) ,
54
+ new ( "elasticsearch" , "Elasticsearch" ) ,
55
+ new ( "elasticsearch-dotnet-client" , "Elasticsearch .NET Client" ) ,
56
+ new ( "elasticsearch-apache-hadoop" , "Elasticsearch Apache Hadoop" ) ,
57
+ new ( "elasticsearch-cloud-hosted-heroku" , "Elasticsearch Cloud Hosted Heroku" ) ,
58
+ new ( "elasticsearch-community-clients" , "Elasticsearch community clients" ) ,
59
+ new ( "elasticsearch-curator" , "Elasticsearch Curator" ) ,
60
+ new ( "elasticsearch-eland-python-client" , "Elasticsearch Eland Python Client" ) ,
61
+ new ( "elasticsearch-go-client" , "Elasticsearch Go Client" ) ,
62
+ new ( "elasticsearch-groovy-client" , "Elasticsearch Groovy Client" ) ,
63
+ new ( "elasticsearch-java-client" , "Elasticsearch Java Client" ) ,
64
+ new ( "elasticsearch-java-script-client" , "Elasticsearch JavaScript Client" ) ,
65
+ new ( "elasticsearch-painless-scripting-language" , "Elasticsearch Painless scripting language" ) ,
66
+ new ( "elasticsearch-perl-client" , "Elasticsearch Perl Client" ) ,
67
+ new ( "elasticsearch-php-client" , "Elasticsearch PHP Client" ) ,
68
+ new ( "elasticsearch-plugins" , "Elasticsearch plugins" ) ,
69
+ new ( "elasticsearch-python-client" , "Elasticsearch Python Client" ) ,
70
+ new ( "elasticsearch-resiliency-status" , "Elasticsearch Resiliency Status" ) ,
71
+ new ( "elasticsearch-ruby-client" , "Elasticsearch Ruby Client" ) ,
72
+ new ( "elasticsearch-rust-client" , "Elasticsearch Rust Client" ) ,
73
+ new ( "fleet" , "Fleet" ) ,
74
+ new ( "ingest" , "Ingest" ) ,
75
+ new ( "integrations" , "Integrations" ) ,
76
+ new ( "kibana" , "Kibana" ) ,
77
+ new ( "logstash" , "Logstash" ) ,
78
+ new ( "machine-learning" , "Machine Learning" ) ,
79
+ new ( "observability" , "Observability" ) ,
80
+ new ( "reference-architectures" , "Reference Architectures" ) ,
81
+ new ( "search-ui" , "Search UI" ) ,
82
+ new ( "security" , "Security" ) ,
83
+ new ( "edot-collector" , "Elastic Distribution of OpenTelemetry Collector" ) ,
84
+ new ( "edot-java" , "Elastic Distribution of OpenTelemetry Java" ) ,
85
+ new ( "edot-dotnet" , "Elastic Distribution of OpenTelemetry .NET" ) ,
86
+ new ( "edot-nodejs" , "Elastic Distribution of OpenTelemetry Node.js" ) ,
87
+ new ( "edot-php" , "Elastic Distribution of OpenTelemetry PHP" ) ,
88
+ new ( "edot-python" , "Elastic Distribution of OpenTelemetry Python" ) ,
89
+ new ( "edot-android" , "Elastic Distribution of OpenTelemetry Android" ) ,
90
+ new ( "edot-ios" , "Elastic Distribution of OpenTelemetry iOS" )
91
+ ] ;
92
+
93
+ public static FrozenDictionary < string , Product > AllById { get ; } = All . ToDictionary ( p => p . Id , StringComparer . Ordinal ) . ToFrozenDictionary ( ) ;
233
94
}
234
95
235
96
public class ProductConverter : IYamlTypeConverter
@@ -242,10 +103,7 @@ public object ReadYaml(IParser parser, Type type, ObjectDeserializer rootDeseria
242
103
if ( string . IsNullOrWhiteSpace ( value . Value ) )
243
104
throw new InvalidProductException ( "" ) ;
244
105
245
- var product = Enum . GetValues < Product > ( )
246
- . FirstOrDefault ( p => p . ToDisplayFast ( ) ? . Equals ( value . Value , StringComparison . Ordinal ) ?? false ) ;
247
-
248
- if ( ProductEnumExtensions . IsDefinedFast ( product ) && product . ToDisplayFast ( ) ? . Equals ( value . Value ) == true )
106
+ if ( Products . AllById . TryGetValue ( value . Value , out var product ) )
249
107
return product ;
250
108
251
109
throw new InvalidProductException ( value . Value ) ;
@@ -263,6 +121,5 @@ public class InvalidProductException(string invalidValue)
263
121
public static class ProductExtensions
264
122
{
265
123
public static IReadOnlySet < string > GetProductIds ( ) =>
266
- ProductEnumExtensions . GetValuesFast ( )
267
- . Select ( p => p . ToDisplayFast ( ) ) . ToFrozenSet ( ) ;
124
+ Products . All . Select ( p => p . Id ) . ToFrozenSet ( ) ;
268
125
}
0 commit comments