-
Notifications
You must be signed in to change notification settings - Fork 44
/
Copy pathcommands.gen.go
3446 lines (3205 loc) · 233 KB
/
commands.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
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
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Code generated. DO NOT EDIT.
package temporalcli
import (
"github.com/mattn/go-isatty"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
"os"
"time"
)
var hasHighlighting = isatty.IsTerminal(os.Stdout.Fd())
type ClientOptions struct {
Address string
Namespace string
ApiKey string
GrpcMeta []string
Tls bool
TlsCertPath string
TlsCertData string
TlsKeyPath string
TlsKeyData string
TlsCaPath string
TlsCaData string
TlsDisableHostVerification bool
TlsServerName string
CodecEndpoint string
CodecAuth string
CodecHeader []string
}
func (v *ClientOptions) buildFlags(cctx *CommandContext, f *pflag.FlagSet) {
f.StringVar(&v.Address, "address", "127.0.0.1:7233", "Temporal Service gRPC endpoint.")
cctx.BindFlagEnvVar(f.Lookup("address"), "TEMPORAL_ADDRESS")
f.StringVarP(&v.Namespace, "namespace", "n", "default", "Temporal Service Namespace.")
cctx.BindFlagEnvVar(f.Lookup("namespace"), "TEMPORAL_NAMESPACE")
f.StringVar(&v.ApiKey, "api-key", "", "API key for request.")
cctx.BindFlagEnvVar(f.Lookup("api-key"), "TEMPORAL_API_KEY")
f.StringArrayVar(&v.GrpcMeta, "grpc-meta", nil, "HTTP headers for requests. Format as a `KEY=VALUE` pair. May be passed multiple times to set multiple headers.")
f.BoolVar(&v.Tls, "tls", false, "Enable base TLS encryption. Does not have additional options like mTLS or client certs.")
cctx.BindFlagEnvVar(f.Lookup("tls"), "TEMPORAL_TLS")
f.StringVar(&v.TlsCertPath, "tls-cert-path", "", "Path to x509 certificate. Can't be used with --tls-cert-data.")
cctx.BindFlagEnvVar(f.Lookup("tls-cert-path"), "TEMPORAL_TLS_CERT")
f.StringVar(&v.TlsCertData, "tls-cert-data", "", "Data for x509 certificate. Can't be used with --tls-cert-path.")
cctx.BindFlagEnvVar(f.Lookup("tls-cert-data"), "TEMPORAL_TLS_CERT_DATA")
f.StringVar(&v.TlsKeyPath, "tls-key-path", "", "Path to x509 private key. Can't be used with --tls-key-data.")
cctx.BindFlagEnvVar(f.Lookup("tls-key-path"), "TEMPORAL_TLS_KEY")
f.StringVar(&v.TlsKeyData, "tls-key-data", "", "Private certificate key data. Can't be used with --tls-key-path.")
cctx.BindFlagEnvVar(f.Lookup("tls-key-data"), "TEMPORAL_TLS_KEY_DATA")
f.StringVar(&v.TlsCaPath, "tls-ca-path", "", "Path to server CA certificate. Can't be used with --tls-ca-data.")
cctx.BindFlagEnvVar(f.Lookup("tls-ca-path"), "TEMPORAL_TLS_CA")
f.StringVar(&v.TlsCaData, "tls-ca-data", "", "Data for server CA certificate. Can't be used with --tls-ca-path.")
cctx.BindFlagEnvVar(f.Lookup("tls-ca-data"), "TEMPORAL_TLS_CA_DATA")
f.BoolVar(&v.TlsDisableHostVerification, "tls-disable-host-verification", false, "Disable TLS host-name verification.")
cctx.BindFlagEnvVar(f.Lookup("tls-disable-host-verification"), "TEMPORAL_TLS_DISABLE_HOST_VERIFICATION")
f.StringVar(&v.TlsServerName, "tls-server-name", "", "Override target TLS server name.")
cctx.BindFlagEnvVar(f.Lookup("tls-server-name"), "TEMPORAL_TLS_SERVER_NAME")
f.StringVar(&v.CodecEndpoint, "codec-endpoint", "", "Remote Codec Server endpoint.")
cctx.BindFlagEnvVar(f.Lookup("codec-endpoint"), "TEMPORAL_CODEC_ENDPOINT")
f.StringVar(&v.CodecAuth, "codec-auth", "", "Authorization header for Codec Server requests.")
cctx.BindFlagEnvVar(f.Lookup("codec-auth"), "TEMPORAL_CODEC_AUTH")
f.StringArrayVar(&v.CodecHeader, "codec-header", nil, "HTTP headers for requests to codec server. Format as a `KEY=VALUE` pair. May be passed multiple times to set multiple headers.")
}
type OverlapPolicyOptions struct {
OverlapPolicy StringEnum
}
func (v *OverlapPolicyOptions) buildFlags(cctx *CommandContext, f *pflag.FlagSet) {
v.OverlapPolicy = NewStringEnum([]string{"Skip", "BufferOne", "BufferAll", "CancelOther", "TerminateOther", "AllowAll"}, "Skip")
f.Var(&v.OverlapPolicy, "overlap-policy", "Policy for handling overlapping Workflow Executions. Accepted values: Skip, BufferOne, BufferAll, CancelOther, TerminateOther, AllowAll.")
}
type ScheduleIdOptions struct {
ScheduleId string
}
func (v *ScheduleIdOptions) buildFlags(cctx *CommandContext, f *pflag.FlagSet) {
f.StringVarP(&v.ScheduleId, "schedule-id", "s", "", "Schedule ID. Required.")
_ = cobra.MarkFlagRequired(f, "schedule-id")
}
type ScheduleConfigurationOptions struct {
Calendar []string
CatchupWindow Duration
Cron []string
EndTime Timestamp
Interval []string
Jitter Duration
Notes string
Paused bool
PauseOnFailure bool
RemainingActions int
StartTime Timestamp
TimeZone string
ScheduleSearchAttribute []string
ScheduleMemo []string
}
func (v *ScheduleConfigurationOptions) buildFlags(cctx *CommandContext, f *pflag.FlagSet) {
f.StringArrayVar(&v.Calendar, "calendar", nil, "Calendar specification in JSON. For example: `{\"dayOfWeek\":\"Fri\",\"hour\":\"17\",\"minute\":\"5\"}`.")
v.CatchupWindow = 0
f.Var(&v.CatchupWindow, "catchup-window", "Maximum catch-up time for when the Service is unavailable.")
f.StringArrayVar(&v.Cron, "cron", nil, "Calendar specification in cron string format. For example: `\"30 12 * * Fri\"`.")
f.Var(&v.EndTime, "end-time", "Schedule end time.")
f.StringArrayVar(&v.Interval, "interval", nil, "Interval duration. For example, 90m, or 60m/15m to include phase offset.")
v.Jitter = 0
f.Var(&v.Jitter, "jitter", "Max difference in time from the specification. Vary the start time randomly within this amount.")
f.StringVar(&v.Notes, "notes", "", "Initial notes field value.")
f.BoolVar(&v.Paused, "paused", false, "Pause the Schedule immediately on creation.")
f.BoolVar(&v.PauseOnFailure, "pause-on-failure", false, "Pause schedule after Workflow failures.")
f.IntVar(&v.RemainingActions, "remaining-actions", 0, "Total allowed actions. Default is zero (unlimited).")
f.Var(&v.StartTime, "start-time", "Schedule start time.")
f.StringVar(&v.TimeZone, "time-zone", "", "Interpret calendar specs with the `TZ` time zone. For a list of time zones, see: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones.")
f.StringArrayVar(&v.ScheduleSearchAttribute, "schedule-search-attribute", nil, "Set schedule Search Attributes using `KEY=\"VALUE` pairs. Keys must be identifiers, and values must be JSON values. For example: 'YourKey={\"your\": \"value\"}'. Can be passed multiple times.")
f.StringArrayVar(&v.ScheduleMemo, "schedule-memo", nil, "Set schedule memo using `KEY=\"VALUE` pairs. Keys must be identifiers, and values must be JSON values. For example: 'YourKey={\"your\": \"value\"}'. Can be passed multiple times.")
}
type WorkflowReferenceOptions struct {
WorkflowId string
RunId string
}
func (v *WorkflowReferenceOptions) buildFlags(cctx *CommandContext, f *pflag.FlagSet) {
f.StringVarP(&v.WorkflowId, "workflow-id", "w", "", "Workflow ID. Required.")
_ = cobra.MarkFlagRequired(f, "workflow-id")
f.StringVarP(&v.RunId, "run-id", "r", "", "Run ID.")
}
type DeploymentReferenceOptions struct {
SeriesName string
BuildId string
}
func (v *DeploymentReferenceOptions) buildFlags(cctx *CommandContext, f *pflag.FlagSet) {
f.StringVar(&v.SeriesName, "series-name", "", "Series Name for a Worker Deployment. Required.")
_ = cobra.MarkFlagRequired(f, "series-name")
f.StringVar(&v.BuildId, "build-id", "", "Build ID for a Worker Deployment. Required.")
_ = cobra.MarkFlagRequired(f, "build-id")
}
type SingleWorkflowOrBatchOptions struct {
WorkflowId string
Query string
RunId string
Reason string
Yes bool
Rps float32
}
func (v *SingleWorkflowOrBatchOptions) buildFlags(cctx *CommandContext, f *pflag.FlagSet) {
f.StringVarP(&v.WorkflowId, "workflow-id", "w", "", "Workflow ID. You must set either --workflow-id or --query.")
f.StringVarP(&v.Query, "query", "q", "", "Content for an SQL-like `QUERY` List Filter. You must set either --workflow-id or --query.")
f.StringVarP(&v.RunId, "run-id", "r", "", "Run ID. Only use with --workflow-id. Cannot use with --query.")
f.StringVar(&v.Reason, "reason", "", "Reason for batch operation. Only use with --query. Defaults to user name.")
f.BoolVarP(&v.Yes, "yes", "y", false, "Don't prompt to confirm signaling. Only allowed when --query is present.")
f.Float32Var(&v.Rps, "rps", 0, "Limit batch's requests per second. Only allowed if query is present.")
}
type SharedWorkflowStartOptions struct {
WorkflowId string
Type string
TaskQueue string
RunTimeout Duration
ExecutionTimeout Duration
TaskTimeout Duration
SearchAttribute []string
Memo []string
}
func (v *SharedWorkflowStartOptions) buildFlags(cctx *CommandContext, f *pflag.FlagSet) {
f.StringVarP(&v.WorkflowId, "workflow-id", "w", "", "Workflow ID. If not supplied, the Service generates a unique ID.")
f.StringVar(&v.Type, "type", "", "Workflow Type name. Required. Aliased as \"--name\".")
_ = cobra.MarkFlagRequired(f, "type")
f.StringVarP(&v.TaskQueue, "task-queue", "t", "", "Workflow Task queue. Required.")
_ = cobra.MarkFlagRequired(f, "task-queue")
v.RunTimeout = 0
f.Var(&v.RunTimeout, "run-timeout", "Fail a Workflow Run if it lasts longer than `DURATION`.")
v.ExecutionTimeout = 0
f.Var(&v.ExecutionTimeout, "execution-timeout", "Fail a WorkflowExecution if it lasts longer than `DURATION`. This time-out includes retries and ContinueAsNew tasks.")
v.TaskTimeout = Duration(10000 * time.Millisecond)
f.Var(&v.TaskTimeout, "task-timeout", "Fail a Workflow Task if it lasts longer than `DURATION`. This is the Start-to-close timeout for a Workflow Task.")
f.StringArrayVar(&v.SearchAttribute, "search-attribute", nil, "Search Attribute in `KEY=VALUE` format. Keys must be identifiers, and values must be JSON values. For example: 'YourKey={\"your\": \"value\"}'. Can be passed multiple times.")
f.StringArrayVar(&v.Memo, "memo", nil, "Memo using 'KEY=\"VALUE\"' pairs. Use JSON values.")
}
type WorkflowStartOptions struct {
Cron string
FailExisting bool
StartDelay Duration
IdReusePolicy StringEnum
IdConflictPolicy StringEnum
}
func (v *WorkflowStartOptions) buildFlags(cctx *CommandContext, f *pflag.FlagSet) {
f.StringVar(&v.Cron, "cron", "", "Cron schedule for the Workflow. Deprecated. Use Schedules instead.")
f.BoolVar(&v.FailExisting, "fail-existing", false, "Fail if the Workflow already exists.")
v.StartDelay = 0
f.Var(&v.StartDelay, "start-delay", "Delay before starting the Workflow Execution. Can't be used with cron schedules. If the Workflow receives a signal or update prior to this time, the Workflow Execution starts immediately.")
v.IdReusePolicy = NewStringEnum([]string{"AllowDuplicate", "AllowDuplicateFailedOnly", "RejectDuplicate", "TerminateIfRunning"}, "")
f.Var(&v.IdReusePolicy, "id-reuse-policy", "Re-use policy for the Workflow ID in new Workflow Executions. Accepted values: AllowDuplicate, AllowDuplicateFailedOnly, RejectDuplicate, TerminateIfRunning.")
v.IdConflictPolicy = NewStringEnum([]string{"Fail", "UseExisting", "TerminateExisting"}, "")
f.Var(&v.IdConflictPolicy, "id-conflict-policy", "Determines how to resolve a conflict when spawning a new Workflow Execution with a particular Workflow Id used by an existing Open Workflow Execution. Accepted values: Fail, UseExisting, TerminateExisting.")
}
type PayloadInputOptions struct {
Input []string
InputFile []string
InputMeta []string
InputBase64 bool
}
func (v *PayloadInputOptions) buildFlags(cctx *CommandContext, f *pflag.FlagSet) {
f.StringArrayVarP(&v.Input, "input", "i", nil, "Input value. Use JSON content or set --input-meta to override. Can't be combined with --input-file. Can be passed multiple times to pass multiple arguments.")
f.StringArrayVar(&v.InputFile, "input-file", nil, "A path or paths for input file(s). Use JSON content or set --input-meta to override. Can't be combined with --input. Can be passed multiple times to pass multiple arguments.")
f.StringArrayVar(&v.InputMeta, "input-meta", nil, "Input payload metadata as a `KEY=VALUE` pair. When the KEY is \"encoding\", this overrides the default (\"json/plain\"). Can be passed multiple times.")
f.BoolVar(&v.InputBase64, "input-base64", false, "Assume inputs are base64-encoded and attempt to decode them.")
}
type UpdateStartingOptions struct {
Name string
FirstExecutionRunId string
WorkflowId string
UpdateId string
RunId string
}
func (v *UpdateStartingOptions) buildFlags(cctx *CommandContext, f *pflag.FlagSet) {
f.StringVar(&v.Name, "name", "", "Handler method name. Required. Aliased as \"--type\".")
_ = cobra.MarkFlagRequired(f, "name")
f.StringVar(&v.FirstExecutionRunId, "first-execution-run-id", "", "Parent Run ID. The update is sent to the last Workflow Execution in the chain started with this Run ID.")
f.StringVarP(&v.WorkflowId, "workflow-id", "w", "", "Workflow ID. Required.")
_ = cobra.MarkFlagRequired(f, "workflow-id")
f.StringVar(&v.UpdateId, "update-id", "", "Update ID. If unset, defaults to a UUID.")
f.StringVarP(&v.RunId, "run-id", "r", "", "Run ID. If unset, looks for an Update against the currently-running Workflow Execution.")
}
type UpdateTargetingOptions struct {
WorkflowId string
UpdateId string
RunId string
}
func (v *UpdateTargetingOptions) buildFlags(cctx *CommandContext, f *pflag.FlagSet) {
f.StringVarP(&v.WorkflowId, "workflow-id", "w", "", "Workflow ID. Required.")
_ = cobra.MarkFlagRequired(f, "workflow-id")
f.StringVar(&v.UpdateId, "update-id", "", "Update ID. Must be unique per Workflow Execution. Required.")
_ = cobra.MarkFlagRequired(f, "update-id")
f.StringVarP(&v.RunId, "run-id", "r", "", "Run ID. If unset, updates the currently-running Workflow Execution.")
}
type NexusEndpointIdentityOptions struct {
Name string
}
func (v *NexusEndpointIdentityOptions) buildFlags(cctx *CommandContext, f *pflag.FlagSet) {
f.StringVar(&v.Name, "name", "", "Endpoint name. Required.")
_ = cobra.MarkFlagRequired(f, "name")
}
type NexusEndpointConfigOptions struct {
Description string
DescriptionFile string
TargetNamespace string
TargetTaskQueue string
TargetUrl string
}
func (v *NexusEndpointConfigOptions) buildFlags(cctx *CommandContext, f *pflag.FlagSet) {
f.StringVar(&v.Description, "description", "", "Nexus Endpoint description. You may use Markdown formatting in the Nexus Endpoint description.")
f.StringVar(&v.DescriptionFile, "description-file", "", "Path to the Nexus Endpoint description file. The contents of the description file may use Markdown formatting.")
f.StringVar(&v.TargetNamespace, "target-namespace", "", "Namespace where a handler Worker polls for Nexus tasks.")
f.StringVar(&v.TargetTaskQueue, "target-task-queue", "", "Task Queue that a handler Worker polls for Nexus tasks.")
f.StringVar(&v.TargetUrl, "target-url", "", "An external Nexus Endpoint that receives forwarded Nexus requests. May be used as an alternative to `--target-namespace` and `--target-task-queue`.")
}
type QueryModifiersOptions struct {
RejectCondition StringEnum
}
func (v *QueryModifiersOptions) buildFlags(cctx *CommandContext, f *pflag.FlagSet) {
v.RejectCondition = NewStringEnum([]string{"not_open", "not_completed_cleanly"}, "")
f.Var(&v.RejectCondition, "reject-condition", "Optional flag for rejecting Queries based on Workflow state. Accepted values: not_open, not_completed_cleanly.")
}
type TemporalCommand struct {
Command cobra.Command
Env string
EnvFile string
LogLevel StringEnum
LogFormat StringEnum
Output StringEnum
TimeFormat StringEnum
Color StringEnum
NoJsonShorthandPayloads bool
CommandTimeout Duration
}
func NewTemporalCommand(cctx *CommandContext) *TemporalCommand {
var s TemporalCommand
s.Command.Use = "temporal"
s.Command.Short = "Temporal command-line interface and development server"
if hasHighlighting {
s.Command.Long = "The Temporal CLI manages, monitors, and debugs Temporal apps. It lets you run\na local Temporal Service, start Workflow Executions, pass messages to running\nWorkflows, inspect state, and more.\n\n* Start a local development service:\n \x1b[1mtemporal server start-dev\x1b[0m\n* View help: pass \x1b[1m--help\x1b[0m to any command:\n \x1b[1mtemporal activity complete --help\x1b[0m"
} else {
s.Command.Long = "The Temporal CLI manages, monitors, and debugs Temporal apps. It lets you run\na local Temporal Service, start Workflow Executions, pass messages to running\nWorkflows, inspect state, and more.\n\n* Start a local development service:\n `temporal server start-dev`\n* View help: pass `--help` to any command:\n `temporal activity complete --help`"
}
s.Command.Args = cobra.NoArgs
s.Command.AddCommand(&NewTemporalActivityCommand(cctx, &s).Command)
s.Command.AddCommand(&NewTemporalBatchCommand(cctx, &s).Command)
s.Command.AddCommand(&NewTemporalEnvCommand(cctx, &s).Command)
s.Command.AddCommand(&NewTemporalOperatorCommand(cctx, &s).Command)
s.Command.AddCommand(&NewTemporalScheduleCommand(cctx, &s).Command)
s.Command.AddCommand(&NewTemporalServerCommand(cctx, &s).Command)
s.Command.AddCommand(&NewTemporalTaskQueueCommand(cctx, &s).Command)
s.Command.AddCommand(&NewTemporalWorkerCommand(cctx, &s).Command)
s.Command.AddCommand(&NewTemporalWorkflowCommand(cctx, &s).Command)
s.Command.PersistentFlags().StringVar(&s.Env, "env", "default", "Active environment name (`ENV`).")
cctx.BindFlagEnvVar(s.Command.PersistentFlags().Lookup("env"), "TEMPORAL_ENV")
s.Command.PersistentFlags().StringVar(&s.EnvFile, "env-file", "", "Path to environment settings file. Defaults to `$HOME/.config/temporalio/temporal.yaml`.")
s.LogLevel = NewStringEnum([]string{"debug", "info", "warn", "error", "never"}, "info")
s.Command.PersistentFlags().Var(&s.LogLevel, "log-level", "Log level. Default is \"info\" for most commands and \"warn\" for `server start-dev`. Accepted values: debug, info, warn, error, never.")
s.LogFormat = NewStringEnum([]string{"text", "json", "pretty"}, "text")
s.Command.PersistentFlags().Var(&s.LogFormat, "log-format", "Log format. Accepted values: text, json.")
s.Output = NewStringEnum([]string{"text", "json", "jsonl", "none"}, "text")
s.Command.PersistentFlags().VarP(&s.Output, "output", "o", "Non-logging data output format. Accepted values: text, json, jsonl, none.")
s.TimeFormat = NewStringEnum([]string{"relative", "iso", "raw"}, "relative")
s.Command.PersistentFlags().Var(&s.TimeFormat, "time-format", "Time format. Accepted values: relative, iso, raw.")
s.Color = NewStringEnum([]string{"always", "never", "auto"}, "auto")
s.Command.PersistentFlags().Var(&s.Color, "color", "Output coloring. Accepted values: always, never, auto.")
s.Command.PersistentFlags().BoolVar(&s.NoJsonShorthandPayloads, "no-json-shorthand-payloads", false, "Raw payload output, even if the JSON option was used.")
s.CommandTimeout = 0
s.Command.PersistentFlags().Var(&s.CommandTimeout, "command-timeout", "The command execution timeout. 0s means no timeout.")
s.initCommand(cctx)
return &s
}
type TemporalActivityCommand struct {
Parent *TemporalCommand
Command cobra.Command
ClientOptions
}
func NewTemporalActivityCommand(cctx *CommandContext, parent *TemporalCommand) *TemporalActivityCommand {
var s TemporalActivityCommand
s.Parent = parent
s.Command.Use = "activity"
s.Command.Short = "Complete, update, pause, unpause, reset or fail an Activity"
if hasHighlighting {
s.Command.Long = "Update an Activity's options, manage activity lifecycle or update\nan Activity's state to completed or failed.\n\nUpdating activity state marks an Activity as successfully finished or as\nhaving encountered an error.\n\n\x1b[1mtemporal activity complete \\\n --activity-id=YourActivityId \\\n --workflow-id=YourWorkflowId \\\n --result='{\"YourResultKey\": \"YourResultValue\"}'\x1b[0m"
} else {
s.Command.Long = "Update an Activity's options, manage activity lifecycle or update\nan Activity's state to completed or failed.\n\nUpdating activity state marks an Activity as successfully finished or as\nhaving encountered an error.\n\n```\ntemporal activity complete \\\n --activity-id=YourActivityId \\\n --workflow-id=YourWorkflowId \\\n --result='{\"YourResultKey\": \"YourResultValue\"}'\n```"
}
s.Command.Args = cobra.NoArgs
s.Command.AddCommand(&NewTemporalActivityCompleteCommand(cctx, &s).Command)
s.Command.AddCommand(&NewTemporalActivityFailCommand(cctx, &s).Command)
s.Command.AddCommand(&NewTemporalActivityPauseCommand(cctx, &s).Command)
s.Command.AddCommand(&NewTemporalActivityResetCommand(cctx, &s).Command)
s.Command.AddCommand(&NewTemporalActivityUnpauseCommand(cctx, &s).Command)
s.Command.AddCommand(&NewTemporalActivityUpdateOptionsCommand(cctx, &s).Command)
s.ClientOptions.buildFlags(cctx, s.Command.PersistentFlags())
return &s
}
type TemporalActivityCompleteCommand struct {
Parent *TemporalActivityCommand
Command cobra.Command
WorkflowReferenceOptions
ActivityId string
Result string
Identity string
}
func NewTemporalActivityCompleteCommand(cctx *CommandContext, parent *TemporalActivityCommand) *TemporalActivityCompleteCommand {
var s TemporalActivityCompleteCommand
s.Parent = parent
s.Command.DisableFlagsInUseLine = true
s.Command.Use = "complete [flags]"
s.Command.Short = "Complete an Activity"
if hasHighlighting {
s.Command.Long = "Complete an Activity, marking it as successfully finished. Specify the\nActivity ID and include a JSON result for the returned value:\n\n\x1b[1mtemporal activity complete \\\n --activity-id YourActivityId \\\n --workflow-id YourWorkflowId \\\n --result '{\"YourResultKey\": \"YourResultVal\"}'\x1b[0m"
} else {
s.Command.Long = "Complete an Activity, marking it as successfully finished. Specify the\nActivity ID and include a JSON result for the returned value:\n\n```\ntemporal activity complete \\\n --activity-id YourActivityId \\\n --workflow-id YourWorkflowId \\\n --result '{\"YourResultKey\": \"YourResultVal\"}'\n```"
}
s.Command.Args = cobra.NoArgs
s.Command.Flags().StringVar(&s.ActivityId, "activity-id", "", "Activity ID to complete. Required.")
_ = cobra.MarkFlagRequired(s.Command.Flags(), "activity-id")
s.Command.Flags().StringVar(&s.Result, "result", "", "Result `JSON` to return. Required.")
_ = cobra.MarkFlagRequired(s.Command.Flags(), "result")
s.Command.Flags().StringVar(&s.Identity, "identity", "", "Identity of the user submitting this request.")
s.WorkflowReferenceOptions.buildFlags(cctx, s.Command.Flags())
s.Command.Run = func(c *cobra.Command, args []string) {
if err := s.run(cctx, args); err != nil {
cctx.Options.Fail(err)
}
}
return &s
}
type TemporalActivityFailCommand struct {
Parent *TemporalActivityCommand
Command cobra.Command
WorkflowReferenceOptions
ActivityId string
Detail string
Identity string
Reason string
}
func NewTemporalActivityFailCommand(cctx *CommandContext, parent *TemporalActivityCommand) *TemporalActivityFailCommand {
var s TemporalActivityFailCommand
s.Parent = parent
s.Command.DisableFlagsInUseLine = true
s.Command.Use = "fail [flags]"
s.Command.Short = "Fail an Activity"
if hasHighlighting {
s.Command.Long = "Fail an Activity, marking it as having encountered an error. Specify the\nActivity and Workflow IDs:\n\n\x1b[1mtemporal activity fail \\\n --activity-id YourActivityId \\\n --workflow-id YourWorkflowId\x1b[0m"
} else {
s.Command.Long = "Fail an Activity, marking it as having encountered an error. Specify the\nActivity and Workflow IDs:\n\n```\ntemporal activity fail \\\n --activity-id YourActivityId \\\n --workflow-id YourWorkflowId\n```"
}
s.Command.Args = cobra.NoArgs
s.Command.Flags().StringVar(&s.ActivityId, "activity-id", "", "Activity ID to fail. Required.")
_ = cobra.MarkFlagRequired(s.Command.Flags(), "activity-id")
s.Command.Flags().StringVar(&s.Detail, "detail", "", "Reason for failing the Activity (JSON).")
s.Command.Flags().StringVar(&s.Identity, "identity", "", "Identity of the user submitting this request.")
s.Command.Flags().StringVar(&s.Reason, "reason", "", "Reason for failing the Activity.")
s.WorkflowReferenceOptions.buildFlags(cctx, s.Command.Flags())
s.Command.Run = func(c *cobra.Command, args []string) {
if err := s.run(cctx, args); err != nil {
cctx.Options.Fail(err)
}
}
return &s
}
type TemporalActivityPauseCommand struct {
Parent *TemporalActivityCommand
Command cobra.Command
WorkflowReferenceOptions
ActivityId string
Identity string
}
func NewTemporalActivityPauseCommand(cctx *CommandContext, parent *TemporalActivityCommand) *TemporalActivityPauseCommand {
var s TemporalActivityPauseCommand
s.Parent = parent
s.Command.DisableFlagsInUseLine = true
s.Command.Use = "pause [flags]"
s.Command.Short = "Pause an Activity"
if hasHighlighting {
s.Command.Long = "Pause an Activity.\n\nIf the Activity is not currently running (e.g. because it previously\nfailed), it will not be run again until it is unpaused.\n\nHowever, if the Activity is currently running, it will run to completion.\nIf the Activity is on its last retry attempt and fails, the failure will\nbe returned to the caller, just as if the Activity had not been paused.\n\nSpecify the Activity and Workflow IDs:\n\n\x1b[1mtemporal activity pause \\\n --activity-id YourActivityId \\\n --workflow-id YourWorkflowId\x1b[0m"
} else {
s.Command.Long = "Pause an Activity.\n\nIf the Activity is not currently running (e.g. because it previously\nfailed), it will not be run again until it is unpaused.\n\nHowever, if the Activity is currently running, it will run to completion.\nIf the Activity is on its last retry attempt and fails, the failure will\nbe returned to the caller, just as if the Activity had not been paused.\n\nSpecify the Activity and Workflow IDs:\n\n```\ntemporal activity pause \\\n --activity-id YourActivityId \\\n --workflow-id YourWorkflowId\n```"
}
s.Command.Args = cobra.NoArgs
s.Command.Flags().StringVarP(&s.ActivityId, "activity-id", "a", "", "Activity ID to pause. Required.")
_ = cobra.MarkFlagRequired(s.Command.Flags(), "activity-id")
s.Command.Flags().StringVar(&s.Identity, "identity", "", "Identity of the user submitting this request.")
s.WorkflowReferenceOptions.buildFlags(cctx, s.Command.Flags())
s.Command.Run = func(c *cobra.Command, args []string) {
if err := s.run(cctx, args); err != nil {
cctx.Options.Fail(err)
}
}
return &s
}
type TemporalActivityResetCommand struct {
Parent *TemporalActivityCommand
Command cobra.Command
WorkflowReferenceOptions
ActivityId string
Identity string
NoWait bool
ResetHeartbeats bool
}
func NewTemporalActivityResetCommand(cctx *CommandContext, parent *TemporalActivityCommand) *TemporalActivityResetCommand {
var s TemporalActivityResetCommand
s.Parent = parent
s.Command.DisableFlagsInUseLine = true
s.Command.Use = "reset [flags]"
s.Command.Short = "Reset an Activity"
if hasHighlighting {
s.Command.Long = "Resetting an activity resets both the number of attempts and the activity\ntimeout. If activity is paused, it will be un-paused.\n\nIf the \x1b[1mno-wait\x1b[0m flag is provided, the activity will be rescheduled\nimmediately. Even if the activity is currently running.\nIf the \x1b[1mno-wait\x1b[0m flag is not provided, the activity will be scheduled\nafter the current instance completes, if needed.\nIf the 'reset_heartbeats' flag is set, the activity heartbeat timer and\nheartbeats will be reset.\n\nSpecify the Activity and Workflow IDs:\n\n\x1b[1mtemporal activity reset \\\n --activity-id YourActivityId \\\n --workflow-id YourWorkflowId\n --no-wait\n --reset-heartbeats\x1b[0m"
} else {
s.Command.Long = "Resetting an activity resets both the number of attempts and the activity\ntimeout. If activity is paused, it will be un-paused.\n\nIf the `no-wait` flag is provided, the activity will be rescheduled\nimmediately. Even if the activity is currently running.\nIf the `no-wait` flag is not provided, the activity will be scheduled\nafter the current instance completes, if needed.\nIf the 'reset_heartbeats' flag is set, the activity heartbeat timer and\nheartbeats will be reset.\n\nSpecify the Activity and Workflow IDs:\n\n```\ntemporal activity reset \\\n --activity-id YourActivityId \\\n --workflow-id YourWorkflowId\n --no-wait\n --reset-heartbeats\n```"
}
s.Command.Args = cobra.NoArgs
s.Command.Flags().StringVarP(&s.ActivityId, "activity-id", "a", "", "Activity ID to pause. Required.")
_ = cobra.MarkFlagRequired(s.Command.Flags(), "activity-id")
s.Command.Flags().StringVar(&s.Identity, "identity", "", "Identity of the user submitting this request.")
s.Command.Flags().BoolVar(&s.NoWait, "no-wait", false, "Schedule the Activity immediately, even if its retry timeout has not expired or the activity is currently running.")
s.Command.Flags().BoolVar(&s.ResetHeartbeats, "reset-heartbeats", false, "Reset the Activity's heartbeat.")
s.WorkflowReferenceOptions.buildFlags(cctx, s.Command.Flags())
s.Command.Run = func(c *cobra.Command, args []string) {
if err := s.run(cctx, args); err != nil {
cctx.Options.Fail(err)
}
}
return &s
}
type TemporalActivityUnpauseCommand struct {
Parent *TemporalActivityCommand
Command cobra.Command
WorkflowReferenceOptions
ActivityId string
Identity string
Reset bool
NoWait bool
ResetHeartbeats bool
}
func NewTemporalActivityUnpauseCommand(cctx *CommandContext, parent *TemporalActivityCommand) *TemporalActivityUnpauseCommand {
var s TemporalActivityUnpauseCommand
s.Parent = parent
s.Command.DisableFlagsInUseLine = true
s.Command.Use = "unpause [flags]"
s.Command.Short = "Unpause an Activity"
if hasHighlighting {
s.Command.Long = "Re-schedule a previously-paused Activity for execution.\n\nIf the Activity is not running and is past its retry timeout, it will be\nscheduled immediately. Otherwise, it will be scheduled after its retry\ntimeout expires. The Activity can be retried immediately with \x1b[1m--no-wait\x1b[0m.\n\nUse \x1b[1m--reset\x1b[0m to reset the number of previous run attempts to zero. For\nexample, if an Activity is near the maximum number of attempts N specified\nin its retry policy, \x1b[1m--reset\x1b[0m will allow the Activity to be retried\nanother N times after unpausing.\n\nSpecify the Activity and Workflow IDs:\n\n\x1b[1mtemporal activity unpause \\\n --activity-id YourActivityId \\\n --workflow-id YourWorkflowId\n --reset\n --no-wait\n --reset-heartbeats\x1b[0m"
} else {
s.Command.Long = "Re-schedule a previously-paused Activity for execution.\n\nIf the Activity is not running and is past its retry timeout, it will be\nscheduled immediately. Otherwise, it will be scheduled after its retry\ntimeout expires. The Activity can be retried immediately with `--no-wait`.\n\nUse `--reset` to reset the number of previous run attempts to zero. For\nexample, if an Activity is near the maximum number of attempts N specified\nin its retry policy, `--reset` will allow the Activity to be retried\nanother N times after unpausing.\n\nSpecify the Activity and Workflow IDs:\n\n```\ntemporal activity unpause \\\n --activity-id YourActivityId \\\n --workflow-id YourWorkflowId\n --reset\n --no-wait\n --reset-heartbeats\n```"
}
s.Command.Args = cobra.NoArgs
s.Command.Flags().StringVarP(&s.ActivityId, "activity-id", "a", "", "Activity ID to pause. Required.")
_ = cobra.MarkFlagRequired(s.Command.Flags(), "activity-id")
s.Command.Flags().StringVar(&s.Identity, "identity", "", "Identity of the user submitting this request.")
s.Command.Flags().BoolVar(&s.Reset, "reset", false, "Also reset the activity.")
s.Command.Flags().BoolVar(&s.NoWait, "no-wait", false, "Schedule the Activity immediately, even if its retry timeout has not expired.")
s.Command.Flags().BoolVar(&s.ResetHeartbeats, "reset-heartbeats", false, "Reset the Activity's heartbeat timeout. Only works with --reset.")
s.WorkflowReferenceOptions.buildFlags(cctx, s.Command.Flags())
s.Command.Run = func(c *cobra.Command, args []string) {
if err := s.run(cctx, args); err != nil {
cctx.Options.Fail(err)
}
}
return &s
}
type TemporalActivityUpdateOptionsCommand struct {
Parent *TemporalActivityCommand
Command cobra.Command
WorkflowReferenceOptions
ActivityId string
TaskQueue string
ScheduleToCloseTimeout Duration
ScheduleToStartTimeout Duration
StartToCloseTimeout Duration
HeartbeatTimeout Duration
RetryInitialInterval Duration
RetryMaximumInterval Duration
RetryBackoffCoefficient float32
RetryMaximumAttempts int
Identity string
}
func NewTemporalActivityUpdateOptionsCommand(cctx *CommandContext, parent *TemporalActivityCommand) *TemporalActivityUpdateOptionsCommand {
var s TemporalActivityUpdateOptionsCommand
s.Parent = parent
s.Command.DisableFlagsInUseLine = true
s.Command.Use = "update-options [flags]"
s.Command.Short = "Update Activity options"
if hasHighlighting {
s.Command.Long = "Update Activity options. Specify the Activity and Workflow IDs, and\noptions you want to update.\nUpdates are incremental, only changing the specified options.\n\n\x1b[1mtemporal activity update-options \\\n --activity-id YourActivityId \\\n --workflow-id YourWorkflowId \\\n --task-queue NewTaskQueueName \\\n --schedule-to-close-timeout DURATION \\\n --schedule-to-start-timeout DURATION \\\n --start-to-close-timeout DURATION \\\n --heartbeat-timeout DURATION \\\n --retry-initial-interval DURATION \\\n --retry-maximum-interval DURATION \\\n --retry-backoff-coefficient NewBackoffCoefficient \\\n --retry-maximum-attempts NewMaximumAttempts\x1b[0m"
} else {
s.Command.Long = "Update Activity options. Specify the Activity and Workflow IDs, and\noptions you want to update.\nUpdates are incremental, only changing the specified options.\n\n```\ntemporal activity update-options \\\n --activity-id YourActivityId \\\n --workflow-id YourWorkflowId \\\n --task-queue NewTaskQueueName \\\n --schedule-to-close-timeout DURATION \\\n --schedule-to-start-timeout DURATION \\\n --start-to-close-timeout DURATION \\\n --heartbeat-timeout DURATION \\\n --retry-initial-interval DURATION \\\n --retry-maximum-interval DURATION \\\n --retry-backoff-coefficient NewBackoffCoefficient \\\n --retry-maximum-attempts NewMaximumAttempts\n\n```"
}
s.Command.Args = cobra.NoArgs
s.Command.Flags().StringVar(&s.ActivityId, "activity-id", "", "Activity ID. Required.")
_ = cobra.MarkFlagRequired(s.Command.Flags(), "activity-id")
s.Command.Flags().StringVar(&s.TaskQueue, "task-queue", "", "Name of the task queue for the Activity.")
s.ScheduleToCloseTimeout = 0
s.Command.Flags().Var(&s.ScheduleToCloseTimeout, "schedule-to-close-timeout", "Indicates how long the caller is willing to wait for an activity completion. Limits how long retries will be attempted.")
s.ScheduleToStartTimeout = 0
s.Command.Flags().Var(&s.ScheduleToStartTimeout, "schedule-to-start-timeout", "Limits time an activity task can stay in a task queue before a worker picks it up. This timeout is always non retryable, as all a retry would achieve is to put it back into the same queue. Defaults to the schedule-to-close timeout or workflow execution timeout if not specified.")
s.StartToCloseTimeout = 0
s.Command.Flags().Var(&s.StartToCloseTimeout, "start-to-close-timeout", "Maximum time an activity is allowed to execute after being picked up by a worker. This timeout is always retryable.")
s.HeartbeatTimeout = 0
s.Command.Flags().Var(&s.HeartbeatTimeout, "heartbeat-timeout", "Maximum permitted time between successful worker heartbeats.")
s.RetryInitialInterval = 0
s.Command.Flags().Var(&s.RetryInitialInterval, "retry-initial-interval", "Interval of the first retry. If retryBackoffCoefficient is 1.0 then it is used for all retries.")
s.RetryMaximumInterval = 0
s.Command.Flags().Var(&s.RetryMaximumInterval, "retry-maximum-interval", "Maximum interval between retries. Exponential backoff leads to interval increase. This value is the cap of the increase.")
s.Command.Flags().Float32Var(&s.RetryBackoffCoefficient, "retry-backoff-coefficient", 0, "Coefficient used to calculate the next retry interval. The next retry interval is previous interval multiplied by the backoff coefficient. Must be 1 or larger.")
s.Command.Flags().IntVar(&s.RetryMaximumAttempts, "retry-maximum-attempts", 0, "Maximum number of attempts. When exceeded the retries stop even if not expired yet. Setting this value to 1 disables retries. Setting this value to 0 means unlimited attempts(up to the timeouts).")
s.Command.Flags().StringVar(&s.Identity, "identity", "", "Identity of the user submitting this request.")
s.WorkflowReferenceOptions.buildFlags(cctx, s.Command.Flags())
s.Command.Run = func(c *cobra.Command, args []string) {
if err := s.run(cctx, args); err != nil {
cctx.Options.Fail(err)
}
}
return &s
}
type TemporalBatchCommand struct {
Parent *TemporalCommand
Command cobra.Command
ClientOptions
}
func NewTemporalBatchCommand(cctx *CommandContext, parent *TemporalCommand) *TemporalBatchCommand {
var s TemporalBatchCommand
s.Parent = parent
s.Command.Use = "batch"
s.Command.Short = "Manage running batch jobs"
if hasHighlighting {
s.Command.Long = "List or terminate running batch jobs.\n\nA batch job executes a command on multiple Workflow Executions at once. Create\nbatch jobs by passing \x1b[1m--query\x1b[0m to commands that support it. For example, to\ncreate a batch job to cancel a set of Workflow Executions:\n\n\x1b[1mtemporal workflow cancel \\\n --query 'ExecutionStatus = \"Running\" AND WorkflowType=\"YourWorkflow\"' \\\n --reason \"Testing\"\x1b[0m\n\nQuery Quick Reference:\n\n\x1b[1m+----------------------------------------------------------------------------+\n| Composition: |\n| - Data types: String literals with single or double quotes, |\n| Numbers (integer and floating point), Booleans |\n| - Comparison: '=', '!=', '>', '>=', '<', '<=' |\n| - Expressions/Operators: 'IN array', 'BETWEEN value AND value', |\n| 'STARTS_WITH string', 'IS NULL', 'IS NOT NULL', 'expr AND expr', |\n| 'expr OR expr', '( expr )' |\n| - Array: '( comma-separated-values )' |\n| |\n| Please note: |\n| - Wrap attributes with backticks if it contains characters not in |\n| [a-zA-Z0-9]. |\n| - STARTS_WITH is only available for Keyword search attributes. |\n+----------------------------------------------------------------------------+\x1b[0m\n\nVisit https://docs.temporal.io/visibility to read more about Search Attributes\nand Query creation."
} else {
s.Command.Long = "List or terminate running batch jobs.\n\nA batch job executes a command on multiple Workflow Executions at once. Create\nbatch jobs by passing `--query` to commands that support it. For example, to\ncreate a batch job to cancel a set of Workflow Executions:\n\n```\ntemporal workflow cancel \\\n --query 'ExecutionStatus = \"Running\" AND WorkflowType=\"YourWorkflow\"' \\\n --reason \"Testing\"\n```\n\nQuery Quick Reference:\n\n```\n+----------------------------------------------------------------------------+\n| Composition: |\n| - Data types: String literals with single or double quotes, |\n| Numbers (integer and floating point), Booleans |\n| - Comparison: '=', '!=', '>', '>=', '<', '<=' |\n| - Expressions/Operators: 'IN array', 'BETWEEN value AND value', |\n| 'STARTS_WITH string', 'IS NULL', 'IS NOT NULL', 'expr AND expr', |\n| 'expr OR expr', '( expr )' |\n| - Array: '( comma-separated-values )' |\n| |\n| Please note: |\n| - Wrap attributes with backticks if it contains characters not in |\n| [a-zA-Z0-9]. |\n| - STARTS_WITH is only available for Keyword search attributes. |\n+----------------------------------------------------------------------------+\n```\n\nVisit https://docs.temporal.io/visibility to read more about Search Attributes\nand Query creation."
}
s.Command.Args = cobra.NoArgs
s.Command.AddCommand(&NewTemporalBatchDescribeCommand(cctx, &s).Command)
s.Command.AddCommand(&NewTemporalBatchListCommand(cctx, &s).Command)
s.Command.AddCommand(&NewTemporalBatchTerminateCommand(cctx, &s).Command)
s.ClientOptions.buildFlags(cctx, s.Command.PersistentFlags())
return &s
}
type TemporalBatchDescribeCommand struct {
Parent *TemporalBatchCommand
Command cobra.Command
JobId string
}
func NewTemporalBatchDescribeCommand(cctx *CommandContext, parent *TemporalBatchCommand) *TemporalBatchDescribeCommand {
var s TemporalBatchDescribeCommand
s.Parent = parent
s.Command.DisableFlagsInUseLine = true
s.Command.Use = "describe [flags]"
s.Command.Short = "Show batch job progress"
if hasHighlighting {
s.Command.Long = "Show the progress of an ongoing batch job. Pass a valid job ID to display its\ninformation:\n\n\x1b[1mtemporal batch describe \\\n --job-id YourJobId\x1b[0m"
} else {
s.Command.Long = "Show the progress of an ongoing batch job. Pass a valid job ID to display its\ninformation:\n\n```\ntemporal batch describe \\\n --job-id YourJobId\n```"
}
s.Command.Args = cobra.NoArgs
s.Command.Flags().StringVar(&s.JobId, "job-id", "", "Batch job ID. Required.")
_ = cobra.MarkFlagRequired(s.Command.Flags(), "job-id")
s.Command.Run = func(c *cobra.Command, args []string) {
if err := s.run(cctx, args); err != nil {
cctx.Options.Fail(err)
}
}
return &s
}
type TemporalBatchListCommand struct {
Parent *TemporalBatchCommand
Command cobra.Command
Limit int
}
func NewTemporalBatchListCommand(cctx *CommandContext, parent *TemporalBatchCommand) *TemporalBatchListCommand {
var s TemporalBatchListCommand
s.Parent = parent
s.Command.DisableFlagsInUseLine = true
s.Command.Use = "list [flags]"
s.Command.Short = "List all batch jobs"
if hasHighlighting {
s.Command.Long = "Return a list of batch jobs on the Service or within a single Namespace. For\nexample, list the batch jobs for \"YourNamespace\":\n\n\x1b[1mtemporal batch list \\\n --namespace YourNamespace\x1b[0m"
} else {
s.Command.Long = "Return a list of batch jobs on the Service or within a single Namespace. For\nexample, list the batch jobs for \"YourNamespace\":\n\n```\ntemporal batch list \\\n --namespace YourNamespace\n```"
}
s.Command.Args = cobra.NoArgs
s.Command.Flags().IntVar(&s.Limit, "limit", 0, "Maximum number of batch jobs to display.")
s.Command.Run = func(c *cobra.Command, args []string) {
if err := s.run(cctx, args); err != nil {
cctx.Options.Fail(err)
}
}
return &s
}
type TemporalBatchTerminateCommand struct {
Parent *TemporalBatchCommand
Command cobra.Command
JobId string
Reason string
}
func NewTemporalBatchTerminateCommand(cctx *CommandContext, parent *TemporalBatchCommand) *TemporalBatchTerminateCommand {
var s TemporalBatchTerminateCommand
s.Parent = parent
s.Command.DisableFlagsInUseLine = true
s.Command.Use = "terminate [flags]"
s.Command.Short = "Forcefully end a batch job"
if hasHighlighting {
s.Command.Long = "Terminate a batch job with the provided job ID. You must provide a reason for\nthe termination. The Service stores this explanation as metadata for the\ntermination event for later reference:\n\n\x1b[1mtemporal batch terminate \\\n --job-id YourJobId \\\n --reason YourTerminationReason\x1b[0m"
} else {
s.Command.Long = "Terminate a batch job with the provided job ID. You must provide a reason for\nthe termination. The Service stores this explanation as metadata for the\ntermination event for later reference:\n\n```\ntemporal batch terminate \\\n --job-id YourJobId \\\n --reason YourTerminationReason\n```"
}
s.Command.Args = cobra.NoArgs
s.Command.Flags().StringVar(&s.JobId, "job-id", "", "Job ID to terminate. Required.")
_ = cobra.MarkFlagRequired(s.Command.Flags(), "job-id")
s.Command.Flags().StringVar(&s.Reason, "reason", "", "Reason for terminating the batch job. Required.")
_ = cobra.MarkFlagRequired(s.Command.Flags(), "reason")
s.Command.Run = func(c *cobra.Command, args []string) {
if err := s.run(cctx, args); err != nil {
cctx.Options.Fail(err)
}
}
return &s
}
type TemporalEnvCommand struct {
Parent *TemporalCommand
Command cobra.Command
}
func NewTemporalEnvCommand(cctx *CommandContext, parent *TemporalCommand) *TemporalEnvCommand {
var s TemporalEnvCommand
s.Parent = parent
s.Command.Use = "env"
s.Command.Short = "Manage environments"
if hasHighlighting {
s.Command.Long = "Environments manage key-value presets, auto-configuring Temporal CLI options\nfor you. You can set up distinct environments like \"dev\" and \"prod\" for\nconvenience:\n\n\x1b[1mtemporal env set \\\n --env prod \\\n --key address \\\n --value production.f45a2.tmprl.cloud:7233\x1b[0m\n\nEach environment is isolated. Changes to \"prod\" presets won't affect \"dev\".\n\nFor easiest use, set a \x1b[1mTEMPORAL_ENV\x1b[0m environment variable in your shell. The\nTemporal CLI checks for an \x1b[1m--env\x1b[0m option first, then checks for the\n\x1b[1mTEMPORAL_ENV\x1b[0m environment variable. If neither is set, the CLI uses the\n\"default\" environment."
} else {
s.Command.Long = "Environments manage key-value presets, auto-configuring Temporal CLI options\nfor you. You can set up distinct environments like \"dev\" and \"prod\" for\nconvenience:\n\n```\ntemporal env set \\\n --env prod \\\n --key address \\\n --value production.f45a2.tmprl.cloud:7233\n```\n\nEach environment is isolated. Changes to \"prod\" presets won't affect \"dev\".\n\nFor easiest use, set a `TEMPORAL_ENV` environment variable in your shell. The\nTemporal CLI checks for an `--env` option first, then checks for the\n`TEMPORAL_ENV` environment variable. If neither is set, the CLI uses the\n\"default\" environment."
}
s.Command.Args = cobra.NoArgs
s.Command.AddCommand(&NewTemporalEnvDeleteCommand(cctx, &s).Command)
s.Command.AddCommand(&NewTemporalEnvGetCommand(cctx, &s).Command)
s.Command.AddCommand(&NewTemporalEnvListCommand(cctx, &s).Command)
s.Command.AddCommand(&NewTemporalEnvSetCommand(cctx, &s).Command)
return &s
}
type TemporalEnvDeleteCommand struct {
Parent *TemporalEnvCommand
Command cobra.Command
Key string
}
func NewTemporalEnvDeleteCommand(cctx *CommandContext, parent *TemporalEnvCommand) *TemporalEnvDeleteCommand {
var s TemporalEnvDeleteCommand
s.Parent = parent
s.Command.DisableFlagsInUseLine = true
s.Command.Use = "delete [flags]"
s.Command.Short = "Delete an environment or environment property"
if hasHighlighting {
s.Command.Long = "Remove a presets environment entirely _or_ remove a key-value pair within an\nenvironment. If you don't specify an environment (with \x1b[1m--env\x1b[0m or by setting\nthe \x1b[1mTEMPORAL_ENV\x1b[0m variable), this command updates the \"default\" environment:\n\n\x1b[1mtemporal env delete \\\n --env YourEnvironment\x1b[0m\n\nor\n\n\x1b[1mtemporal env delete \\\n --env prod \\\n --key tls-key-path\x1b[0m"
} else {
s.Command.Long = "Remove a presets environment entirely _or_ remove a key-value pair within an\nenvironment. If you don't specify an environment (with `--env` or by setting\nthe `TEMPORAL_ENV` variable), this command updates the \"default\" environment:\n\n```\ntemporal env delete \\\n --env YourEnvironment\n```\n\nor\n\n```\ntemporal env delete \\\n --env prod \\\n --key tls-key-path\n```"
}
s.Command.Args = cobra.MaximumNArgs(1)
s.Command.Flags().StringVarP(&s.Key, "key", "k", "", "Property name.")
s.Command.Run = func(c *cobra.Command, args []string) {
if err := s.run(cctx, args); err != nil {
cctx.Options.Fail(err)
}
}
return &s
}
type TemporalEnvGetCommand struct {
Parent *TemporalEnvCommand
Command cobra.Command
Key string
}
func NewTemporalEnvGetCommand(cctx *CommandContext, parent *TemporalEnvCommand) *TemporalEnvGetCommand {
var s TemporalEnvGetCommand
s.Parent = parent
s.Command.DisableFlagsInUseLine = true
s.Command.Use = "get [flags]"
s.Command.Short = "Show environment properties"
if hasHighlighting {
s.Command.Long = "List the properties for a given environment:\n\n\x1b[1mtemporal env get \\\n --env YourEnvironment\x1b[0m\n\nPrint a single property:\n\n\x1b[1mtemporal env get \\\n --env YourEnvironment \\\n --key YourPropertyKey\x1b[0m\n\nIf you don't specify an environment (with \x1b[1m--env\x1b[0m or by setting the\n\x1b[1mTEMPORAL_ENV\x1b[0m variable), this command lists properties of the \"default\"\nenvironment."
} else {
s.Command.Long = "List the properties for a given environment:\n\n```\ntemporal env get \\\n --env YourEnvironment\n```\n\nPrint a single property:\n\n```\ntemporal env get \\\n --env YourEnvironment \\\n --key YourPropertyKey\n```\n\nIf you don't specify an environment (with `--env` or by setting the\n`TEMPORAL_ENV` variable), this command lists properties of the \"default\"\nenvironment."
}
s.Command.Args = cobra.MaximumNArgs(1)
s.Command.Flags().StringVarP(&s.Key, "key", "k", "", "Property name.")
s.Command.Run = func(c *cobra.Command, args []string) {
if err := s.run(cctx, args); err != nil {
cctx.Options.Fail(err)
}
}
return &s
}
type TemporalEnvListCommand struct {
Parent *TemporalEnvCommand
Command cobra.Command
}
func NewTemporalEnvListCommand(cctx *CommandContext, parent *TemporalEnvCommand) *TemporalEnvListCommand {
var s TemporalEnvListCommand
s.Parent = parent
s.Command.DisableFlagsInUseLine = true
s.Command.Use = "list [flags]"
s.Command.Short = "Show environment names"
s.Command.Long = "List the environments you have set up on your local computer. Environments are\nstored in \"$HOME/.config/temporalio/temporal.yaml\"."
s.Command.Args = cobra.NoArgs
s.Command.Annotations = make(map[string]string)
s.Command.Annotations["ignoresMissingEnv"] = "true"
s.Command.Run = func(c *cobra.Command, args []string) {
if err := s.run(cctx, args); err != nil {
cctx.Options.Fail(err)
}
}
return &s
}
type TemporalEnvSetCommand struct {
Parent *TemporalEnvCommand
Command cobra.Command
Key string
Value string
}
func NewTemporalEnvSetCommand(cctx *CommandContext, parent *TemporalEnvCommand) *TemporalEnvSetCommand {
var s TemporalEnvSetCommand
s.Parent = parent
s.Command.DisableFlagsInUseLine = true
s.Command.Use = "set [flags]"
s.Command.Short = "Set environment properties"
if hasHighlighting {
s.Command.Long = "Assign a value to a property key and store it to an environment:\n\n\x1b[1mtemporal env set \\\n --env environment \\\n --key property \\\n --value value\x1b[0m\n\nIf you don't specify an environment (with \x1b[1m--env\x1b[0m or by setting the\n\x1b[1mTEMPORAL_ENV\x1b[0m variable), this command sets properties in the \"default\"\nenvironment.\n\nStoring keys with CLI option names lets the CLI automatically set those\noptions for you. This reduces effort and helps avoid typos when issuing\ncommands."
} else {
s.Command.Long = "Assign a value to a property key and store it to an environment:\n\n```\ntemporal env set \\\n --env environment \\\n --key property \\\n --value value\n```\n\nIf you don't specify an environment (with `--env` or by setting the\n`TEMPORAL_ENV` variable), this command sets properties in the \"default\"\nenvironment.\n\nStoring keys with CLI option names lets the CLI automatically set those\noptions for you. This reduces effort and helps avoid typos when issuing\ncommands."
}
s.Command.Args = cobra.MaximumNArgs(2)
s.Command.Annotations = make(map[string]string)
s.Command.Annotations["ignoresMissingEnv"] = "true"
s.Command.Flags().StringVarP(&s.Key, "key", "k", "", "Property name (required).")
s.Command.Flags().StringVarP(&s.Value, "value", "v", "", "Property value (required).")
s.Command.Run = func(c *cobra.Command, args []string) {
if err := s.run(cctx, args); err != nil {
cctx.Options.Fail(err)
}
}
return &s
}
type TemporalOperatorCommand struct {
Parent *TemporalCommand
Command cobra.Command
ClientOptions
}
func NewTemporalOperatorCommand(cctx *CommandContext, parent *TemporalCommand) *TemporalOperatorCommand {
var s TemporalOperatorCommand
s.Parent = parent
s.Command.Use = "operator"
s.Command.Short = "Manage Temporal deployments"
if hasHighlighting {
s.Command.Long = "Operator commands manage and fetch information about Namespaces, Search\nAttributes, Nexus Endpoints, and Temporal Services:\n\n\x1b[1mtemporal operator [command] [subcommand] [options]\x1b[0m\n\nFor example, to show information about the Temporal Service at the default\naddress (localhost):\n\n\x1b[1mtemporal operator cluster describe\x1b[0m"
} else {
s.Command.Long = "Operator commands manage and fetch information about Namespaces, Search\nAttributes, Nexus Endpoints, and Temporal Services:\n\n```\ntemporal operator [command] [subcommand] [options]\n```\n\nFor example, to show information about the Temporal Service at the default\naddress (localhost):\n\n```\ntemporal operator cluster describe\n```"
}
s.Command.Args = cobra.NoArgs
s.Command.AddCommand(&NewTemporalOperatorClusterCommand(cctx, &s).Command)
s.Command.AddCommand(&NewTemporalOperatorNamespaceCommand(cctx, &s).Command)
s.Command.AddCommand(&NewTemporalOperatorNexusCommand(cctx, &s).Command)
s.Command.AddCommand(&NewTemporalOperatorSearchAttributeCommand(cctx, &s).Command)
s.ClientOptions.buildFlags(cctx, s.Command.PersistentFlags())
return &s
}
type TemporalOperatorClusterCommand struct {
Parent *TemporalOperatorCommand
Command cobra.Command
}
func NewTemporalOperatorClusterCommand(cctx *CommandContext, parent *TemporalOperatorCommand) *TemporalOperatorClusterCommand {
var s TemporalOperatorClusterCommand
s.Parent = parent
s.Command.Use = "cluster"
s.Command.Short = "Manage a Temporal Cluster"
if hasHighlighting {
s.Command.Long = "Perform operator actions on Temporal Services (also known as Clusters).\n\n\x1b[1mtemporal operator cluster [subcommand] [options]\x1b[0m\n\nFor example to check Service/Cluster health:\n\n\x1b[1mtemporal operator cluster health\x1b[0m"
} else {
s.Command.Long = "Perform operator actions on Temporal Services (also known as Clusters).\n\n```\ntemporal operator cluster [subcommand] [options]\n```\n\nFor example to check Service/Cluster health:\n\n```\ntemporal operator cluster health\n```"
}
s.Command.Args = cobra.NoArgs
s.Command.AddCommand(&NewTemporalOperatorClusterDescribeCommand(cctx, &s).Command)
s.Command.AddCommand(&NewTemporalOperatorClusterHealthCommand(cctx, &s).Command)
s.Command.AddCommand(&NewTemporalOperatorClusterListCommand(cctx, &s).Command)
s.Command.AddCommand(&NewTemporalOperatorClusterRemoveCommand(cctx, &s).Command)
s.Command.AddCommand(&NewTemporalOperatorClusterSystemCommand(cctx, &s).Command)
s.Command.AddCommand(&NewTemporalOperatorClusterUpsertCommand(cctx, &s).Command)
return &s
}
type TemporalOperatorClusterDescribeCommand struct {
Parent *TemporalOperatorClusterCommand
Command cobra.Command
Detail bool
}
func NewTemporalOperatorClusterDescribeCommand(cctx *CommandContext, parent *TemporalOperatorClusterCommand) *TemporalOperatorClusterDescribeCommand {
var s TemporalOperatorClusterDescribeCommand
s.Parent = parent
s.Command.DisableFlagsInUseLine = true
s.Command.Use = "describe [flags]"
s.Command.Short = "Show Temporal Cluster information"
if hasHighlighting {
s.Command.Long = "View information about a Temporal Cluster (Service), including Cluster Name,\npersistence store, and visibility store. Add \x1b[1m--detail\x1b[0m for additional info:\n\n\x1b[1mtemporal operator cluster describe [--detail]\x1b[0m"
} else {
s.Command.Long = "View information about a Temporal Cluster (Service), including Cluster Name,\npersistence store, and visibility store. Add `--detail` for additional info:\n\n```\ntemporal operator cluster describe [--detail]\n```"
}
s.Command.Args = cobra.NoArgs
s.Command.Flags().BoolVar(&s.Detail, "detail", false, "Show history shard count and Cluster/Service version information.")
s.Command.Run = func(c *cobra.Command, args []string) {
if err := s.run(cctx, args); err != nil {
cctx.Options.Fail(err)
}
}
return &s
}
type TemporalOperatorClusterHealthCommand struct {
Parent *TemporalOperatorClusterCommand
Command cobra.Command
}
func NewTemporalOperatorClusterHealthCommand(cctx *CommandContext, parent *TemporalOperatorClusterCommand) *TemporalOperatorClusterHealthCommand {
var s TemporalOperatorClusterHealthCommand
s.Parent = parent
s.Command.DisableFlagsInUseLine = true
s.Command.Use = "health [flags]"
s.Command.Short = "Check Temporal Service health"
if hasHighlighting {
s.Command.Long = "View information about the health of a Temporal Service:\n\n\x1b[1mtemporal operator cluster health\x1b[0m"
} else {
s.Command.Long = "View information about the health of a Temporal Service:\n\n```\ntemporal operator cluster health\n```"
}
s.Command.Args = cobra.NoArgs
s.Command.Run = func(c *cobra.Command, args []string) {
if err := s.run(cctx, args); err != nil {
cctx.Options.Fail(err)
}
}
return &s
}
type TemporalOperatorClusterListCommand struct {
Parent *TemporalOperatorClusterCommand
Command cobra.Command
Limit int
}
func NewTemporalOperatorClusterListCommand(cctx *CommandContext, parent *TemporalOperatorClusterCommand) *TemporalOperatorClusterListCommand {
var s TemporalOperatorClusterListCommand
s.Parent = parent
s.Command.DisableFlagsInUseLine = true
s.Command.Use = "list [flags]"
s.Command.Short = "Show Temporal Clusters"
if hasHighlighting {
s.Command.Long = "Print a list of remote Temporal Clusters (Services) registered to the local\nService. Report details include the Cluster's name, ID, address, History Shard\ncount, Failover version, and availability:\n\n\x1b[1mtemporal operator cluster list [--limit max-count]\x1b[0m"
} else {
s.Command.Long = "Print a list of remote Temporal Clusters (Services) registered to the local\nService. Report details include the Cluster's name, ID, address, History Shard\ncount, Failover version, and availability:\n\n```\ntemporal operator cluster list [--limit max-count]\n```"
}
s.Command.Args = cobra.NoArgs
s.Command.Flags().IntVar(&s.Limit, "limit", 0, "Maximum number of Clusters to display.")
s.Command.Run = func(c *cobra.Command, args []string) {
if err := s.run(cctx, args); err != nil {
cctx.Options.Fail(err)
}
}
return &s
}
type TemporalOperatorClusterRemoveCommand struct {
Parent *TemporalOperatorClusterCommand
Command cobra.Command
Name string
}
func NewTemporalOperatorClusterRemoveCommand(cctx *CommandContext, parent *TemporalOperatorClusterCommand) *TemporalOperatorClusterRemoveCommand {
var s TemporalOperatorClusterRemoveCommand
s.Parent = parent
s.Command.DisableFlagsInUseLine = true
s.Command.Use = "remove [flags]"
s.Command.Short = "Remove a Temporal Cluster"
if hasHighlighting {
s.Command.Long = "Remove a registered remote Temporal Cluster (Service) from the local Service.\n\n\x1b[1mtemporal operator cluster remove \\\n --name YourClusterName\x1b[0m"
} else {
s.Command.Long = "Remove a registered remote Temporal Cluster (Service) from the local Service.\n\n```\ntemporal operator cluster remove \\\n --name YourClusterName\n```"
}
s.Command.Args = cobra.NoArgs
s.Command.Flags().StringVar(&s.Name, "name", "", "Cluster/Service name. Required.")
_ = cobra.MarkFlagRequired(s.Command.Flags(), "name")
s.Command.Run = func(c *cobra.Command, args []string) {
if err := s.run(cctx, args); err != nil {
cctx.Options.Fail(err)
}
}
return &s
}