-
Notifications
You must be signed in to change notification settings - Fork 39
/
Copy pathconfig.go
478 lines (397 loc) · 12.3 KB
/
config.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
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
package config
const SPOT = "spot"
const ON_DEMAND = "on-demand"
func ConvertSpotBoolToVMProvisioningType(spot bool) string {
if spot {
return SPOT
} else {
return ON_DEMAND
}
}
// Config represents a control-tower configuration file
type Config struct {
AllowIPs string `json:"allow_ips"`
AllowIPsUnformatted string `json:"allow_ips_unformatted"`
AvailabilityZone string `json:"availability_zone"`
BitbucketClientID string `json:"bitbucket_client_id"`
BitbucketClientSecret string `json:"bitbucket_client_secret"`
ConcourseCACert string `json:"concourse_ca_cert"`
ConcourseCert string `json:"concourse_cert"`
ConcourseKey string `json:"concourse_key"`
ConcoursePassword string `json:"concourse_password"`
ConcourseUsername string `json:"concourse_username"`
ConcourseWebSize string `json:"concourse_web_size"`
ConcourseWorkerCount int `json:"concourse_worker_count"`
ConcourseWorkerSize string `json:"concourse_worker_size"`
ConfigBucket string `json:"config_bucket"`
CredhubAdminClientSecret string `json:"credhub_admin_client_secret"`
CredhubCACert string `json:"credhub_ca_cert"`
CredhubPassword string `json:"credhub_password"`
CredhubURL string `json:"credhub_url"`
CredhubUsername string `json:"credhub_username"`
Deployment string `json:"deployment"`
DirectorCACert string `json:"director_ca_cert"`
DirectorCert string `json:"director_cert"`
DirectorHMUserPassword string `json:"director_hm_user_password"`
DirectorKey string `json:"director_key"`
DirectorMbusPassword string `json:"director_mbus_password"`
DirectorNATSPassword string `json:"director_nats_password"`
DirectorPassword string `json:"director_password"`
DirectorPublicIP string `json:"director_public_ip"`
DirectorRegistryPassword string `json:"director_registry_password"`
DirectorUsername string `json:"director_username"`
Domain string `json:"domain"`
EnableGlobalResources bool `json:"enable_global_resources"`
EnablePipelineInstances bool `json:"enable_pipeline_instances"`
InfluxDbRetention string `json:"influx_db_retention_period"`
EncryptionKey string `json:"encryption_key"`
GithubClientID string `json:"github_client_id"`
GithubClientSecret string `json:"github_client_secret"`
GithubHost string `json:"github_host"`
GithubCaCert string `json:"github_ca_cert"`
GrafanaPassword string `json:"grafana_password"`
HostedZoneID string `json:"hosted_zone_id"`
HostedZoneRecordPrefix string `json:"hosted_zone_record_prefix"`
IAAS string `json:"iaas"`
MainGithubUsers string `json:"main_github_users"`
MainGithubTeams string `json:"main_github_teams"`
MainGithubOrgs string `json:"main_github_orgs"`
MicrosoftClientID string `json:"microsoft_client_id"`
MicrosoftClientSecret string `json:"microsoft_client_secret"`
MicrosoftTenant string `json:"microsoft_tenant"`
Namespace string `json:"namespace"`
NetworkCIDR string `json:"network_cidr"`
NoMetrics bool `json:"no_metrics"`
PersistentDisk string `json:"persistent_disk"`
PrivateCIDR string `json:"private_cidr"`
PrivateKey string `json:"private_key"`
Project string `json:"project"`
PublicCIDR string `json:"public_cidr"`
PublicKey string `json:"public_key"`
RDS1CIDR string `json:"rds1_cidr"`
RDS2CIDR string `json:"rds2_cidr"`
RDSDefaultDatabaseName string `json:"rds_default_database_name"`
RDSInstanceClass string `json:"rds_instance_class"`
RDSPassword string `json:"rds_password"`
RDSUsername string `json:"rds_username"`
RDSDiskEncryption bool `json:"rds_disk_encryption"`
Region string `json:"region"`
SourceAccessIP string `json:"source_access_ip"`
//Spot is deprecated, exists only as we need to migrate old configs to VMProvisioningType
Spot bool `json:"spot"`
Tags []string `json:"tags"`
TFStatePath string `json:"tf_state_path"`
Version string `json:"version"`
VMProvisioningType string `json:"vm_provisioning_type"`
WorkerType string `json:"worker_type"`
}
type ConfigView interface {
GetAllowIPs() string
GetAllowIPsUnformatted() string
GetAvailabilityZone() string
GetBitbucketClientID() string
GetBitbucketClientSecret() string
GetConcourseCACert() string
GetConcourseCert() string
GetConcourseKey() string
GetConcoursePassword() string
GetConcourseUsername() string
GetConcourseWebSize() string
GetConcourseWorkerCount() int
GetConcourseWorkerSize() string
GetConfigBucket() string
GetCredhubAdminClientSecret() string
GetCredhubCACert() string
GetCredhubPassword() string
GetCredhubURL() string
GetCredhubUsername() string
GetDeployment() string
GetDirectorCACert() string
GetDirectorCert() string
GetDirectorHMUserPassword() string
GetDirectorKey() string
GetDirectorMbusPassword() string
GetDirectorNATSPassword() string
GetDirectorPassword() string
GetDirectorPublicIP() string
GetDirectorRegistryPassword() string
GetDirectorUsername() string
GetDomain() string
GetEnableGlobalResources() bool
GetEnablePipelineInstances() bool
GetInfluxDbRetention() string
GetEncryptionKey() string
GetGithubClientID() string
GetGithubClientSecret() string
GetGithubHost() string
GetGithubCaCert() string
GetGrafanaPassword() string
GetHostedZoneID() string
GetHostedZoneRecordPrefix() string
GetIAAS() string
GetMainGithubUsers() string
GetMainGithubTeams() string
GetMainGithubOrgs() string
GetMicrosoftClientID() string
GetMicrosoftClientSecret() string
GetMicrosoftTenant() string
GetNamespace() string
GetNetworkCIDR() string
GetPersistentDiskSize() string
GetPrivateCIDR() string
GetPrivateKey() string
GetProject() string
GetPublicCIDR() string
GetPublicKey() string
GetRDS1CIDR() string
GetRDS2CIDR() string
GetRDSDefaultDatabaseName() string
GetRDSInstanceClass() string
GetRDSPassword() string
GetRDSUsername() string
GetRDSDiskEncryption() bool
GetRegion() string
GetSourceAccessIP() string
GetTags() []string
GetTFStatePath() string
GetVersion() string
GetWorkerType() string
IsBitbucketAuthSet() bool
IsGithubAuthSet() bool
IsGithubEnterpriseAuthSet() bool
IsMainGithubAuthSet() bool
IsMicrosoftAuthSet() bool
IsSpot() bool
MetricsIsDisabled() bool
}
func (c Config) GetAllowIPs() string {
return c.AllowIPs
}
func (c Config) GetAllowIPsUnformatted() string {
return c.AllowIPsUnformatted
}
func (c Config) GetAvailabilityZone() string {
return c.AvailabilityZone
}
func (c Config) GetBitbucketClientID() string {
return c.BitbucketClientID
}
func (c Config) GetBitbucketClientSecret() string {
return c.BitbucketClientSecret
}
func (c Config) GetConcourseCACert() string {
return c.ConcourseCACert
}
func (c Config) GetConcourseCert() string {
return c.ConcourseCert
}
func (c Config) GetConcourseKey() string {
return c.ConcourseKey
}
func (c Config) GetConcoursePassword() string {
return c.ConcoursePassword
}
func (c Config) GetConcourseUsername() string {
return c.ConcourseUsername
}
func (c Config) GetConcourseWebSize() string {
return c.ConcourseWebSize
}
func (c Config) GetPersistentDiskSize() string {
return c.PersistentDisk
}
func (c Config) GetConcourseWorkerCount() int {
return c.ConcourseWorkerCount
}
func (c Config) GetConcourseWorkerSize() string {
return c.ConcourseWorkerSize
}
func (c Config) GetConfigBucket() string {
return c.ConfigBucket
}
func (c Config) GetCredhubAdminClientSecret() string {
return c.CredhubAdminClientSecret
}
func (c Config) GetCredhubCACert() string {
return c.CredhubCACert
}
func (c Config) GetCredhubPassword() string {
return c.CredhubPassword
}
func (c Config) GetCredhubURL() string {
return c.CredhubURL
}
func (c Config) GetCredhubUsername() string {
return c.CredhubUsername
}
func (c Config) GetDeployment() string {
return c.Deployment
}
func (c Config) GetDirectorCACert() string {
return c.DirectorCACert
}
func (c Config) GetDirectorCert() string {
return c.DirectorCert
}
func (c Config) GetDirectorHMUserPassword() string {
return c.DirectorHMUserPassword
}
func (c Config) GetDirectorKey() string {
return c.DirectorKey
}
func (c Config) GetDirectorMbusPassword() string {
return c.DirectorMbusPassword
}
func (c Config) GetDirectorNATSPassword() string {
return c.DirectorNATSPassword
}
func (c Config) GetDirectorPassword() string {
return c.DirectorPassword
}
func (c Config) GetDirectorPublicIP() string {
return c.DirectorPublicIP
}
func (c Config) GetDirectorRegistryPassword() string {
return c.DirectorRegistryPassword
}
func (c Config) GetDirectorUsername() string {
return c.DirectorUsername
}
func (c Config) GetDomain() string {
return c.Domain
}
func (c Config) GetEnableGlobalResources() bool {
return c.EnableGlobalResources
}
func (c Config) GetInfluxDbRetention() string {
return c.InfluxDbRetention
}
func (c Config) GetEnablePipelineInstances() bool {
return c.EnablePipelineInstances
}
func (c Config) GetEncryptionKey() string {
return c.EncryptionKey
}
func (c Config) GetGithubClientID() string {
return c.GithubClientID
}
func (c Config) GetGithubClientSecret() string {
return c.GithubClientSecret
}
func (c Config) GetGithubHost() string {
return c.GithubHost
}
func (c Config) GetGithubCaCert() string {
return c.GithubCaCert
}
func (c Config) GetGrafanaPassword() string {
return c.GrafanaPassword
}
func (c Config) GetHostedZoneID() string {
return c.HostedZoneID
}
func (c Config) GetHostedZoneRecordPrefix() string {
return c.HostedZoneRecordPrefix
}
func (c Config) GetIAAS() string {
return c.IAAS
}
func (c Config) GetMainGithubUsers() string {
return c.MainGithubUsers
}
func (c Config) GetMainGithubTeams() string {
return c.MainGithubTeams
}
func (c Config) GetMainGithubOrgs() string {
return c.MainGithubOrgs
}
func (c Config) GetMicrosoftClientID() string {
return c.MicrosoftClientID
}
func (c Config) GetMicrosoftClientSecret() string {
return c.MicrosoftClientSecret
}
func (c Config) GetMicrosoftTenant() string {
return c.MicrosoftTenant
}
func (c Config) GetNamespace() string {
return c.Namespace
}
func (c Config) GetNetworkCIDR() string {
return c.NetworkCIDR
}
func (c Config) GetPrivateCIDR() string {
return c.PrivateCIDR
}
func (c Config) GetPrivateKey() string {
return c.PrivateKey
}
func (c Config) GetProject() string {
return c.Project
}
func (c Config) GetPublicCIDR() string {
return c.PublicCIDR
}
func (c Config) GetPublicKey() string {
return c.PublicKey
}
func (c Config) GetRDS1CIDR() string {
return c.RDS1CIDR
}
func (c Config) GetRDS2CIDR() string {
return c.RDS2CIDR
}
func (c Config) GetRDSDefaultDatabaseName() string {
return c.RDSDefaultDatabaseName
}
func (c Config) GetRDSInstanceClass() string {
return c.RDSInstanceClass
}
func (c Config) GetRDSPassword() string {
return c.RDSPassword
}
func (c Config) GetRDSUsername() string {
return c.RDSUsername
}
func (c Config) GetRDSDiskEncryption() bool {
return c.RDSDiskEncryption
}
func (c Config) GetRegion() string {
return c.Region
}
func (c Config) GetSourceAccessIP() string {
return c.SourceAccessIP
}
func (c Config) GetTags() []string {
return c.Tags
}
func (c Config) GetTFStatePath() string {
return c.TFStatePath
}
func (c Config) GetVersion() string {
return c.Version
}
func (c Config) GetWorkerType() string {
return c.WorkerType
}
func (c Config) IsBitbucketAuthSet() bool {
return c.BitbucketClientID != "" && c.BitbucketClientSecret != ""
}
func (c Config) IsGithubAuthSet() bool {
return c.GithubClientID != "" && c.GithubClientSecret != ""
}
func (c Config) IsMainGithubAuthSet() bool {
return c.MainGithubUsers != "" || c.MainGithubTeams != "" || c.MainGithubOrgs != ""
}
func (c Config) IsGithubEnterpriseAuthSet() bool {
return c.GithubHost != "" && c.GithubCaCert != ""
}
func (c Config) IsMicrosoftAuthSet() bool {
return c.MicrosoftClientID != "" && c.MicrosoftClientSecret != ""
}
func (c Config) IsSpot() bool {
return c.VMProvisioningType == SPOT
}
func (c Config) MetricsIsDisabled() bool {
return c.NoMetrics
}