-
Notifications
You must be signed in to change notification settings - Fork 0
/
registry_gen.go
417 lines (342 loc) · 18.4 KB
/
registry_gen.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
// Code generated by github.com/atombender/go-jsonschema, DO NOT EDIT.
package k6registry
// k6 Extension Catalog.
//
// The k6 extension catalog is an alternative representation of the k6 extension
// registry.
// The catalog stores the extension data in an associative array (object),
// where the key is the import path for JavaScript extensions, and the output name
// for output extensions.
// This data structure is optimized to resolve extensions as dependencies.
type Catalog map[string]Extension
type Category string
const CategoryAuthentication Category = "authentication"
const CategoryBrowser Category = "browser"
const CategoryData Category = "data"
const CategoryKubernetes Category = "kubernetes"
const CategoryMessaging Category = "messaging"
const CategoryMisc Category = "misc"
const CategoryObservability Category = "observability"
const CategoryProtocol Category = "protocol"
const CategoryReporting Category = "reporting"
// The result of the extension's k6 compliance checks.
type Compliance struct {
// Compliance expressed as a grade.
//
// The `grade` property contains a grade (A-F) of how well the extension complies
// with best practices.
// The value of the `grade` can be `A`,`B`,`C`,`D`,`E`,`F` and is calculated from
// the `level` property.
//
Grade Grade `json:"grade" yaml:"grade" mapstructure:"grade"`
// A list of compliance check IDs that failed.
//
// The `issues`` property is primarily used for debugging. It contains the
// (implementation-dependent) identifiers of those compliance checks that failed.
//
Issues []string `json:"issues,omitempty" yaml:"issues,omitempty" mapstructure:"issues,omitempty"`
// Compliance expressed as a percentage.
//
// The `level` property contains a percentage of how well the extension complies
// with best practices.
// The value of the `level` can be between `0-100` and is determined by the
// weighted and normalized sum of the scores of the compliance checks.
//
Level int `json:"level" yaml:"level" mapstructure:"level"`
}
// Properties of the registered k6 extension.
//
// Only those properties of the extensions are registered, which either cannot be
// detected automatically, or delegation to the extension is not allowed.
//
// Properties that are available using the repository manager API are intentionally
// not registered.
//
// The string like properties that are included in the generated Grafana
// documentation are intentionally not accessed via the API of the repository
// manager. It is not allowed to inject arbitrary text into the Grafana
// documentation site without approval. Therefore, these properties are registered
// (eg `description`)
type Extension struct {
// The categories to which the extension belongs.
//
// If the property is missing or empty in the registry source, the default value
// is `["misc"]`.
//
Categories []Category `json:"categories,omitempty" yaml:"categories,omitempty" mapstructure:"categories,omitempty"`
// Flag indicating the need for cgo.
//
// The `cgo` property value `true` indicates that cgo must be enabled to build the
// extension.
//
Cgo bool `json:"cgo,omitempty" yaml:"cgo,omitempty" mapstructure:"cgo,omitempty"`
// The result of the extension's k6 compliance checks.
//
Compliance *Compliance `json:"compliance,omitempty" yaml:"compliance,omitempty" mapstructure:"compliance,omitempty"`
// Version constraints.
//
// Version constraints are primarily used to filter automatically detected
// versions.
// It can also be used to filter the versions property imported from the origin
// registry.
//
Constraints string `json:"constraints,omitempty" yaml:"constraints,omitempty" mapstructure:"constraints,omitempty"`
// Brief description of the extension.
//
Description string `json:"description,omitempty" yaml:"description,omitempty" mapstructure:"description,omitempty"`
// List of JavaScript import paths registered by the extension.
//
// Currently, paths must start with the prefix `k6/x/`.
//
// The extensions used by k6 scripts are automatically detected based on the
// values specified here, therefore it is important that the values used here are
// consistent with the values registered by the extension at runtime.
//
Imports []string `json:"imports,omitempty" yaml:"imports,omitempty" mapstructure:"imports,omitempty"`
// The extension's go module path.
//
// This is the unique identifier of the extension.
// More info about module paths: https://go.dev/ref/mod#module-path
//
// The extension has no name property, the module path or part of it can be used
// as the extension name. For example, using the first two elements of the module
// path after the host name, the name `grafana/xk6-dashboard` can be formed from
// the module path `github.com/grafana/xk6-dashboard`. This is typically the
// repository owner name and the repository name in the repository manager.
//
// The extension has no URL property, a URL can be created from the module path
// that refers to the extension within the repository manager.
//
Module string `json:"module" yaml:"module" mapstructure:"module"`
// List of output names registered by the extension.
//
// The extensions used by k6 scripts are automatically detected based on the
// values specified here, therefore it is important that the values used here are
// consistent with the values registered by the extension at runtime.
//
Outputs []string `json:"outputs,omitempty" yaml:"outputs,omitempty" mapstructure:"outputs,omitempty"`
// Products in which the extension can be used.
//
// Some extensions are not available in all k6 products.
// This may be for a technological or business reason, or the functionality of the
// extension may not make sense in the given product.
//
// Possible values:
//
// - oss: Extensions are available in k6 OSS
// - cloud: Extensions are available in Grafana Cloud k6
// - synthetic: Extensions are available in Grafana Synthetic Monitoring
//
// If the property is missing or empty in the source of the registry, it means
// that the extension is only available in the k6 OSS product.
// In this case, the registry will be filled in accordingly during generation.
//
Products []Product `json:"products,omitempty" yaml:"products,omitempty" mapstructure:"products,omitempty"`
// Repository metadata.
//
// Metadata provided by the extension's git repository manager. Repository
// metadata are not registered, they are queried at runtime using the repository
// manager API.
//
Repo *Repository `json:"repo,omitempty" yaml:"repo,omitempty" mapstructure:"repo,omitempty"`
// Maintainer of the extension.
//
// Possible values:
//
// - official: Extensions owned, maintained, and designated by Grafana as
// "official"
// - partner: Extensions written, maintained, validated, and published by
// third-party companies against their own projects.
// - community: Extensions are listed on the Registry by individual maintainers,
// groups of maintainers, or other members of the k6 community.
//
// Extensions owned by the `grafana` GitHub organization are not officially
// supported by Grafana by default.
// There are several k6 extensions owned by the `grafana` GitHub organization,
// which were created for experimental or example purposes only.
// The `official` tier value is needed so that officially supported extensions can
// be distinguished from them.
//
// If it is missing from the registry source, it will be set with the default
// "community" value during generation.
//
Tier Tier `json:"tier,omitempty" yaml:"tier,omitempty" mapstructure:"tier,omitempty"`
// List of supported versions.
//
// Versions are tags whose format meets the requirements of semantic versioning.
// Version tags often start with the letter `v`, which is not part of the semantic
// version.
//
Versions []string `json:"versions,omitempty" yaml:"versions,omitempty" mapstructure:"versions,omitempty"`
}
type Grade string
const GradeA Grade = "A"
const GradeB Grade = "B"
const GradeC Grade = "C"
const GradeD Grade = "D"
const GradeE Grade = "E"
const GradeF Grade = "F"
const GradeG Grade = "G"
// Extension registry metrics.
type Metrics struct {
// Number of extensions in the 'authentication' category.
CategoryAuthenticationCount int `json:"category_authentication_count,omitempty" yaml:"category_authentication_count,omitempty" mapstructure:"category_authentication_count,omitempty"`
// Number of extensions in the 'browser' category.
CategoryBrowserCount int `json:"category_browser_count,omitempty" yaml:"category_browser_count,omitempty" mapstructure:"category_browser_count,omitempty"`
// Number of extensions in the 'data' category.
CategoryDataCount int `json:"category_data_count,omitempty" yaml:"category_data_count,omitempty" mapstructure:"category_data_count,omitempty"`
// Number of extensions in the 'kubernetes' category.
CategoryKubernetesCount int `json:"category_kubernetes_count,omitempty" yaml:"category_kubernetes_count,omitempty" mapstructure:"category_kubernetes_count,omitempty"`
// Number of extensions in the 'messaging' category.
CategoryMessagingCount int `json:"category_messaging_count,omitempty" yaml:"category_messaging_count,omitempty" mapstructure:"category_messaging_count,omitempty"`
// Number of extensions in the 'misc' category.
CategoryMiscCount int `json:"category_misc_count,omitempty" yaml:"category_misc_count,omitempty" mapstructure:"category_misc_count,omitempty"`
// Number of extensions in the 'observability' category.
CategoryObservabilityCount int `json:"category_observability_count,omitempty" yaml:"category_observability_count,omitempty" mapstructure:"category_observability_count,omitempty"`
// Number of extensions in the 'protocol' category.
CategoryProtocolCount int `json:"category_protocol_count,omitempty" yaml:"category_protocol_count,omitempty" mapstructure:"category_protocol_count,omitempty"`
// Number of extensions in the 'reporting' category.
CategoryReportingCount int `json:"category_reporting_count,omitempty" yaml:"category_reporting_count,omitempty" mapstructure:"category_reporting_count,omitempty"`
// Number of extensions requiring cgo.
CgoCount int `json:"cgo_count,omitempty" yaml:"cgo_count,omitempty" mapstructure:"cgo_count,omitempty"`
// The total number of extensions.
ExtensionCount int `json:"extension_count,omitempty" yaml:"extension_count,omitempty" mapstructure:"extension_count,omitempty"`
// Number of A-grade extensions.
GradeACount int `json:"grade_a_count,omitempty" yaml:"grade_a_count,omitempty" mapstructure:"grade_a_count,omitempty"`
// Number of B-grade extensions.
GradeBCount int `json:"grade_b_count,omitempty" yaml:"grade_b_count,omitempty" mapstructure:"grade_b_count,omitempty"`
// Number of C-grade extensions.
GradeCCount int `json:"grade_c_count,omitempty" yaml:"grade_c_count,omitempty" mapstructure:"grade_c_count,omitempty"`
// Number of D-grade extensions.
GradeDCount int `json:"grade_d_count,omitempty" yaml:"grade_d_count,omitempty" mapstructure:"grade_d_count,omitempty"`
// Number of E-grade extensions.
GradeECount int `json:"grade_e_count,omitempty" yaml:"grade_e_count,omitempty" mapstructure:"grade_e_count,omitempty"`
// Number of F-grade extensions.
GradeFCount int `json:"grade_f_count,omitempty" yaml:"grade_f_count,omitempty" mapstructure:"grade_f_count,omitempty"`
// Number of extensions not buildable with the latest k6 version.
IssueBuildCount int `json:"issue_build_count,omitempty" yaml:"issue_build_count,omitempty" mapstructure:"issue_build_count,omitempty"`
// Number of extensions without CODEOWNERS file.
IssueCodeownersCount int `json:"issue_codeowners_count,omitempty" yaml:"issue_codeowners_count,omitempty" mapstructure:"issue_codeowners_count,omitempty"`
// Number of extensions without examples directory.
IssueExamplesCount int `json:"issue_examples_count,omitempty" yaml:"issue_examples_count,omitempty" mapstructure:"issue_examples_count,omitempty"`
// Number of extensions without git workdir.
IssueGitCount int `json:"issue_git_count,omitempty" yaml:"issue_git_count,omitempty" mapstructure:"issue_git_count,omitempty"`
// Number of extensions without suitable OSS license.
IssueLicenseCount int `json:"issue_license_count,omitempty" yaml:"issue_license_count,omitempty" mapstructure:"issue_license_count,omitempty"`
// Number of extensions without valid go.mod.
IssueModuleCount int `json:"issue_module_count,omitempty" yaml:"issue_module_count,omitempty" mapstructure:"issue_module_count,omitempty"`
// Number of extensions without readme file.
IssueReadmeCount int `json:"issue_readme_count,omitempty" yaml:"issue_readme_count,omitempty" mapstructure:"issue_readme_count,omitempty"`
// Number of extensions with replace directive in go.mod.
IssueReplaceCount int `json:"issue_replace_count,omitempty" yaml:"issue_replace_count,omitempty" mapstructure:"issue_replace_count,omitempty"`
// Number of extensions without smoke test script.
IssueSmokeCount int `json:"issue_smoke_count,omitempty" yaml:"issue_smoke_count,omitempty" mapstructure:"issue_smoke_count,omitempty"`
// Number of extensions without API declaration file.
IssueTypesCount int `json:"issue_types_count,omitempty" yaml:"issue_types_count,omitempty" mapstructure:"issue_types_count,omitempty"`
// Number of extensions without semantic versioning git tags.
IssueVersionsCount int `json:"issue_versions_count,omitempty" yaml:"issue_versions_count,omitempty" mapstructure:"issue_versions_count,omitempty"`
// Number of extensions available in Grafana Cloud k6.
ProductCloudCount int `json:"product_cloud_count,omitempty" yaml:"product_cloud_count,omitempty" mapstructure:"product_cloud_count,omitempty"`
// Number of extensions available in Grafana k6.
ProductOSSCount int `json:"product_oss_count,omitempty" yaml:"product_oss_count,omitempty" mapstructure:"product_oss_count,omitempty"`
// Number of extensions available in Synthetic Monitoring.
ProductSyntheticCount int `json:"product_synthetic_count,omitempty" yaml:"product_synthetic_count,omitempty" mapstructure:"product_synthetic_count,omitempty"`
// Number of extension in the community' tier.
TierCommunityCount int `json:"tier_community_count,omitempty" yaml:"tier_community_count,omitempty" mapstructure:"tier_community_count,omitempty"`
// Number of extensions in the 'official' tier.
TierOfficialCount int `json:"tier_official_count,omitempty" yaml:"tier_official_count,omitempty" mapstructure:"tier_official_count,omitempty"`
// Number of extensions in the 'partner' tier.
TierPartnerCount int `json:"tier_partner_count,omitempty" yaml:"tier_partner_count,omitempty" mapstructure:"tier_partner_count,omitempty"`
// Number of unofficial extensions.
TierUnofficialCount int `json:"tier_unofficial_count,omitempty" yaml:"tier_unofficial_count,omitempty" mapstructure:"tier_unofficial_count,omitempty"`
// Number of JavaScript extension.
TypeJavaScriptCount int `json:"type_javascript_count,omitempty" yaml:"type_javascript_count,omitempty" mapstructure:"type_javascript_count,omitempty"`
// Number of Output extension.
TypeOutputCount int `json:"type_output_count,omitempty" yaml:"type_output_count,omitempty" mapstructure:"type_output_count,omitempty"`
}
type Product string
const ProductCloud Product = "cloud"
const ProductOSS Product = "oss"
const ProductSynthetic Product = "synthetic"
// k6 Extension Registry.
//
// The k6 extension registry contains the most important properties of registered
// extensions.
type Registry []Extension
// Repository metadata.
//
// Metadata provided by the extension's git repository manager. Repository metadata
// are not registered, they are queried at runtime using the repository manager
// API.
type Repository struct {
// Archived repository flag.
//
// A `true` value indicates that the repository is archived, read only.
//
// If a repository is archived, it usually means that the owner has no intention
// of maintaining it. Such extensions should be removed from the registry.
//
Archived bool `json:"archived,omitempty" yaml:"archived,omitempty" mapstructure:"archived,omitempty"`
// URL for the git clone operation.
//
// The clone_url property contains a (typically HTTP) URL, which is used to clone
// the repository.
//
CloneURL string `json:"clone_url,omitempty" yaml:"clone_url,omitempty" mapstructure:"clone_url,omitempty"`
// Repository description.
//
Description string `json:"description,omitempty" yaml:"description,omitempty" mapstructure:"description,omitempty"`
// The URL to the project homepage.
//
// If no homepage is set, the value is the same as the url property.
//
Homepage string `json:"homepage,omitempty" yaml:"homepage,omitempty" mapstructure:"homepage,omitempty"`
// The SPDX ID of the extension's license.
//
// For more information about SPDX, visit https://spdx.org/licenses/
//
License string `json:"license,omitempty" yaml:"license,omitempty" mapstructure:"license,omitempty"`
// The name of the repository.
//
Name string `json:"name" yaml:"name" mapstructure:"name"`
// The owner of the repository.
//
Owner string `json:"owner" yaml:"owner" mapstructure:"owner"`
// Public repository flag.
//
// A `true` value indicates that the repository is public, available to anyone.
//
Public bool `json:"public,omitempty" yaml:"public,omitempty" mapstructure:"public,omitempty"`
// The number of stars in the extension's repository.
//
// The extension's popularity is indicated by how many users have starred the
// extension's repository.
//
Stars int `json:"stars,omitempty" yaml:"stars,omitempty" mapstructure:"stars,omitempty"`
// Last modification timestamp.
//
// The timestamp property contains the timestamp of the last modification of the
// repository in UNIX time format (the number of non-leap seconds that have
// elapsed since 00:00:00 UTC on 1st January 1970).
// Its value depends on the repository manager, in the case of GitHub it contains
// the time of the last push operation, in the case of GitLab the time of the last
// repository activity.
//
Timestamp float64 `json:"timestamp,omitempty" yaml:"timestamp,omitempty" mapstructure:"timestamp,omitempty"`
// Repository topics.
//
// Topics make it easier to find the repository. It is recommended to set the xk6
// topic to the extensions repository.
//
Topics []string `json:"topics,omitempty" yaml:"topics,omitempty" mapstructure:"topics,omitempty"`
// URL of the repository.
//
// The URL is provided by the repository manager and can be displayed in a
// browser.
//
URL string `json:"url" yaml:"url" mapstructure:"url"`
}
type Tier string
const TierCommunity Tier = "community"
const TierOfficial Tier = "official"
const TierPartner Tier = "partner"