forked from beyang/sourcegraph-OLD-2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathschema.go
More file actions
380 lines (352 loc) · 19.9 KB
/
schema.go
File metadata and controls
380 lines (352 loc) · 19.9 KB
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
// Code generated by go-jsonschema-compiler. DO NOT EDIT.
package schema
import (
"encoding/json"
"errors"
"fmt"
"github.com/sourcegraph/go-jsonschema/jsonschema"
)
type AWSCodeCommitConnection struct {
AccessKeyID string `json:"accessKeyID"`
InitialRepositoryEnablement bool `json:"initialRepositoryEnablement,omitempty"`
Region string `json:"region"`
RepositoryPathPattern string `json:"repositoryPathPattern,omitempty"`
SecretAccessKey string `json:"secretAccessKey"`
}
// AuthAccessTokens description: Settings for access tokens, which enable external tools to access the Sourcegraph API with the privileges of the user.
type AuthAccessTokens struct {
Allow string `json:"allow,omitempty"`
}
// AuthProviderCommon description: Common properties for authentication providers.
type AuthProviderCommon struct {
DisplayName string `json:"displayName,omitempty"`
}
type AuthProviders struct {
Builtin *BuiltinAuthProvider
Saml *SAMLAuthProvider
Openidconnect *OpenIDConnectAuthProvider
HttpHeader *HTTPHeaderAuthProvider
}
func (v AuthProviders) MarshalJSON() ([]byte, error) {
if v.Builtin != nil {
return json.Marshal(v.Builtin)
}
if v.Saml != nil {
return json.Marshal(v.Saml)
}
if v.Openidconnect != nil {
return json.Marshal(v.Openidconnect)
}
if v.HttpHeader != nil {
return json.Marshal(v.HttpHeader)
}
return nil, errors.New("tagged union type must have exactly 1 non-nil field value")
}
func (v *AuthProviders) UnmarshalJSON(data []byte) error {
var d struct {
DiscriminantProperty string `json:"type"`
}
if err := json.Unmarshal(data, &d); err != nil {
return err
}
switch d.DiscriminantProperty {
case "builtin":
return json.Unmarshal(data, &v.Builtin)
case "http-header":
return json.Unmarshal(data, &v.HttpHeader)
case "openidconnect":
return json.Unmarshal(data, &v.Openidconnect)
case "saml":
return json.Unmarshal(data, &v.Saml)
}
return fmt.Errorf("tagged union type must have a %q property whose value is one of %s", "type", []string{"builtin", "saml", "openidconnect", "http-header"})
}
type BitbucketServerConnection struct {
Certificate string `json:"certificate,omitempty"`
ExcludePersonalRepositories bool `json:"excludePersonalRepositories,omitempty"`
GitURLType string `json:"gitURLType,omitempty"`
InitialRepositoryEnablement bool `json:"initialRepositoryEnablement,omitempty"`
Password string `json:"password,omitempty"`
RepositoryPathPattern string `json:"repositoryPathPattern,omitempty"`
Token string `json:"token,omitempty"`
Url string `json:"url"`
Username string `json:"username,omitempty"`
}
// BuiltinAuthProvider description: Configures the builtin username-password authentication provider.
type BuiltinAuthProvider struct {
AllowSignup bool `json:"allowSignup,omitempty"`
Type string `json:"type"`
}
// CloneURLToRepositoryName description: Describes a mapping from clone URL to repository name. The `from` field contains a regular expression with named capturing groups. The `to` field contains a template string that references capturing group names. For instance, if `from` is "^../(?P<name>\w+)$" and `to` is "github.com/user/{name}", the clone URL "../myRepository" would be mapped to the repository name "github.com/user/myRepository".
type CloneURLToRepositoryName struct {
From string `json:"from"`
To string `json:"to"`
}
// Contributions description: Features contributed by this extension. Extensions may also register certain types of contributions dynamically.
type Contributions struct {
Configuration *jsonschema.Schema `json:"configuration,omitempty"`
}
// Discussions description: Configures Sourcegraph code discussions.
type Discussions struct {
AbuseEmails []string `json:"abuseEmails,omitempty"`
AbuseProtection bool `json:"abuseProtection,omitempty"`
}
// ExperimentalFeatures description: Experimental features to enable or disable. Features that are now enabled by default are marked as deprecated.
type ExperimentalFeatures struct {
CanonicalURLRedirect string `json:"canonicalURLRedirect,omitempty"`
ConfigVars string `json:"configVars,omitempty"`
Discussions string `json:"discussions,omitempty"`
JumpToDefOSSIndex string `json:"jumpToDefOSSIndex,omitempty"`
MultipleAuthProviders string `json:"multipleAuthProviders,omitempty"`
UpdateScheduler string `json:"updateScheduler,omitempty"`
}
// ExtensionRepository description: The location of the version control repository for this extension.
type ExtensionRepository struct {
Type string `json:"type,omitempty"`
Url string `json:"url"`
}
// Extensions description: Configures Sourcegraph extensions.
type Extensions struct {
AllowRemoteExtensions []string `json:"allowRemoteExtensions,omitempty"`
Disabled *bool `json:"disabled,omitempty"`
RemoteRegistry interface{} `json:"remoteRegistry,omitempty"`
}
type GitHubConnection struct {
Certificate string `json:"certificate,omitempty"`
GitURLType string `json:"gitURLType,omitempty"`
InitialRepositoryEnablement bool `json:"initialRepositoryEnablement,omitempty"`
Repos []string `json:"repos,omitempty"`
RepositoryPathPattern string `json:"repositoryPathPattern,omitempty"`
RepositoryQuery []string `json:"repositoryQuery,omitempty"`
Token string `json:"token"`
Url string `json:"url,omitempty"`
}
type GitLabConnection struct {
Certificate string `json:"certificate,omitempty"`
GitURLType string `json:"gitURLType,omitempty"`
InitialRepositoryEnablement bool `json:"initialRepositoryEnablement,omitempty"`
ProjectQuery []string `json:"projectQuery,omitempty"`
RepositoryPathPattern string `json:"repositoryPathPattern,omitempty"`
Token string `json:"token"`
Url string `json:"url"`
}
type GitoliteConnection struct {
Blacklist string `json:"blacklist,omitempty"`
Host string `json:"host"`
PhabricatorMetadataCommand string `json:"phabricatorMetadataCommand,omitempty"`
Prefix string `json:"prefix"`
}
// HTTPHeaderAuthProvider description: Configures the HTTP header authentication provider (which authenticates users by consulting an HTTP request header set by an authentication proxy such as https://github.com/bitly/oauth2_proxy).
type HTTPHeaderAuthProvider struct {
Type string `json:"type"`
UsernameHeader string `json:"usernameHeader"`
}
// IMAPServerConfig description: Optional. The IMAP server used to retrieve emails (such as code discussion reply emails).
type IMAPServerConfig struct {
Host string `json:"host"`
Password string `json:"password,omitempty"`
Port int `json:"port"`
Username string `json:"username,omitempty"`
}
type Langservers struct {
Address string `json:"address,omitempty"`
Disabled bool `json:"disabled,omitempty"`
InitializationOptions map[string]interface{} `json:"initializationOptions,omitempty"`
Language string `json:"language"`
Metadata *Metadata `json:"metadata,omitempty"`
}
type Links struct {
Blob string `json:"blob,omitempty"`
Commit string `json:"commit,omitempty"`
Repository string `json:"repository,omitempty"`
Tree string `json:"tree,omitempty"`
}
// Log description: Configuration for logging and alerting, including to external services.
type Log struct {
Sentry *Sentry `json:"sentry,omitempty"`
}
// Metadata description: Language server metadata. Used to populate various UI elements.
type Metadata struct {
DocsURL string `json:"docsURL,omitempty"`
Experimental bool `json:"experimental,omitempty"`
HomepageURL string `json:"homepageURL,omitempty"`
IssuesURL string `json:"issuesURL,omitempty"`
}
// OpenIDConnectAuthProvider description: Configures the OpenID Connect authentication provider for SSO.
type OpenIDConnectAuthProvider struct {
ClientID string `json:"clientID"`
ClientSecret string `json:"clientSecret"`
DisplayName string `json:"displayName,omitempty"`
Issuer string `json:"issuer"`
RequireEmailDomain string `json:"requireEmailDomain,omitempty"`
Type string `json:"type"`
}
// ParentSourcegraph description: URL to fetch unreachable repository details from. Defaults to "https://sourcegraph.com"
type ParentSourcegraph struct {
Url string `json:"url,omitempty"`
}
type Phabricator struct {
Repos []*Repos `json:"repos,omitempty"`
Token string `json:"token,omitempty"`
Url string `json:"url,omitempty"`
}
type Repos struct {
Callsign string `json:"callsign"`
Path string `json:"path"`
}
type Repository struct {
Links *Links `json:"links,omitempty"`
Path string `json:"path"`
Type string `json:"type,omitempty"`
Url string `json:"url"`
}
type ReviewBoard struct {
Url string `json:"url,omitempty"`
}
// SAMLAuthProvider description: Configures the SAML authentication provider for SSO.
//
// Note: if you are using IdP-initiated login, you must have *at most one* SAMLAuthProvider in the `auth.providers` array.
type SAMLAuthProvider struct {
DisplayName string `json:"displayName,omitempty"`
IdentityProviderMetadata string `json:"identityProviderMetadata,omitempty"`
IdentityProviderMetadataURL string `json:"identityProviderMetadataURL,omitempty"`
InsecureSkipAssertionSignatureValidation bool `json:"insecureSkipAssertionSignatureValidation,omitempty"`
NameIDFormat string `json:"nameIDFormat,omitempty"`
ServiceProviderCertificate string `json:"serviceProviderCertificate,omitempty"`
ServiceProviderIssuer string `json:"serviceProviderIssuer,omitempty"`
ServiceProviderPrivateKey string `json:"serviceProviderPrivateKey,omitempty"`
SignRequests *bool `json:"signRequests,omitempty"`
Type string `json:"type"`
}
// SMTPServerConfig description: The SMTP server used to send transactional emails (such as email verifications, reset-password emails, and notifications).
type SMTPServerConfig struct {
Authentication string `json:"authentication"`
Domain string `json:"domain,omitempty"`
Host string `json:"host"`
Password string `json:"password,omitempty"`
Port int `json:"port"`
Username string `json:"username,omitempty"`
}
type SearchSavedQueries struct {
Description string `json:"description"`
Key string `json:"key"`
Notify bool `json:"notify,omitempty"`
NotifySlack bool `json:"notifySlack,omitempty"`
Query string `json:"query"`
ShowOnHomepage bool `json:"showOnHomepage,omitempty"`
}
type SearchScope struct {
Description string `json:"description,omitempty"`
Id string `json:"id,omitempty"`
Name string `json:"name"`
Value string `json:"value"`
}
// Sentry description: Configuration for Sentry
type Sentry struct {
Dsn string `json:"dsn,omitempty"`
}
// Settings description: Configuration settings for users and organizations on Sourcegraph.
type Settings struct {
Extensions map[string]bool `json:"extensions,omitempty"`
Motd []string `json:"motd,omitempty"`
NotificationsSlack *SlackNotificationsConfig `json:"notifications.slack,omitempty"`
SearchRepositoryGroups map[string][]string `json:"search.repositoryGroups,omitempty"`
SearchSavedQueries []*SearchSavedQueries `json:"search.savedQueries,omitempty"`
SearchScopes []*SearchScope `json:"search.scopes,omitempty"`
}
type SiteConfigSearchScope struct {
Description string `json:"description,omitempty"`
Id string `json:"id,omitempty"`
Name string `json:"name"`
Value string `json:"value"`
}
// SiteConfigSettings description: Site settings hard-coded in site configuration.
//
// DEPRECATED: Specify site settings in the site admin global settings page instead of hard-coding them in the site configuration file. This makes it possible to change site settings without redeploying the cluster in Sourcegraph Data Center.
type SiteConfigSettings struct {
SearchRepositoryGroups map[string][]string `json:"search.repositoryGroups,omitempty"`
SearchScopes []*SiteConfigSearchScope `json:"search.scopes,omitempty"`
}
// SiteConfiguration description: Configuration for a Sourcegraph site.
type SiteConfiguration struct {
AppURL string `json:"appURL,omitempty"`
AuthAccessTokens *AuthAccessTokens `json:"auth.accessTokens,omitempty"`
AuthAllowSignup bool `json:"auth.allowSignup,omitempty"`
AuthDisableAccessTokens bool `json:"auth.disableAccessTokens,omitempty"`
AuthOpenIDConnect *OpenIDConnectAuthProvider `json:"auth.openIDConnect,omitempty"`
AuthProvider string `json:"auth.provider,omitempty"`
AuthProviders []AuthProviders `json:"auth.providers,omitempty"`
AuthPublic bool `json:"auth.public,omitempty"`
AuthSaml *SAMLAuthProvider `json:"auth.saml,omitempty"`
AuthSessionExpiry string `json:"auth.sessionExpiry,omitempty"`
AuthUserIdentityHTTPHeader string `json:"auth.userIdentityHTTPHeader,omitempty"`
AuthUserOrgMap map[string][]string `json:"auth.userOrgMap,omitempty"`
AwsCodeCommit []*AWSCodeCommitConnection `json:"awsCodeCommit,omitempty"`
BitbucketServer []*BitbucketServerConnection `json:"bitbucketServer,omitempty"`
BlacklistGoGet []string `json:"blacklistGoGet,omitempty"`
CorsOrigin string `json:"corsOrigin,omitempty"`
DisableAutoGitUpdates bool `json:"disableAutoGitUpdates,omitempty"`
DisableBrowserExtension bool `json:"disableBrowserExtension,omitempty"`
DisableBuiltInSearches bool `json:"disableBuiltInSearches,omitempty"`
DisablePublicRepoRedirects bool `json:"disablePublicRepoRedirects,omitempty"`
Discussions *Discussions `json:"discussions,omitempty"`
DontIncludeSymbolResultsByDefault bool `json:"dontIncludeSymbolResultsByDefault,omitempty"`
EmailAddress string `json:"email.address,omitempty"`
EmailImap *IMAPServerConfig `json:"email.imap,omitempty"`
EmailSmtp *SMTPServerConfig `json:"email.smtp,omitempty"`
ExecuteGradleOriginalRootPaths string `json:"executeGradleOriginalRootPaths,omitempty"`
ExperimentalFeatures *ExperimentalFeatures `json:"experimentalFeatures,omitempty"`
Extensions *Extensions `json:"extensions,omitempty"`
GitCloneURLToRepositoryName []*CloneURLToRepositoryName `json:"git.cloneURLToRepositoryName,omitempty"`
GitMaxConcurrentClones int `json:"gitMaxConcurrentClones,omitempty"`
Github []*GitHubConnection `json:"github,omitempty"`
GithubClientID string `json:"githubClientID,omitempty"`
GithubClientSecret string `json:"githubClientSecret,omitempty"`
Gitlab []*GitLabConnection `json:"gitlab,omitempty"`
Gitolite []*GitoliteConnection `json:"gitolite,omitempty"`
HtmlBodyBottom string `json:"htmlBodyBottom,omitempty"`
HtmlBodyTop string `json:"htmlBodyTop,omitempty"`
HtmlHeadBottom string `json:"htmlHeadBottom,omitempty"`
HtmlHeadTop string `json:"htmlHeadTop,omitempty"`
HttpStrictTransportSecurity interface{} `json:"httpStrictTransportSecurity,omitempty"`
HttpToHttpsRedirect interface{} `json:"httpToHttpsRedirect,omitempty"`
Langservers []*Langservers `json:"langservers,omitempty"`
LicenseKey string `json:"licenseKey,omitempty"`
LightstepAccessToken string `json:"lightstepAccessToken,omitempty"`
LightstepProject string `json:"lightstepProject,omitempty"`
Log *Log `json:"log,omitempty"`
MaxReposToSearch int `json:"maxReposToSearch,omitempty"`
NoGoGetDomains string `json:"noGoGetDomains,omitempty"`
ParentSourcegraph *ParentSourcegraph `json:"parentSourcegraph,omitempty"`
Phabricator []*Phabricator `json:"phabricator,omitempty"`
PrivateArtifactRepoID string `json:"privateArtifactRepoID,omitempty"`
PrivateArtifactRepoPassword string `json:"privateArtifactRepoPassword,omitempty"`
PrivateArtifactRepoURL string `json:"privateArtifactRepoURL,omitempty"`
PrivateArtifactRepoUsername string `json:"privateArtifactRepoUsername,omitempty"`
RepoListUpdateInterval int `json:"repoListUpdateInterval,omitempty"`
ReposList []*Repository `json:"repos.list,omitempty"`
ReviewBoard []*ReviewBoard `json:"reviewBoard,omitempty"`
SearchScopes []*SiteConfigSearchScope `json:"searchScopes,omitempty"`
Settings *SiteConfigSettings `json:"settings,omitempty"`
SiteID string `json:"siteID,omitempty"`
TlsLetsencrypt string `json:"tls.letsencrypt,omitempty"`
TlsCert string `json:"tlsCert,omitempty"`
TlsKey string `json:"tlsKey,omitempty"`
UpdateChannel string `json:"update.channel,omitempty"`
UseJaeger bool `json:"useJaeger,omitempty"`
}
// SlackNotificationsConfig description: Configuration for sending notifications to Slack.
type SlackNotificationsConfig struct {
WebhookURL string `json:"webhookURL"`
}
// SourcegraphExtensionManifest description: The Sourcegraph extension manifest describes the extension and the features it provides.
type SourcegraphExtensionManifest struct {
ActivationEvents []string `json:"activationEvents"`
Args *map[string]interface{} `json:"args,omitempty"`
Contributes *Contributions `json:"contributes,omitempty"`
Description string `json:"description,omitempty"`
Readme string `json:"readme,omitempty"`
Repository *ExtensionRepository `json:"repository,omitempty"`
Title string `json:"title,omitempty"`
Url string `json:"url"`
}