forked from cloudfoundry/bosh-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
opts.go
903 lines (666 loc) · 30.7 KB
/
opts.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
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
package cmd
import (
boshuuid "github.com/cloudfoundry/bosh-utils/uuid"
"github.com/cppforlife/go-patch/patch"
boshdir "github.com/cloudfoundry/bosh-cli/director"
boshrel "github.com/cloudfoundry/bosh-cli/release"
)
type BoshOpts struct {
// -----> Global options
VersionOpt func() error `long:"version" short:"v" description:"Show CLI version"`
ConfigPathOpt string `long:"config" description:"Config file path" env:"BOSH_CONFIG" default:"~/.bosh/config"`
EnvironmentOpt string `long:"environment" short:"e" description:"Director environment name or URL" env:"BOSH_ENVIRONMENT"`
CACertOpt CACertArg `long:"ca-cert" description:"Director CA certificate path or value" env:"BOSH_CA_CERT"`
Sha2 bool `long:"sha2" description:"Use SHA256 checksums"`
// Hidden
UsernameOpt string `long:"user" hidden:"true" env:"BOSH_USER"`
// Specify client credentials
ClientOpt string `long:"client" description:"Override username or UAA client" env:"BOSH_CLIENT"`
ClientSecretOpt string `long:"client-secret" description:"Override password or UAA client secret" env:"BOSH_CLIENT_SECRET"`
DeploymentOpt string `long:"deployment" short:"d" description:"Deployment name" env:"BOSH_DEPLOYMENT"`
// Output formatting
ColumnOpt []ColumnOpt `long:"column" description:"Filter to show only given column(s)"`
JSONOpt bool `long:"json" description:"Output as JSON"`
TTYOpt bool `long:"tty" description:"Force TTY-like output"`
NoColorOpt bool `long:"no-color" description:"Toggle colorized output"`
NonInteractiveOpt bool `long:"non-interactive" short:"n" description:"Don't ask for user input" env:"BOSH_NON_INTERACTIVE"`
Help HelpOpts `command:"help" description:"Show this help message"`
// -----> Director management
// Environments
Environment EnvironmentOpts `command:"environment" alias:"env" description:"Show environment"`
Environments EnvironmentsOpts `command:"environments" alias:"envs" description:"List environments"`
CreateEnv CreateEnvOpts `command:"create-env" description:"Create or update BOSH environment"`
DeleteEnv DeleteEnvOpts `command:"delete-env" description:"Delete BOSH environment"`
AliasEnv AliasEnvOpts `command:"alias-env" description:"Alias environment to save URL and CA certificate"`
// Authentication
LogIn LogInOpts `command:"log-in" alias:"l" alias:"login" description:"Log in"`
LogOut LogOutOpts `command:"log-out" alias:"logout" description:"Log out"`
// Tasks
Task TaskOpts `command:"task" alias:"t" description:"Show task status and start tracking its output"`
Tasks TasksOpts `command:"tasks" alias:"ts" description:"List running or recent tasks"`
CancelTask CancelTaskOpts `command:"cancel-task" alias:"ct" description:"Cancel task at its next checkpoint"`
// Misc
Locks LocksOpts `command:"locks" description:"List current locks"`
CleanUp CleanUpOpts `command:"clean-up" description:"Clean up releases, stemcells, disks, etc."`
// Cloud config
CloudConfig CloudConfigOpts `command:"cloud-config" alias:"cc" description:"Show current cloud config"`
UpdateCloudConfig UpdateCloudConfigOpts `command:"update-cloud-config" alias:"ucc" description:"Update current cloud config"`
// CPI Config
CPIConfig CPIConfigOpts `command:"cpi-config" description:"Show current CPI config"`
UpdateCPIConfig UpdateCPIConfigOpts `command:"update-cpi-config" description:"Update current CPI config"`
// Runtime config
RuntimeConfig RuntimeConfigOpts `command:"runtime-config" alias:"rc" description:"Show current runtime config"`
UpdateRuntimeConfig UpdateRuntimeConfigOpts `command:"update-runtime-config" alias:"urc" description:"Update current runtime config"`
// Deployments
Deployment DeploymentOpts `command:"deployment" alias:"dep" description:"Show deployment information"`
Deployments DeploymentsOpts `command:"deployments" alias:"ds" alias:"deps" description:"List deployments"`
DeleteDeployment DeleteDeploymentOpts `command:"delete-deployment" alias:"deld" description:"Delete deployment"`
Deploy DeployOpts `command:"deploy" alias:"d" description:"Update deployment"`
Manifest ManifestOpts `command:"manifest" alias:"man" description:"Show deployment manifest"`
Interpolate InterpolateOpts `command:"interpolate" alias:"int" description:"Interpolates variables into a manifest"`
// Events
Events EventsOpts `command:"events" description:"List events"`
Event EventOpts `command:"event" description:"Show event details"`
// Stemcells
Stemcells StemcellsOpts `command:"stemcells" alias:"ss" description:"List stemcells"`
UploadStemcell UploadStemcellOpts `command:"upload-stemcell" alias:"us" description:"Upload stemcell"`
DeleteStemcell DeleteStemcellOpts `command:"delete-stemcell" alias:"dels" description:"Delete stemcell"`
RepackStemcell RepackStemcellOpts `command:"repack-stemcell" description:"Repack stemcell"`
// Releases
Releases ReleasesOpts `command:"releases" alias:"rs" description:"List releases"`
UploadRelease UploadReleaseOpts `command:"upload-release" alias:"ur" description:"Upload release"`
ExportRelease ExportReleaseOpts `command:"export-release" description:"Export the compiled release to a tarball"`
InspectRelease InspectReleaseOpts `command:"inspect-release" description:"List release contents such as jobs"`
DeleteRelease DeleteReleaseOpts `command:"delete-release" alias:"delr" description:"Delete release"`
// Errands
Errands ErrandsOpts `command:"errands" alias:"es" description:"List errands"`
RunErrand RunErrandOpts `command:"run-errand" description:"Run errand"`
// Disks
Disks DisksOpts `command:"disks" description:"List disks"`
AttachDisk AttachDiskOpts `command:"attach-disk" description:"Attaches disk to an instance"`
DeleteDisk DeleteDiskOpts `command:"delete-disk" description:"Delete disk"`
OrphanDisk OrphanDiskOpts `command:"orphan-disk" description:"Orphan disk"`
// Snapshots
Snapshots SnapshotsOpts `command:"snapshots" description:"List snapshots"`
TakeSnapshot TakeSnapshotOpts `command:"take-snapshot" description:"Take snapshot"`
DeleteSnapshot DeleteSnapshotOpts `command:"delete-snapshot" description:"Delete snapshot"`
DeleteSnapshots DeleteSnapshotsOpts `command:"delete-snapshots" description:"Delete all snapshots in a deployment"`
// Instances
Instances InstancesOpts `command:"instances" alias:"is" description:"List all instances in a deployment"`
VMs VMsOpts `command:"vms" description:"List all VMs in all deployments"`
UpdateResurrection UpdateResurrectionOpts `command:"update-resurrection" description:"Enable/disable resurrection"`
Ignore IgnoreOpts `command:"ignore" description:"Ignore an instance"`
Unignore UnignoreOpts `command:"unignore" description:"Unignore an instance"`
CloudCheck CloudCheckOpts `command:"cloud-check" alias:"cck" alias:"cloudcheck" description:"Cloud consistency check and interactive repair"`
// Instance management
Logs LogsOpts `command:"logs" description:"Fetch logs from instance(s)"`
Start StartOpts `command:"start" description:"Start instance(s)"`
Stop StopOpts `command:"stop" description:"Stop instance(s)"`
Restart RestartOpts `command:"restart" description:"Restart instance(s)"`
Recreate RecreateOpts `command:"recreate" description:"Recreate instance(s)"`
DeleteVM DeleteVMOpts `command:"delete-vm" description:"Delete VM"`
// SSH instance
SSH SSHOpts `command:"ssh" description:"SSH into instance(s)"`
SCP SCPOpts `command:"scp" description:"SCP to/from instance(s)"`
// -----> Release authoring
// Release creation
InitRelease InitReleaseOpts `command:"init-release" description:"Initialize release"`
ResetRelease ResetReleaseOpts `command:"reset-release" description:"Reset release"`
GenerateJob GenerateJobOpts `command:"generate-job" description:"Generate job"`
GeneratePackage GeneratePackageOpts `command:"generate-package" description:"Generate package"`
CreateRelease CreateReleaseOpts `command:"create-release" alias:"cr" description:"Create release"`
// Hidden
Sha2ifyRelease Sha2ifyReleaseOpts `command:"sha2ify-release" hidden:"true" description:"Convert release tarball to use SHA256"`
FinalizeRelease FinalizeReleaseOpts `command:"finalize-release" description:"Create final release from dev release tarball"`
// Blob management
Blobs BlobsOpts `command:"blobs" description:"List blobs"`
AddBlob AddBlobOpts `command:"add-blob" description:"Add blob"`
RemoveBlob RemoveBlobOpts `command:"remove-blob" description:"Remove blob"`
SyncBlobs SyncBlobsOpts `command:"sync-blobs" description:"Sync blobs"`
UploadBlobs UploadBlobsOpts `command:"upload-blobs" description:"Upload blobs"`
Variables VariablesOpts `command:"variables" alias:"vars" description:"List variables"`
}
type HelpOpts struct {
cmd
}
// Original bosh-init
type CreateEnvOpts struct {
Args CreateEnvArgs `positional-args:"true" required:"true"`
VarFlags
OpsFlags
StatePath string `long:"state" value-name:"PATH" description:"State file path"`
cmd
}
type CreateEnvArgs struct {
Manifest FileBytesWithPathArg `positional-arg-name:"PATH" description:"Path to a manifest file"`
}
type DeleteEnvOpts struct {
Args DeleteEnvArgs `positional-args:"true" required:"true"`
VarFlags
OpsFlags
StatePath string `long:"state" value-name:"PATH" description:"State file path"`
cmd
}
type DeleteEnvArgs struct {
Manifest FileBytesWithPathArg `positional-arg-name:"PATH" description:"Path to a manifest file"`
}
// Environment
type EnvironmentOpts struct {
cmd
}
type EnvironmentsOpts struct {
cmd
}
type AliasEnvOpts struct {
Args AliasEnvArgs `positional-args:"true" required:"true"`
URL string
CACert CACertArg
cmd
}
type AliasEnvArgs struct {
Alias string `positional-arg-name:"ALIAS" description:"Environment alias"`
}
type LogInOpts struct {
cmd
}
type LogOutOpts struct {
cmd
}
// Tasks
type TaskOpts struct {
Args TaskArgs `positional-args:"true"`
Event bool `long:"event" description:"Track event log"`
CPI bool `long:"cpi" description:"Track CPI log"`
Debug bool `long:"debug" description:"Track debug log"`
Result bool `long:"result" description:"Track result log"`
All bool `long:"all" short:"a" description:"Include all task types (ssh, logs, vms, etc)"`
cmd
}
type TaskArgs struct {
ID int `positional-arg-name:"ID"`
}
type TasksOpts struct {
Recent *int `long:"recent" short:"r" description:"Number of tasks to show" optional:"true" optional-value:"30"`
All bool `long:"all" short:"a" description:"Include all task types (ssh, logs, vms, etc)"`
Deployment string
cmd
}
type CancelTaskOpts struct {
Args TaskArgs `positional-args:"true" required:"true"`
cmd
}
// Misc
type LocksOpts struct {
cmd
}
type CleanUpOpts struct {
All bool `long:"all" description:"Remove all unused releases, stemcells, etc.; otherwise most recent resources will be kept"`
cmd
}
type AttachDiskOpts struct {
Args AttachDiskArgs `positional-args:"true" required:"true"`
cmd
}
type AttachDiskArgs struct {
Slug boshdir.InstanceSlug `positional-arg-name:"INSTANCE-GROUP/INSTANCE-ID"`
DiskCID string `positional-arg-name:"DISK-CID"`
}
type InterpolateOpts struct {
Args InterpolateArgs `positional-args:"true" required:"true"`
VarFlags
OpsFlags
Path patch.Pointer `long:"path" value-name:"OP-PATH" description:"Extract value out of template (e.g.: /private_key)"`
VarErrors bool `long:"var-errs" description:"Expect all variables to be found, otherwise error"`
VarErrorsUnused bool `long:"var-errs-unused" description:"Expect all variables to be used, otherwise error"`
cmd
}
type InterpolateArgs struct {
Manifest FileBytesArg `positional-arg-name:"PATH" description:"Path to a template that will be interpolated"`
}
// Cloud config
type CloudConfigOpts struct {
cmd
}
type UpdateCloudConfigOpts struct {
Args UpdateCloudConfigArgs `positional-args:"true" required:"true"`
VarFlags
OpsFlags
cmd
}
type UpdateCloudConfigArgs struct {
CloudConfig FileBytesArg `positional-arg-name:"PATH" description:"Path to a cloud config file"`
}
type CPIConfigOpts struct {
cmd
}
type UpdateCPIConfigOpts struct {
Args UpdateCPIConfigArgs `positional-args:"true" required:"true"`
VarFlags
OpsFlags
cmd
}
type UpdateCPIConfigArgs struct {
CPIConfig FileBytesArg `positional-arg-name:"PATH" description:"Path to a CPI config file"`
}
// Runtime config
type RuntimeConfigOpts struct {
Name string `long:"name" description:"Runtime-Config name (default: '')" default:""`
cmd
}
type UpdateRuntimeConfigOpts struct {
Args UpdateRuntimeConfigArgs `positional-args:"true" required:"true"`
VarFlags
OpsFlags
Name string `long:"name" description:"Runtime-Config name (default: '')" default:""`
cmd
}
type UpdateRuntimeConfigArgs struct {
RuntimeConfig FileBytesArg `positional-arg-name:"PATH" description:"Path to a runtime config file"`
}
// Deployments
type DeploymentOpts struct {
cmd
}
type DeploymentsOpts struct {
cmd
}
type DeployOpts struct {
Args DeployArgs `positional-args:"true" required:"true"`
VarFlags
OpsFlags
NoRedact bool `long:"no-redact" description:"Show non-redacted manifest diff"`
Recreate bool `long:"recreate" description:"Recreate all VMs in deployment"`
Fix bool `long:"fix" description:"Recreate unresponsive instances"`
SkipDrain []boshdir.SkipDrain `long:"skip-drain" value-name:"INSTANCE-GROUP" description:"Skip running drain scripts for specific instance groups" optional:"true" optional-value:"*"`
Canaries string `long:"canaries" description:"Override manifest values for canaries"`
MaxInFlight string `long:"max-in-flight" description:"Override manifest values for max_in_flight"`
DryRun bool `long:"dry-run" description:"Renders job templates without altering deployment"`
cmd
}
type DeployArgs struct {
Manifest FileBytesArg `positional-arg-name:"PATH" description:"Path to a manifest file"`
}
type ManifestOpts struct {
cmd
}
type DeleteDeploymentOpts struct {
Force bool `long:"force" description:"Ignore errors"`
cmd
}
// Events
type EventsOpts struct {
BeforeID string `long:"before-id" description:"Show events with ID less than the given ID"`
Before string `long:"before" description:"Show events before the given timestamp (ex: 2016-05-08 17:26:32)"`
After string `long:"after" description:"Show events after the given timestamp (ex: 2016-05-08 17:26:32)"`
Deployment string
Task string `long:"task" description:"Show events with the given task ID"`
Instance string `long:"instance" description:"Show events with given instance"`
User string `long:"event-user" description:"Show events with given user"`
Action string `long:"action" description:"Show events with given action"`
ObjectType string `long:"object-type" description:"Show events with given object type"`
ObjectName string `long:"object-name" description:"Show events with given object name"`
cmd
}
type EventOpts struct {
Args EventArgs `positional-args:"true" required:"true"`
cmd
}
type EventArgs struct {
ID string `positional-arg-name:"ID"`
}
// Stemcells
type StemcellsOpts struct {
cmd
}
type UploadStemcellOpts struct {
Args UploadStemcellArgs `positional-args:"true" required:"true"`
Fix bool `long:"fix" description:"Replaces the stemcell if already exists"`
Name string `long:"name" description:"Name used in existence check (is not used with local stemcell file)"`
Version VersionArg `long:"version" description:"Version used in existence check (is not used with local stemcell file)"`
SHA1 string `long:"sha1" description:"SHA1 of the remote stemcell (is not used with local files)"`
cmd
}
type UploadStemcellArgs struct {
URL URLArg `positional-arg-name:"URL" description:"Path to a local file or URL"`
}
type DeleteStemcellOpts struct {
Args DeleteStemcellArgs `positional-args:"true" required:"true"`
Force bool `long:"force" description:"Ignore errors"`
cmd
}
type DeleteStemcellArgs struct {
Slug boshdir.StemcellSlug `positional-arg-name:"NAME/VERSION"`
}
type RepackStemcellOpts struct {
Args RepackStemcellArgs `positional-args:"true" required:"true"`
Name string `long:"name" description:"Repacked stemcell name"`
CloudProperties string `long:"cloud-properties" description:"Repacked stemcell cloud properties"`
Version string `long:"version" description:"Repacked stemcell version"`
cmd
}
type RepackStemcellArgs struct {
PathToStemcell string `positional-arg-name:"PATH-TO-STEMCELL" description:"Path to stemcell"`
PathToResult FileArg `positional-arg-name:"PATH-TO-RESULT" description:"Path to repacked stemcell"`
}
// Releases
type ReleasesOpts struct {
cmd
}
type UploadReleaseOpts struct {
Args UploadReleaseArgs `positional-args:"true"`
Directory DirOrCWDArg `long:"dir" description:"Release directory path if not current working directory" default:"."`
Rebase bool `long:"rebase" description:"Rebases this release onto the latest version known by the Director"`
Fix bool `long:"fix" description:"Replaces corrupt and missing jobs and packages"`
Name string `long:"name" description:"Name used in existence check (is not used with local release file)"`
Version VersionArg `long:"version" description:"Version used in existence check (is not used with local release file)"`
SHA1 string `long:"sha1" description:"SHA1 of the remote release (is not used with local files)"`
Release boshrel.Release
cmd
}
type UploadReleaseArgs struct {
URL URLArg `positional-arg-name:"URL" description:"Path to a local file or URL"`
}
type DeleteReleaseOpts struct {
Args DeleteReleaseArgs `positional-args:"true" required:"true"`
Force bool `long:"force" description:"Ignore errors"`
cmd
}
type DeleteReleaseArgs struct {
Slug boshdir.ReleaseOrSeriesSlug `positional-arg-name:"NAME[/VERSION]"`
}
type ExportReleaseOpts struct {
Args ExportReleaseArgs `positional-args:"true" required:"true"`
Directory DirOrCWDArg `long:"dir" description:"Destination directory" default:"."`
cmd
}
type ExportReleaseArgs struct {
ReleaseSlug boshdir.ReleaseSlug `positional-arg-name:"NAME/VERSION"`
OSVersionSlug boshdir.OSVersionSlug `positional-arg-name:"OS/VERSION"`
}
type InspectReleaseOpts struct {
Args InspectReleaseArgs `positional-args:"true" required:"true"`
cmd
}
type InspectReleaseArgs struct {
Slug boshdir.ReleaseSlug `positional-arg-name:"NAME/VERSION"`
}
// Errands
type ErrandsOpts struct {
cmd
}
type RunErrandOpts struct {
Args RunErrandArgs `positional-args:"true" required:"true"`
KeepAlive bool `long:"keep-alive" description:"Use existing VM to run an errand and keep it after completion"`
WhenChanged bool `long:"when-changed" description:"Run errand only if errand configuration has changed or if the previous run was unsuccessful"`
DownloadLogs bool `long:"download-logs" description:"Download logs"`
LogsDirectory DirOrCWDArg `long:"logs-dir" description:"Destination directory for logs" default:"."`
cmd
}
type RunErrandArgs struct {
Name string `positional-arg-name:"NAME"`
}
// Disks
type DisksOpts struct {
Orphaned bool `long:"orphaned" short:"o" description:"List orphaned disks"`
cmd
}
type DeleteDiskOpts struct {
Args DeleteDiskArgs `positional-args:"true" required:"true"`
cmd
}
type DeleteDiskArgs struct {
CID string `positional-arg-name:"CID"`
}
type OrphanDiskOpts struct {
Args OrphanDiskArgs `positional-args:"true" required:"true"`
cmd
}
type OrphanDiskArgs struct {
CID string `positional-arg-name:"CID"`
}
// Snapshots
type SnapshotsOpts struct {
Args InstanceSlugArgs `positional-args:"true"`
cmd
}
type TakeSnapshotOpts struct {
Args InstanceSlugArgs `positional-args:"true"`
cmd
}
type DeleteSnapshotOpts struct {
Args DeleteSnapshotArgs `positional-args:"true" required:"true"`
cmd
}
type DeleteSnapshotArgs struct {
CID string `positional-arg-name:"CID"`
}
type DeleteVMOpts struct {
Args DeleteVMArgs `positional-args:"true" required:"true"`
cmd
}
type DeleteVMArgs struct {
CID string `positional-arg-name:"CID"`
}
type DeleteSnapshotsOpts struct {
cmd
}
type InstanceSlugArgs struct {
Slug boshdir.InstanceSlug `positional-arg-name:"INSTANCE-GROUP/INSTANCE-ID"`
}
// Instances
type InstancesOpts struct {
Details bool `long:"details" short:"i" description:"Show details including VM CID, persistent disk CID, etc."`
DNS bool `long:"dns" description:"Show DNS A records"`
Vitals bool `long:"vitals" description:"Show vitals"`
Processes bool `long:"ps" short:"p" description:"Show processes"`
Failing bool `long:"failing" short:"f" description:"Only show failing instances"`
Deployment string
cmd
}
type VMsOpts struct {
DNS bool `long:"dns" description:"Show DNS A records"`
Vitals bool `long:"vitals" description:"Show vitals"`
Deployment string
cmd
}
type CloudCheckOpts struct {
Auto bool `long:"auto" short:"a" description:"Resolve problems automatically"`
Resolutions []string `long:"resolution" description:"Apply resolution of given type"`
Report bool `long:"report" short:"r" description:"Only generate report; don't attempt to resolve problems"`
cmd
}
// Instance management
type UpdateResurrectionOpts struct {
Args UpdateResurrectionArgs `positional-args:"true" required:"true"`
cmd
}
type UpdateResurrectionArgs struct {
Enabled BoolArg `positional-arg-name:"on|off"`
}
type IgnoreOpts struct {
Args InstanceSlugArgs `positional-args:"true" required:"true"`
cmd
}
type UnignoreOpts struct {
Args InstanceSlugArgs `positional-args:"true" required:"true"`
cmd
}
type LogsOpts struct {
Args AllOrInstanceGroupOrInstanceSlugArgs `positional-args:"true"`
Directory DirOrCWDArg `long:"dir" description:"Destination directory" default:"."`
Follow bool `long:"follow" short:"f" description:"Follow logs via SSH"`
Num int `long:"num" description:"Last number of lines"`
Quiet bool `long:"quiet" short:"q" description:"Suppresses printing of headers when multiple files are being examined"`
Jobs []string `long:"job" description:"Limit to only specific jobs"`
Filters []string `long:"only" description:"Filter logs (comma-separated)"`
Agent bool `long:"agent" description:"Include only agent logs"`
GatewayFlags
cmd
}
type StartOpts struct {
Args AllOrInstanceGroupOrInstanceSlugArgs `positional-args:"true"`
Force bool `long:"force" description:"No-op for backwards compatibility"`
Canaries string `long:"canaries" description:"Override manifest values for canaries"`
MaxInFlight string `long:"max-in-flight" description:"Override manifest values for max_in_flight"`
cmd
}
type StopOpts struct {
Args AllOrInstanceGroupOrInstanceSlugArgs `positional-args:"true"`
Soft bool `long:"soft" description:"Stop process only (default)"`
Hard bool `long:"hard" description:"Delete VM (but keep persistent disk)"`
SkipDrain bool `long:"skip-drain" description:"Skip running drain scripts"`
Force bool `long:"force" description:"No-op for backwards compatibility"`
Canaries string `long:"canaries" description:"Override manifest values for canaries"`
MaxInFlight string `long:"max-in-flight" description:"Override manifest values for max_in_flight"`
cmd
}
type RestartOpts struct {
Args AllOrInstanceGroupOrInstanceSlugArgs `positional-args:"true"`
SkipDrain bool `long:"skip-drain" description:"Skip running drain scripts"`
Force bool `long:"force" description:"No-op for backwards compatibility"`
Canaries string `long:"canaries" description:"Override manifest values for canaries"`
MaxInFlight string `long:"max-in-flight" description:"Override manifest values for max_in_flight"`
cmd
}
type RecreateOpts struct {
Args AllOrInstanceGroupOrInstanceSlugArgs `positional-args:"true"`
SkipDrain bool `long:"skip-drain" description:"Skip running drain scripts"`
Force bool `long:"force" description:"No-op for backwards compatibility"`
Fix bool `long:"fix" description:"Fix unresponsive VMs"`
Canaries string `long:"canaries" description:"Override manifest values for canaries"`
MaxInFlight string `long:"max-in-flight" description:"Override manifest values for max_in_flight"`
DryRun bool `long:"dry-run" description:"Renders job templates without altering deployment"`
cmd
}
type AllOrInstanceGroupOrInstanceSlugArgs struct {
Slug boshdir.AllOrInstanceGroupOrInstanceSlug `positional-arg-name:"INSTANCE-GROUP[/INSTANCE-ID]"`
}
// SSH instance
type SSHOpts struct {
Args AllOrInstanceGroupOrInstanceSlugArgs `positional-args:"true"`
Command []string `long:"command" short:"c" description:"Command"`
RawOpts TrimmedSpaceArgs `long:"opts" description:"Options to pass through to SSH"`
Results bool `long:"results" short:"r" description:"Collect results into a table instead of streaming"`
GatewayFlags
cmd
}
type SCPOpts struct {
Args SCPArgs `positional-args:"true" required:"true"`
Recursive bool `long:"recursive" short:"r" description:"Recursively copy entire directories. Note that symbolic links encountered are followed in the tree traversal"`
GatewayFlags
cmd
}
type SCPArgs struct {
Paths []string `positional-arg-name:"PATH"`
}
type GatewayFlags struct {
UUIDGen boshuuid.Generator
Disable bool `long:"gw-disable" description:"Disable usage of gateway connection" env:"BOSH_GW_DISABLE"`
Username string `long:"gw-user" description:"Username for gateway connection" env:"BOSH_GW_USER"`
Host string `long:"gw-host" description:"Host for gateway connection" env:"BOSH_GW_HOST"`
PrivateKeyPath string `long:"gw-private-key" description:"Private key path for gateway connection" env:"BOSH_GW_PRIVATE_KEY"` // todo private file?
SOCKS5Proxy string `long:"gw-socks5" description:"SOCKS5 URL" env:"BOSH_ALL_PROXY"`
}
// Release creation
type InitReleaseOpts struct {
Directory DirOrCWDArg `long:"dir" description:"Release directory path if not current working directory" default:"."`
Git bool `long:"git" description:"Initialize git repository"`
cmd
}
type ResetReleaseOpts struct {
Directory DirOrCWDArg `long:"dir" description:"Release directory path if not current working directory" default:"."`
cmd
}
type GenerateJobOpts struct {
Args GenerateJobArgs `positional-args:"true" required:"true"`
Directory DirOrCWDArg `long:"dir" description:"Release directory path if not current working directory" default:"."`
cmd
}
type GenerateJobArgs struct {
Name string `positional-arg-name:"NAME"`
}
type GeneratePackageOpts struct {
Args GeneratePackageArgs `positional-args:"true" required:"true"`
Directory DirOrCWDArg `long:"dir" description:"Release directory path if not current working directory" default:"."`
cmd
}
type GeneratePackageArgs struct {
Name string `positional-arg-name:"NAME"`
}
type Sha2ifyReleaseOpts struct {
Args Sha2ifyReleaseArgs `positional-args:"true"`
cmd
}
type Sha2ifyReleaseArgs struct {
Path string `positional-arg-name:"PATH"`
Destination FileArg `positional-arg-name:"DESTINATION"`
}
type CreateReleaseOpts struct {
Args CreateReleaseArgs `positional-args:"true"`
Directory DirOrCWDArg `long:"dir" description:"Release directory path if not current working directory" default:"."`
Name string `long:"name" description:"Custom release name"`
Version VersionArg `long:"version" description:"Custom release version (e.g.: 1.0.0, 1.0-beta.2+dev.10)"`
TimestampVersion bool `long:"timestamp-version" description:"Create release with the timestamp as the dev version (e.g.: 1+dev.TIMESTAMP)"`
Final bool `long:"final" description:"Make it a final release"`
Tarball FileArg `long:"tarball" description:"Create release tarball at path (e.g. /tmp/release.tgz)"`
Force bool `long:"force" description:"Ignore Git dirty state check"`
cmd
}
type CreateReleaseArgs struct {
Manifest FileBytesWithPathArg `positional-arg-name:"PATH"`
}
type FinalizeReleaseOpts struct {
Args FinalizeReleaseArgs `positional-args:"true" required:"true"`
Directory DirOrCWDArg `long:"dir" description:"Release directory path if not current working directory" default:"."`
Name string `long:"name" description:"Custom release name"`
Version VersionArg `long:"version" description:"Custom release version (e.g.: 1.0.0, 1.0-beta.2+dev.10)"`
Force bool `long:"force" description:"Ignore Git dirty state check"`
cmd
}
type FinalizeReleaseArgs struct {
Path string `positional-arg-name:"PATH"`
}
// Blobs
type BlobsOpts struct {
Directory DirOrCWDArg `long:"dir" description:"Release directory path if not current working directory" default:"."`
cmd
}
type AddBlobOpts struct {
Args AddBlobArgs `positional-args:"true" required:"true"`
Directory DirOrCWDArg `long:"dir" description:"Release directory path if not current working directory" default:"."`
cmd
}
type AddBlobArgs struct {
Path string `positional-arg-name:"PATH"`
BlobsPath string `positional-arg-name:"BLOBS-PATH"`
}
type RemoveBlobOpts struct {
Args RemoveBlobArgs `positional-args:"true" required:"true"`
Directory DirOrCWDArg `long:"dir" description:"Release directory path if not current working directory" default:"."`
cmd
}
type RemoveBlobArgs struct {
BlobsPath string `positional-arg-name:"BLOBS-PATH"`
}
type SyncBlobsOpts struct {
Directory DirOrCWDArg `long:"dir" description:"Release directory path if not current working directory" default:"."`
ParallelOpt int `long:"parallel" description:"Sets the max number of parallel downloads" default:"5"`
cmd
}
type UploadBlobsOpts struct {
Directory DirOrCWDArg `long:"dir" description:"Release directory path if not current working directory" default:"."`
cmd
}
// MessageOpts is used for version and help flags
type MessageOpts struct {
Message string
}
type VariablesOpts struct {
Deployment string
cmd
}
type cmd struct{}
// Execute is necessary for each command to be goflags.Commander
func (c cmd) Execute(_ []string) error {
panic("Unreachable")
}