• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

uber / cadence / 01880c2e-e2ba-4ec5-8826-bcc19bd1c271

11 May 2023 07:21PM UTC coverage: 57.263% (-0.07%) from 57.331%
01880c2e-e2ba-4ec5-8826-bcc19bd1c271

push

buildkite

GitHub
Adds tooling (#5283)

369 of 369 new or added lines in 9 files covered. (100.0%)

86922 of 151794 relevant lines covered (57.26%)

2472.24 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

70.6
/tools/cli/admin.go
1
// Copyright (c) 2017-2020 Uber Technologies Inc.
2
// Portions of the Software are attributed to Copyright (c) 2020 Temporal Technologies Inc.
3
//
4
// Permission is hereby granted, free of charge, to any person obtaining a copy
5
// of this software and associated documentation files (the "Software"), to deal
6
// in the Software without restriction, including without limitation the rights
7
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
// copies of the Software, and to permit persons to whom the Software is
9
// furnished to do so, subject to the following conditions:
10
//
11
// The above copyright notice and this permission notice shall be included in
12
// all copies or substantial portions of the Software.
13
//
14
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20
// THE SOFTWARE.
21

22
package cli
23

24
import (
25
        "fmt"
26
        "strings"
27
        "time"
28

29
        "github.com/urfave/cli"
30

31
        "github.com/uber/cadence/common/reconciliation/invariant"
32
        "github.com/uber/cadence/service/worker/scanner/executions"
33
)
34

35
func newAdminWorkflowCommands() []cli.Command {
1✔
36
        return []cli.Command{
1✔
37
                {
1✔
38
                        Name:    "show",
1✔
39
                        Aliases: []string{"show"},
1✔
40
                        Usage:   "show workflow history from database",
1✔
41
                        Flags: append(getDBFlags(),
1✔
42
                                // v2 history events
1✔
43
                                cli.StringFlag{
1✔
44
                                        Name:  FlagTreeID,
1✔
45
                                        Usage: "TreeID",
1✔
46
                                },
1✔
47
                                cli.StringFlag{
1✔
48
                                        Name:  FlagBranchID,
1✔
49
                                        Usage: "BranchID",
1✔
50
                                },
1✔
51
                                cli.Int64Flag{
1✔
52
                                        Name:  FlagMinEventID,
1✔
53
                                        Value: 1,
1✔
54
                                        Usage: "MinEventID",
1✔
55
                                },
1✔
56
                                cli.Int64Flag{
1✔
57
                                        Name:  FlagMaxEventID,
1✔
58
                                        Value: 10000,
1✔
59
                                        Usage: "MaxEventID",
1✔
60
                                },
1✔
61
                                cli.StringFlag{
1✔
62
                                        Name:  FlagOutputFilenameWithAlias,
1✔
63
                                        Usage: "output file",
1✔
64
                                },
1✔
65
                                // support mysql query
1✔
66
                                cli.IntFlag{
1✔
67
                                        Name:  FlagShardIDWithAlias,
1✔
68
                                        Usage: "ShardID",
1✔
69
                                }),
1✔
70
                        Action: func(c *cli.Context) {
1✔
71
                                AdminShowWorkflow(c)
×
72
                        },
×
73
                },
74
                {
75
                        Name:    "describe",
76
                        Aliases: []string{"desc"},
77
                        Usage:   "Describe internal information of workflow execution",
78
                        Flags: []cli.Flag{
79
                                cli.StringFlag{
80
                                        Name:  FlagWorkflowIDWithAlias,
81
                                        Usage: "WorkflowID",
82
                                },
83
                                cli.StringFlag{
84
                                        Name:  FlagRunIDWithAlias,
85
                                        Usage: "RunID",
86
                                },
87
                        },
88
                        Action: func(c *cli.Context) {
2✔
89
                                AdminDescribeWorkflow(c)
2✔
90
                        },
2✔
91
                },
92
                {
93
                        Name:    "refresh-tasks",
94
                        Aliases: []string{"rt"},
95
                        Usage:   "Refreshes all the tasks of a workflow",
96
                        Flags: []cli.Flag{
97
                                cli.StringFlag{
98
                                        Name:  FlagWorkflowIDWithAlias,
99
                                        Usage: "WorkflowID",
100
                                },
101
                                cli.StringFlag{
102
                                        Name:  FlagRunIDWithAlias,
103
                                        Usage: "RunID",
104
                                },
105
                        },
106
                        Action: func(c *cli.Context) {
×
107
                                AdminRefreshWorkflowTasks(c)
×
108
                        },
×
109
                },
110
                {
111
                        Name:    "delete",
112
                        Aliases: []string{"del"},
113
                        Usage:   "Delete current workflow execution and the mutableState record",
114
                        Flags: append(getDBFlags(),
115
                                cli.StringFlag{
116
                                        Name:  FlagWorkflowIDWithAlias,
117
                                        Usage: "WorkflowID",
118
                                },
119
                                cli.StringFlag{
120
                                        Name:  FlagRunIDWithAlias,
121
                                        Usage: "RunID",
122
                                },
123
                                cli.BoolFlag{
124
                                        Name:  FlagSkipErrorModeWithAlias,
125
                                        Usage: "skip errors when deleting history",
126
                                },
127
                                cli.BoolFlag{
128
                                        Name:  FlagRemote,
129
                                        Usage: "Executes deletion on server side",
130
                                }),
131
                        Action: func(c *cli.Context) {
×
132
                                AdminDeleteWorkflow(c)
×
133
                        },
×
134
                },
135
                {
136
                        Name:    "fix_corruption",
137
                        Aliases: []string{"fc"},
138
                        Usage:   "Checks if workflow record is corrupted in database and cleans up",
139
                        Flags: []cli.Flag{
140
                                cli.StringFlag{
141
                                        Name:  FlagWorkflowIDWithAlias,
142
                                        Usage: "WorkflowID",
143
                                },
144
                                cli.StringFlag{
145
                                        Name:  FlagRunIDWithAlias,
146
                                        Usage: "RunID",
147
                                },
148
                                cli.BoolFlag{
149
                                        Name:  FlagSkipErrorModeWithAlias,
150
                                        Usage: "Skip errors and tries to delete as much as possible from the DB",
151
                                },
152
                        },
153
                        Action: func(c *cli.Context) {
×
154
                                AdminMaintainCorruptWorkflow(c)
×
155
                        },
×
156
                },
157
        }
158
}
159

160
func newAdminShardManagementCommands() []cli.Command {
1✔
161
        return []cli.Command{
1✔
162
                {
1✔
163
                        Name:    "describe",
1✔
164
                        Aliases: []string{"d"},
1✔
165
                        Usage:   "Describe shard by Id",
1✔
166
                        Flags: append(
1✔
167
                                getDBFlags(),
1✔
168
                                cli.IntFlag{
1✔
169
                                        Name:  FlagShardID,
1✔
170
                                        Usage: "The Id of the shard to describe",
1✔
171
                                },
1✔
172
                        ),
1✔
173
                        Action: func(c *cli.Context) {
1✔
174
                                AdminDescribeShard(c)
×
175
                        },
×
176
                },
177
                {
178
                        Name:    "list",
179
                        Aliases: []string{"l"},
180
                        Usage:   "List shard distribution",
181
                        Flags: []cli.Flag{
182
                                cli.IntFlag{
183
                                        Name:  FlagPageSize,
184
                                        Value: 100,
185
                                        Usage: "Max number of results to return",
186
                                },
187
                                cli.IntFlag{
188
                                        Name:  FlagPageID,
189
                                        Value: 0,
190
                                        Usage: "Option to show results offset from pagesize * page_id",
191
                                },
192
                                getFormatFlag(),
193
                        },
194
                        Action: func(c *cli.Context) {
×
195
                                AdminDescribeShardDistribution(c)
×
196
                        },
×
197
                },
198
                {
199
                        Name:    "setRangeID",
200
                        Aliases: []string{"srid"},
201
                        Usage:   "Force update shard rangeID",
202
                        Flags: append(
203
                                getDBFlags(),
204
                                cli.IntFlag{
205
                                        Name:  FlagShardIDWithAlias,
206
                                        Usage: "ID of the shard to reset",
207
                                },
208
                                cli.Int64Flag{
209
                                        Name:  FlagRangeIDWithAlias,
210
                                        Usage: "new shard rangeID",
211
                                },
212
                        ),
213
                        Action: func(c *cli.Context) {
×
214
                                AdminSetShardRangeID(c)
×
215
                        },
×
216
                },
217
                {
218
                        Name:    "closeShard",
219
                        Aliases: []string{"clsh"},
220
                        Usage:   "close a shard given a shard id",
221
                        Flags: []cli.Flag{
222
                                cli.IntFlag{
223
                                        Name:  FlagShardID,
224
                                        Usage: "ShardID for the cadence cluster to manage",
225
                                },
226
                        },
227
                        Action: func(c *cli.Context) {
×
228
                                AdminCloseShard(c)
×
229
                        },
×
230
                },
231
                {
232
                        Name:    "removeTask",
233
                        Aliases: []string{"rmtk"},
234
                        Usage:   "remove a task based on shardID, task type, taskID, and task visibility timestamp",
235
                        Flags: []cli.Flag{
236
                                cli.IntFlag{
237
                                        Name:  FlagShardID,
238
                                        Usage: "shardID",
239
                                },
240
                                cli.Int64Flag{
241
                                        Name:  FlagTaskID,
242
                                        Usage: "taskID",
243
                                },
244
                                cli.IntFlag{
245
                                        Name:  FlagTaskType,
246
                                        Usage: "task type: 2 (transfer task), 3 (timer task), 4 (replication task) or 6 (cross-cluster task)",
247
                                },
248
                                cli.Int64Flag{
249
                                        Name:  FlagTaskVisibilityTimestamp,
250
                                        Usage: "task visibility timestamp in nano (required for removing timer task)",
251
                                },
252
                                cli.StringFlag{
253
                                        Name:  FlagCluster,
254
                                        Usage: "target cluster of the task (required for removing cross-cluster task)",
255
                                },
256
                        },
257
                        Action: func(c *cli.Context) {
×
258
                                AdminRemoveTask(c)
×
259
                        },
×
260
                },
261
                {
262
                        Name:  "timers",
263
                        Usage: "get scheduled timers for a given time range",
264
                        Flags: append(getDBFlags(),
265
                                cli.IntFlag{
266
                                        Name:  FlagShardID,
267
                                        Usage: "shardID",
268
                                },
269
                                cli.IntFlag{
270
                                        Name:  FlagPageSize,
271
                                        Usage: "page size used to query db executions table",
272
                                        Value: 500,
273
                                },
274
                                cli.StringFlag{
275
                                        Name:  FlagStartDate,
276
                                        Usage: "start date",
277
                                        Value: time.Now().UTC().Format(time.RFC3339),
278
                                },
279
                                cli.StringFlag{
280
                                        Name:  FlagEndDate,
281
                                        Usage: "end date",
282
                                        Value: time.Now().UTC().Add(24 * time.Hour).Format(time.RFC3339),
283
                                },
284
                                cli.StringFlag{
285
                                        Name:  FlagDomainID,
286
                                        Usage: "filter tasks by DomainID",
287
                                },
288
                                cli.IntSliceFlag{
289
                                        Name: FlagTimerType,
290
                                        Usage: "timer types: 0 - DecisionTimeoutTask, 1 - TaskTypeActivityTimeout, " +
291
                                                "2 - TaskTypeUserTimer, 3 - TaskTypeWorkflowTimeout, 4 - TaskTypeDeleteHistoryEvent, " +
292
                                                "5 - TaskTypeActivityRetryTimer, 6 - TaskTypeWorkflowBackoffTimer",
293
                                        Value: &cli.IntSlice{-1},
294
                                },
295
                                cli.BoolFlag{
296
                                        Name:  FlagPrintJSON,
297
                                        Usage: "print raw json data instead of histogram",
298
                                },
299

300
                                cli.BoolFlag{
301
                                        Name:  FlagSkipErrorMode,
302
                                        Usage: "skip errors",
303
                                },
304
                                cli.StringFlag{
305
                                        Name:  FlagInputFile,
306
                                        Usage: "file to use, will not connect to persistence",
307
                                },
308
                                cli.StringFlag{
309
                                        Name:  FlagDateFormat,
310
                                        Usage: "create buckets using time format. Use Go reference time: Mon Jan 2 15:04:05 MST 2006. If set, --" + FlagBucketSize + " is ignored",
311
                                },
312
                                cli.StringFlag{
313
                                        Name:  FlagBucketSize,
314
                                        Value: "hour",
315
                                        Usage: "group timers by time bucket. Available: day, hour, minute, second",
316
                                },
317
                                cli.IntFlag{
318
                                        Name:  FlagShardMultiplier,
319
                                        Usage: "multiply timer counters for histogram",
320
                                        Value: 16384,
321
                                },
322
                        ),
323
                        Action: func(c *cli.Context) {
×
324
                                AdminTimers(c)
×
325
                        },
×
326
                },
327
        }
328
}
329

330
func newAdminHistoryHostCommands() []cli.Command {
1✔
331
        return []cli.Command{
1✔
332
                {
1✔
333
                        Name:    "describe",
1✔
334
                        Aliases: []string{"desc"},
1✔
335
                        Usage:   "Describe internal information of history host",
1✔
336
                        Flags: []cli.Flag{
1✔
337
                                cli.StringFlag{
1✔
338
                                        Name:  FlagWorkflowIDWithAlias,
1✔
339
                                        Usage: "WorkflowID",
1✔
340
                                },
1✔
341
                                cli.StringFlag{
1✔
342
                                        Name:  FlagHistoryAddressWithAlias,
1✔
343
                                        Usage: "History Host address(IP:PORT)",
1✔
344
                                },
1✔
345
                                cli.IntFlag{
1✔
346
                                        Name:  FlagShardIDWithAlias,
1✔
347
                                        Usage: "ShardID",
1✔
348
                                },
1✔
349
                                cli.BoolFlag{
1✔
350
                                        Name:  FlagPrintFullyDetailWithAlias,
1✔
351
                                        Usage: "Print fully detail",
1✔
352
                                },
1✔
353
                        },
1✔
354
                        Action: func(c *cli.Context) {
1✔
355
                                AdminDescribeHistoryHost(c)
×
356
                        },
×
357
                },
358
                {
359
                        Name:    "getshard",
360
                        Aliases: []string{"gsh"},
361
                        Usage:   "Get shardID for a workflowID",
362
                        Flags: []cli.Flag{
363
                                cli.StringFlag{
364
                                        Name:  FlagWorkflowIDWithAlias,
365
                                        Usage: "WorkflowID",
366
                                },
367
                                cli.IntFlag{
368
                                        Name:  FlagNumberOfShards,
369
                                        Usage: "NumberOfShards for the cadence cluster(see config for numHistoryShards)",
370
                                },
371
                        },
372
                        Action: func(c *cli.Context) {
×
373
                                AdminGetShardID(c)
×
374
                        },
×
375
                },
376
        }
377
}
378

379
func newAdminDomainCommands() []cli.Command {
1✔
380
        return []cli.Command{
1✔
381
                {
1✔
382
                        Name:    "register",
1✔
383
                        Aliases: []string{"re"},
1✔
384
                        Usage:   "Register workflow domain",
1✔
385
                        Flags:   adminRegisterDomainFlags,
1✔
386
                        Action: func(c *cli.Context) {
1✔
387
                                newDomainCLI(c, true).RegisterDomain(c)
×
388
                        },
×
389
                },
390
                {
391
                        Name:    "update",
392
                        Aliases: []string{"up", "u"},
393
                        Usage:   "Update existing workflow domain",
394
                        Flags:   adminUpdateDomainFlags,
395
                        Action: func(c *cli.Context) {
×
396
                                newDomainCLI(c, true).UpdateDomain(c)
×
397
                        },
×
398
                },
399
                {
400
                        Name:    "deprecate",
401
                        Aliases: []string{"dep"},
402
                        Usage:   "Deprecate existing workflow domain",
403
                        Flags:   adminDeprecateDomainFlags,
404
                        Action: func(c *cli.Context) {
×
405
                                newDomainCLI(c, true).DeprecateDomain(c)
×
406
                        },
×
407
                },
408
                {
409
                        Name:    "describe",
410
                        Aliases: []string{"desc"},
411
                        Usage:   "Describe existing workflow domain",
412
                        Flags:   adminDescribeDomainFlags,
413
                        Action: func(c *cli.Context) {
×
414
                                newDomainCLI(c, true).DescribeDomain(c)
×
415
                        },
×
416
                },
417
                {
418
                        Name:    "getdomainidorname",
419
                        Aliases: []string{"getdn"},
420
                        Usage:   "Get domainID or domainName",
421
                        Flags: append(getDBFlags(),
422
                                cli.StringFlag{
423
                                        Name:  FlagDomain,
424
                                        Usage: "DomainName",
425
                                },
426
                                cli.StringFlag{
427
                                        Name:  FlagDomainID,
428
                                        Usage: "Domain ID(uuid)",
429
                                }),
430
                        Action: func(c *cli.Context) {
×
431
                                AdminGetDomainIDOrName(c)
×
432
                        },
×
433
                },
434
                {
435
                        Name:    "list",
436
                        Aliases: []string{"l"},
437
                        Usage:   "List all domains in the cluster",
438
                        Flags: []cli.Flag{
439
                                cli.IntFlag{
440
                                        Name:  FlagPageSizeWithAlias,
441
                                        Value: 10,
442
                                        Usage: "Result page size",
443
                                },
444
                                cli.BoolFlag{
445
                                        Name:  FlagAllWithAlias,
446
                                        Usage: "List all domains, by default only domains in REGISTERED status are listed",
447
                                },
448
                                cli.BoolFlag{
449
                                        Name:  FlagDeprecatedWithAlias,
450
                                        Usage: "List deprecated domains only, by default only domains in REGISTERED status are listed",
451
                                },
452
                                cli.StringFlag{
453
                                        Name:  FlagPrefix,
454
                                        Usage: "List domains that are matching to the given prefix",
455
                                        Value: "",
456
                                },
457
                                cli.BoolFlag{
458
                                        Name:  FlagPrintFullyDetailWithAlias,
459
                                        Usage: "Print full domain detail",
460
                                },
461
                                cli.BoolFlag{
462
                                        Name:  FlagPrintJSONWithAlias,
463
                                        Usage: "Print in raw json format (DEPRECATED: instead use --format json)",
464
                                },
465
                                getFormatFlag(),
466
                        },
467
                        Action: func(c *cli.Context) {
×
468
                                newDomainCLI(c, false).ListDomains(c)
×
469
                        },
×
470
                },
471
        }
472
}
473

474
func newAdminKafkaCommands() []cli.Command {
1✔
475
        return []cli.Command{
1✔
476
                {
1✔
477
                        // TODO: do we still need this command given that kafka replication has been deprecated?
1✔
478
                        Name:    "parse",
1✔
479
                        Aliases: []string{"par"},
1✔
480
                        Usage:   "Parse replication tasks from kafka messages",
1✔
481
                        Flags: []cli.Flag{
1✔
482
                                cli.StringFlag{
1✔
483
                                        Name:  FlagInputFileWithAlias,
1✔
484
                                        Usage: "Input file to use, if not present assumes piping",
1✔
485
                                },
1✔
486
                                cli.StringFlag{
1✔
487
                                        Name:  FlagWorkflowIDWithAlias,
1✔
488
                                        Usage: "WorkflowID, if not provided then no filters by WorkflowID are applied",
1✔
489
                                },
1✔
490
                                cli.StringFlag{
1✔
491
                                        Name:  FlagRunIDWithAlias,
1✔
492
                                        Usage: "RunID, if not provided then no filters by RunID are applied",
1✔
493
                                },
1✔
494
                                cli.StringFlag{
1✔
495
                                        Name:  FlagOutputFilenameWithAlias,
1✔
496
                                        Usage: "Output file to write to, if not provided output is written to stdout",
1✔
497
                                },
1✔
498
                                cli.BoolFlag{
1✔
499
                                        Name:  FlagSkipErrorModeWithAlias,
1✔
500
                                        Usage: "Skip errors in parsing messages",
1✔
501
                                },
1✔
502
                                cli.BoolFlag{
1✔
503
                                        Name:  FlagHeadersModeWithAlias,
1✔
504
                                        Usage: "Output headers of messages in format: DomainID, WorkflowID, RunID, FirstEventID, NextEventID",
1✔
505
                                },
1✔
506
                                cli.IntFlag{
1✔
507
                                        Name:  FlagMessageTypeWithAlias,
1✔
508
                                        Usage: "Kafka message type (0: replicationTasks; 1: visibility)",
1✔
509
                                        Value: 0,
1✔
510
                                },
1✔
511
                        },
1✔
512
                        Action: func(c *cli.Context) {
1✔
513
                                AdminKafkaParse(c)
×
514
                        },
×
515
                },
516
                {
517
                        // TODO: move this command be a subcommand of admin workflow
518
                        Name:    "rereplicate",
519
                        Aliases: []string{"rrp"},
520
                        Usage:   "Rereplicate replication tasks from history tables",
521
                        Flags: []cli.Flag{
522
                                cli.StringFlag{
523
                                        Name:  FlagSourceCluster,
524
                                        Usage: "Name of source cluster to resend the replication task",
525
                                },
526
                                cli.StringFlag{
527
                                        Name:  FlagDomainID,
528
                                        Usage: "DomainID",
529
                                },
530
                                cli.StringFlag{
531
                                        Name:  FlagWorkflowIDWithAlias,
532
                                        Usage: "WorkflowID",
533
                                },
534
                                cli.StringFlag{
535
                                        Name:  FlagRunIDWithAlias,
536
                                        Usage: "RunID",
537
                                },
538
                                cli.Int64Flag{
539
                                        Name:  FlagMaxEventID,
540
                                        Usage: "MaxEventID Optional, default to all events",
541
                                },
542
                                cli.StringFlag{
543
                                        Name:  FlagEndEventVersion,
544
                                        Usage: "Workflow end event version, required if MaxEventID is specified",
545
                                }},
546
                        Action: func(c *cli.Context) {
×
547
                                AdminRereplicate(c)
×
548
                        },
×
549
                },
550
        }
551
}
552

553
func newAdminElasticSearchCommands() []cli.Command {
1✔
554
        return []cli.Command{
1✔
555
                {
1✔
556
                        Name:    "catIndex",
1✔
557
                        Aliases: []string{"cind"},
1✔
558
                        Usage:   "Cat Indices on ElasticSearch",
1✔
559
                        Flags: []cli.Flag{
1✔
560
                                cli.StringFlag{
1✔
561
                                        Name:  FlagURL,
1✔
562
                                        Usage: "URL of ElasticSearch cluster",
1✔
563
                                },
1✔
564
                                getFormatFlag(),
1✔
565
                        },
1✔
566
                        Action: func(c *cli.Context) {
1✔
567
                                AdminCatIndices(c)
×
568
                        },
×
569
                },
570
                {
571
                        Name:    "index",
572
                        Aliases: []string{"ind"},
573
                        Usage:   "Index docs on ElasticSearch",
574
                        Flags: []cli.Flag{
575
                                cli.StringFlag{
576
                                        Name:  FlagURL,
577
                                        Usage: "URL of ElasticSearch cluster",
578
                                },
579
                                cli.StringFlag{
580
                                        Name:  FlagIndex,
581
                                        Usage: "ElasticSearch target index",
582
                                },
583
                                cli.StringFlag{
584
                                        Name:  FlagInputFileWithAlias,
585
                                        Usage: "Input file of indexer.Message in json format, separated by newline",
586
                                },
587
                                cli.IntFlag{
588
                                        Name:  FlagBatchSizeWithAlias,
589
                                        Usage: "Optional batch size of actions for bulk operations",
590
                                        Value: 1000,
591
                                },
592
                        },
593
                        Action: func(c *cli.Context) {
×
594
                                AdminIndex(c)
×
595
                        },
×
596
                },
597
                {
598
                        Name:    "delete",
599
                        Aliases: []string{"del"},
600
                        Usage:   "Delete docs on ElasticSearch",
601
                        Flags: []cli.Flag{
602
                                cli.StringFlag{
603
                                        Name:  FlagURL,
604
                                        Usage: "URL of ElasticSearch cluster",
605
                                },
606
                                cli.StringFlag{
607
                                        Name:  FlagIndex,
608
                                        Usage: "ElasticSearch target index",
609
                                },
610
                                cli.StringFlag{
611
                                        Name: FlagInputFileWithAlias,
612
                                        Usage: "Input file name. Redirect cadence wf list result (with tale format) to a file and use as delete input. " +
613
                                                "First line should be table header like WORKFLOW TYPE | WORKFLOW ID | RUN ID | ...",
614
                                },
615
                                cli.IntFlag{
616
                                        Name:  FlagBatchSizeWithAlias,
617
                                        Usage: "Optional batch size of actions for bulk operations",
618
                                        Value: 1000,
619
                                },
620
                                cli.IntFlag{
621
                                        Name:  FlagRPS,
622
                                        Usage: "Optional batch request rate per second",
623
                                        Value: 30,
624
                                },
625
                        },
626
                        Action: func(c *cli.Context) {
×
627
                                AdminDelete(c)
×
628
                        },
×
629
                },
630
                {
631
                        Name:    "report",
632
                        Aliases: []string{"rep"},
633
                        Usage:   "Generate Report by Aggregation functions on ElasticSearch",
634
                        Flags: []cli.Flag{
635
                                cli.StringFlag{
636
                                        Name:  FlagURL,
637
                                        Usage: "URL of ElasticSearch cluster",
638
                                },
639
                                cli.StringFlag{
640
                                        Name:  FlagIndex,
641
                                        Usage: "ElasticSearch target index",
642
                                },
643
                                cli.StringFlag{
644
                                        Name:  FlagListQuery,
645
                                        Usage: "SQL query of the report",
646
                                },
647
                                cli.StringFlag{
648
                                        Name:  FlagOutputFormat,
649
                                        Usage: "Additional output format (html or csv)",
650
                                },
651
                                cli.StringFlag{
652
                                        Name:  FlagOutputFilename,
653
                                        Usage: "Additional output filename with path",
654
                                },
655
                        },
656
                        Action: func(c *cli.Context) {
×
657
                                GenerateReport(c)
×
658
                        },
×
659
                },
660
        }
661
}
662

663
func newAdminTaskListCommands() []cli.Command {
1✔
664
        return []cli.Command{
1✔
665
                {
1✔
666
                        Name:    "describe",
1✔
667
                        Aliases: []string{"desc"},
1✔
668
                        Usage:   "Describe pollers and status information of tasklist",
1✔
669
                        Flags: []cli.Flag{
1✔
670
                                cli.StringFlag{
1✔
671
                                        Name:  FlagTaskListWithAlias,
1✔
672
                                        Usage: "TaskList description",
1✔
673
                                },
1✔
674
                                cli.StringFlag{
1✔
675
                                        Name:  FlagTaskListTypeWithAlias,
1✔
676
                                        Value: "decision",
1✔
677
                                        Usage: "Optional TaskList type [decision|activity]",
1✔
678
                                },
1✔
679
                        },
1✔
680
                        Action: func(c *cli.Context) {
1✔
681
                                AdminDescribeTaskList(c)
×
682
                        },
×
683
                },
684
                {
685
                        Name:    "list",
686
                        Aliases: []string{"l"},
687
                        Usage:   "List active tasklist under a domain",
688
                        Flags: []cli.Flag{
689
                                cli.StringFlag{
690
                                        Name:  FlagDomainWithAlias,
691
                                        Usage: "Required Domain name",
692
                                },
693
                        },
694
                        Action: func(c *cli.Context) {
×
695
                                AdminListTaskList(c)
×
696
                        },
×
697
                },
698
        }
699
}
700

701
func newAdminClusterCommands() []cli.Command {
1✔
702
        return []cli.Command{
1✔
703
                {
1✔
704
                        Name:    "add-search-attr",
1✔
705
                        Aliases: []string{"asa"},
1✔
706
                        Usage:   "whitelist search attribute",
1✔
707
                        Flags: []cli.Flag{
1✔
708
                                cli.StringFlag{
1✔
709
                                        Name:  FlagSearchAttributesKey,
1✔
710
                                        Usage: "Search Attribute key to be whitelisted",
1✔
711
                                },
1✔
712
                                cli.IntFlag{
1✔
713
                                        Name:  FlagSearchAttributesType,
1✔
714
                                        Value: -1,
1✔
715
                                        Usage: "Search Attribute value type. [0:String, 1:Keyword, 2:Int, 3:Double, 4:Bool, 5:Datetime]",
1✔
716
                                },
1✔
717
                                cli.StringFlag{
1✔
718
                                        Name:  FlagSecurityTokenWithAlias,
1✔
719
                                        Usage: "Optional token for security check",
1✔
720
                                },
1✔
721
                        },
1✔
722
                        Action: func(c *cli.Context) {
2✔
723
                                AdminAddSearchAttribute(c)
1✔
724
                        },
1✔
725
                },
726
                {
727
                        Name:    "describe",
728
                        Aliases: []string{"d"},
729
                        Usage:   "Describe cluster information",
730
                        Action: func(c *cli.Context) {
×
731
                                AdminDescribeCluster(c)
×
732
                        },
×
733
                },
734
                {
735
                        Name:        "failover",
736
                        Aliases:     []string{"fo"},
737
                        Usage:       "Failover domains with domain data IsManagedByCadence=true to target cluster",
738
                        Subcommands: newAdminFailoverCommands(),
739
                },
740
                {
741
                        Name:    "failover_fast",
742
                        Aliases: []string{"fof"},
743
                        Usage:   "Failover domains with domain data IsManagedByCadence=true to target cluster",
744
                        Flags: []cli.Flag{
745
                                cli.StringFlag{
746
                                        Name:  FlagTargetClusterWithAlias,
747
                                        Usage: "Target active cluster name",
748
                                },
749
                        },
750
                        Action: func(c *cli.Context) {
×
751
                                newDomainCLI(c, false).FailoverDomains(c)
×
752
                        },
×
753
                },
754
                {
755
                        Name:        "rebalance",
756
                        Aliases:     []string{"rb"},
757
                        Usage:       "Rebalance the domains active cluster",
758
                        Subcommands: newAdminRebalanceCommands(),
759
                },
760
        }
761
}
762

763
func getDLQFlags() []cli.Flag {
3✔
764
        return []cli.Flag{
3✔
765
                cli.StringFlag{
3✔
766
                        Name:  FlagShards,
3✔
767
                        Usage: "Comma separated shard IDs or inclusive ranges. Example: \"2,5-6,10\".  Alternatively, feed one shard ID per line via STDIN.",
3✔
768
                },
3✔
769
                cli.StringFlag{
3✔
770
                        Name:  FlagDLQTypeWithAlias,
3✔
771
                        Usage: "Type of DLQ to manage. (Options: domain, history)",
3✔
772
                        Value: "history",
3✔
773
                },
3✔
774
                cli.StringFlag{
3✔
775
                        Name:  FlagSourceCluster,
3✔
776
                        Usage: "The cluster where the task is generated",
3✔
777
                },
3✔
778
                cli.IntFlag{
3✔
779
                        Name:  FlagLastMessageIDWithAlias,
3✔
780
                        Usage: "The upper boundary of the read message",
3✔
781
                },
3✔
782
        }
3✔
783
}
3✔
784

785
func newAdminDLQCommands() []cli.Command {
1✔
786
        return []cli.Command{
1✔
787
                {
1✔
788
                        Name:    "count",
1✔
789
                        Aliases: []string{"c"},
1✔
790
                        Usage:   "Count DLQ Messages",
1✔
791
                        Flags: []cli.Flag{
1✔
792
                                getFormatFlag(),
1✔
793
                                cli.StringFlag{
1✔
794
                                        Name:  FlagDLQTypeWithAlias,
1✔
795
                                        Usage: "Type of DLQ to manage. (Options: domain, history)",
1✔
796
                                        Value: "history",
1✔
797
                                },
1✔
798
                                cli.BoolFlag{
1✔
799
                                        Name:  FlagForce,
1✔
800
                                        Usage: "Force fetch latest counts (will put additional stress on DB)",
1✔
801
                                },
1✔
802
                        },
1✔
803
                        Action: func(c *cli.Context) {
1✔
804
                                AdminCountDLQMessages(c)
×
805
                        },
×
806
                },
807
                {
808
                        Name:    "read",
809
                        Aliases: []string{"r"},
810
                        Usage:   "Read DLQ Messages",
811
                        Flags: append(getDLQFlags(),
812
                                cli.IntFlag{
813
                                        Name:  FlagMaxMessageCountWithAlias,
814
                                        Usage: "Max message size to fetch",
815
                                },
816
                                getFormatFlag(),
817
                        ),
818
                        Action: func(c *cli.Context) {
×
819
                                AdminGetDLQMessages(c)
×
820
                        },
×
821
                },
822
                {
823
                        Name:    "purge",
824
                        Aliases: []string{"p"},
825
                        Usage:   "Delete DLQ messages with equal or smaller ids than the provided task id",
826
                        Flags:   getDLQFlags(),
827
                        Action: func(c *cli.Context) {
×
828
                                AdminPurgeDLQMessages(c)
×
829
                        },
×
830
                },
831
                {
832
                        Name:    "merge",
833
                        Aliases: []string{"m"},
834
                        Usage:   "Merge DLQ messages with equal or smaller ids than the provided task id",
835
                        Flags:   getDLQFlags(),
836
                        Action: func(c *cli.Context) {
×
837
                                AdminMergeDLQMessages(c)
×
838
                        },
×
839
                },
840
        }
841
}
842

843
func newAdminQueueCommands() []cli.Command {
1✔
844
        return []cli.Command{
1✔
845
                {
1✔
846
                        Name:  "reset",
1✔
847
                        Usage: "reset processing queue states for transfer or timer queue processor",
1✔
848
                        Flags: getQueueCommandFlags(),
1✔
849
                        Action: func(c *cli.Context) {
1✔
850
                                AdminResetQueue(c)
×
851
                        },
×
852
                },
853
                {
854
                        Name:    "describe",
855
                        Aliases: []string{"desc"},
856
                        Usage:   "describe processing queue states for transfer or timer queue processor",
857
                        Flags:   getQueueCommandFlags(),
858
                        Action: func(c *cli.Context) {
×
859
                                AdminDescribeQueue(c)
×
860
                        },
×
861
                },
862
        }
863
}
864

865
func newDBCommands() []cli.Command {
1✔
866
        var collections cli.StringSlice = invariant.CollectionStrings()
1✔
867

1✔
868
        scanFlag := cli.StringFlag{
1✔
869
                Name:     FlagScanType,
1✔
870
                Usage:    "Scan type to use: " + strings.Join(executions.ScanTypeStrings(), ", "),
1✔
871
                Required: true,
1✔
872
        }
1✔
873

1✔
874
        collectionsFlag := cli.StringSliceFlag{
1✔
875
                Name:  FlagInvariantCollection,
1✔
876
                Usage: "Scan collection type to use: " + strings.Join(collections, ", "),
1✔
877
                Value: &collections,
1✔
878
        }
1✔
879

1✔
880
        return []cli.Command{
1✔
881
                {
1✔
882
                        Name:  "scan",
1✔
883
                        Usage: "scan executions in database and detect corruptions",
1✔
884
                        Flags: append(getDBFlags(),
1✔
885
                                cli.IntFlag{
1✔
886
                                        Name:     FlagNumberOfShards,
1✔
887
                                        Usage:    "NumberOfShards for the cadence cluster (see config for numHistoryShards)",
1✔
888
                                        Required: true,
1✔
889
                                },
1✔
890
                                scanFlag,
1✔
891
                                collectionsFlag,
1✔
892
                                cli.StringFlag{
1✔
893
                                        Name:  FlagInputFileWithAlias,
1✔
894
                                        Usage: "Input file of executions to scan in JSON format {\"DomainID\":\"x\",\"WorkflowID\":\"x\",\"RunID\":\"x\"} separated by a newline",
1✔
895
                                },
1✔
896
                        ),
1✔
897

1✔
898
                        Action: func(c *cli.Context) {
1✔
899
                                AdminDBScan(c)
×
900
                        },
×
901
                },
902
                {
903
                        Name:  "unsupported-workflow",
904
                        Usage: "use this command when upgrade the Cadence server from version less than 0.16.0. This scan database and detect unsupported workflow type.",
905
                        Flags: append(getDBFlags(),
906
                                cli.IntFlag{
907
                                        Name:  FlagRPS,
908
                                        Usage: "NumberOfShards for the cadence cluster (see config for numHistoryShards)",
909
                                        Value: 1000,
910
                                },
911
                                cli.StringFlag{
912
                                        Name:  FlagOutputFilenameWithAlias,
913
                                        Usage: "Output file to write to, if not provided output is written to stdout",
914
                                },
915
                                cli.IntFlag{
916
                                        Name:     FlagLowerShardBound,
917
                                        Usage:    "FlagLowerShardBound for the start shard to scan. (Default: 0)",
918
                                        Value:    0,
919
                                        Required: true,
920
                                },
921
                                cli.IntFlag{
922
                                        Name:     FlagUpperShardBound,
923
                                        Usage:    "FlagLowerShardBound for the end shard to scan. (Default: 16383)",
924
                                        Value:    16383,
925
                                        Required: true,
926
                                },
927
                        ),
928

929
                        Action: func(c *cli.Context) {
×
930
                                AdminDBScanUnsupportedWorkflow(c)
×
931
                        },
×
932
                },
933
                {
934
                        Name:  "clean",
935
                        Usage: "clean up corrupted workflows",
936
                        Flags: append(getDBFlags(),
937
                                scanFlag,
938
                                collectionsFlag,
939
                                cli.StringFlag{
940
                                        Name:  FlagInputFileWithAlias,
941
                                        Usage: "Input file of execution to clean in JSON format. Use `scan` command to generate list of executions.",
942
                                },
943
                        ),
944
                        Action: func(c *cli.Context) {
×
945
                                AdminDBClean(c)
×
946
                        },
×
947
                },
948
                {
949
                        Name:  "decode_thrift",
950
                        Usage: "decode thrift object, print into JSON if the data is matching with any supported struct",
951
                        Flags: []cli.Flag{
952
                                cli.StringFlag{
953
                                        Name:   FlagInputWithAlias,
954
                                        EnvVar: "Input",
955
                                        Usage:  "Input of Thrift encoded data structure.",
956
                                },
957
                                cli.StringFlag{
958
                                        Name:  FlagInputEncodingWithAlias,
959
                                        Usage: "Encoding of the input: [hex|base64] (Default: hex)",
960
                                },
961
                        },
962
                        Action: func(c *cli.Context) {
×
963
                                AdminDBDataDecodeThrift(c)
×
964
                        },
×
965
                },
966
        }
967
}
968

969
func getQueueCommandFlags() []cli.Flag {
2✔
970
        return []cli.Flag{
2✔
971
                cli.IntFlag{
2✔
972
                        Name:  FlagShardIDWithAlias,
2✔
973
                        Usage: "shardID",
2✔
974
                },
2✔
975
                cli.StringFlag{
2✔
976
                        Name:  FlagCluster,
2✔
977
                        Usage: "cluster the task processor is responsible for",
2✔
978
                },
2✔
979
                cli.IntFlag{
2✔
980
                        Name:  FlagQueueType,
2✔
981
                        Usage: "queue type: 2 (transfer queue), 3 (timer queue) or 6 (cross-cluster queue)",
2✔
982
                },
2✔
983
        }
2✔
984
}
2✔
985

986
func newAdminFailoverCommands() []cli.Command {
1✔
987
        return []cli.Command{
1✔
988
                {
1✔
989
                        Name:    "start",
1✔
990
                        Aliases: []string{"s"},
1✔
991
                        Usage:   "start failover workflow",
1✔
992
                        Flags: []cli.Flag{
1✔
993
                                cli.StringFlag{
1✔
994
                                        Name:  FlagTargetClusterWithAlias,
1✔
995
                                        Usage: "Target cluster name",
1✔
996
                                },
1✔
997
                                cli.StringFlag{
1✔
998
                                        Name:  FlagSourceClusterWithAlias,
1✔
999
                                        Usage: "Source cluster name",
1✔
1000
                                },
1✔
1001
                                cli.IntFlag{
1✔
1002
                                        Name:  FlagFailoverTimeoutWithAlias,
1✔
1003
                                        Usage: "Optional graceful failover timeout in seconds. If this field is define, the failover will use graceful failover.",
1✔
1004
                                },
1✔
1005
                                cli.IntFlag{
1✔
1006
                                        Name:  FlagExecutionTimeoutWithAlias,
1✔
1007
                                        Usage: "Optional Failover workflow timeout in seconds",
1✔
1008
                                        Value: defaultFailoverWorkflowTimeoutInSeconds,
1✔
1009
                                },
1✔
1010
                                cli.IntFlag{
1✔
1011
                                        Name:  FlagFailoverWaitTimeWithAlias,
1✔
1012
                                        Usage: "Optional Failover wait time after each batch in seconds",
1✔
1013
                                        Value: defaultBatchFailoverWaitTimeInSeconds,
1✔
1014
                                },
1✔
1015
                                cli.IntFlag{
1✔
1016
                                        Name:  FlagFailoverBatchSizeWithAlias,
1✔
1017
                                        Usage: "Optional number of domains to failover in one batch",
1✔
1018
                                        Value: defaultBatchFailoverSize,
1✔
1019
                                },
1✔
1020
                                cli.StringSliceFlag{
1✔
1021
                                        Name: FlagFailoverDomains,
1✔
1022
                                        Usage: "Optional domains to failover, eg d1,d2..,dn. " +
1✔
1023
                                                "Only provided domains in source cluster will be failover.",
1✔
1024
                                },
1✔
1025
                                cli.IntFlag{
1✔
1026
                                        Name: FlagFailoverDrillWaitTimeWithAlias,
1✔
1027
                                        Usage: "Optional failover drill wait time. " +
1✔
1028
                                                "After the wait time, the domains will be reset to original regions." +
1✔
1029
                                                "This field is required if the cron schedule is specified.",
1✔
1030
                                },
1✔
1031
                                cli.StringFlag{
1✔
1032
                                        Name: FlagCronSchedule,
1✔
1033
                                        Usage: "Optional cron schedule on failover drill. Please specify failover drill wait time " +
1✔
1034
                                                "if this field is specific",
1✔
1035
                                },
1✔
1036
                        },
1✔
1037
                        Action: func(c *cli.Context) {
2✔
1038
                                AdminFailoverStart(c)
1✔
1039
                        },
1✔
1040
                },
1041
                {
1042
                        Name:    "pause",
1043
                        Aliases: []string{"p"},
1044
                        Usage:   "pause failover workflow",
1045
                        Flags: []cli.Flag{
1046
                                cli.StringFlag{
1047
                                        Name:  FlagRunIDWithAlias,
1048
                                        Usage: "Optional Failover workflow runID, default is latest runID",
1049
                                },
1050
                                cli.BoolFlag{
1051
                                        Name: FlagFailoverDrillWithAlias,
1052
                                        Usage: "Optional to pause failover workflow or failover drill workflow." +
1053
                                                " The default is normal failover workflow",
1054
                                },
1055
                        },
1056

1057
                        Action: func(c *cli.Context) {
×
1058
                                AdminFailoverPause(c)
×
1059
                        },
×
1060
                },
1061
                {
1062
                        Name:    "resume",
1063
                        Aliases: []string{"re"},
1064
                        Usage:   "resume paused failover workflow",
1065
                        Flags: []cli.Flag{
1066
                                cli.StringFlag{
1067
                                        Name:  FlagRunIDWithAlias,
1068
                                        Usage: "Optional Failover workflow runID, default is latest runID",
1069
                                },
1070
                                cli.BoolFlag{
1071
                                        Name: FlagFailoverDrillWithAlias,
1072
                                        Usage: "Optional to resume failover workflow or failover drill workflow." +
1073
                                                " The default is normal failover workflow",
1074
                                },
1075
                        },
1076
                        Action: func(c *cli.Context) {
×
1077
                                AdminFailoverResume(c)
×
1078
                        },
×
1079
                },
1080
                {
1081
                        Name:    "query",
1082
                        Aliases: []string{"q"},
1083
                        Usage:   "query failover workflow state",
1084
                        Flags: []cli.Flag{
1085
                                cli.BoolFlag{
1086
                                        Name: FlagFailoverDrillWithAlias,
1087
                                        Usage: "Optional to query failover workflow or failover drill workflow." +
1088
                                                " The default is normal failover workflow",
1089
                                },
1090
                                cli.StringFlag{
1091
                                        Name:  FlagRunIDWithAlias,
1092
                                        Usage: "Optional Failover workflow runID, default is latest runID",
1093
                                },
1094
                        },
1095
                        Action: func(c *cli.Context) {
×
1096
                                AdminFailoverQuery(c)
×
1097
                        },
×
1098
                },
1099
                {
1100
                        Name:    "abort",
1101
                        Aliases: []string{"a"},
1102
                        Usage:   "abort failover workflow",
1103
                        Flags: []cli.Flag{
1104
                                cli.StringFlag{
1105
                                        Name:  FlagRunIDWithAlias,
1106
                                        Usage: "Optional Failover workflow runID, default is latest runID",
1107
                                },
1108
                                cli.StringFlag{
1109
                                        Name:  FlagReasonWithAlias,
1110
                                        Usage: "Optional reason why abort",
1111
                                },
1112
                                cli.BoolFlag{
1113
                                        Name: FlagFailoverDrillWithAlias,
1114
                                        Usage: "Optional to abort failover workflow or failover drill workflow." +
1115
                                                " The default is normal failover workflow",
1116
                                },
1117
                        },
1118
                        Action: func(c *cli.Context) {
×
1119
                                AdminFailoverAbort(c)
×
1120
                        },
×
1121
                },
1122
                {
1123
                        Name:    "rollback",
1124
                        Aliases: []string{"ro"},
1125
                        Usage:   "rollback failover workflow",
1126
                        Flags: []cli.Flag{
1127
                                cli.StringFlag{
1128
                                        Name:  FlagRunIDWithAlias,
1129
                                        Usage: "Optional Failover workflow runID, default is latest runID",
1130
                                },
1131
                                cli.IntFlag{
1132
                                        Name:  FlagFailoverTimeoutWithAlias,
1133
                                        Usage: "Optional graceful failover timeout in seconds. If this field is define, the failover will use graceful failover.",
1134
                                },
1135
                                cli.IntFlag{
1136
                                        Name:  FlagExecutionTimeoutWithAlias,
1137
                                        Usage: "Optional Failover workflow timeout in seconds",
1138
                                        Value: defaultFailoverWorkflowTimeoutInSeconds,
1139
                                },
1140
                                cli.IntFlag{
1141
                                        Name:  FlagFailoverWaitTimeWithAlias,
1142
                                        Usage: "Optional Failover wait time after each batch in seconds",
1143
                                        Value: defaultBatchFailoverWaitTimeInSeconds,
1144
                                },
1145
                                cli.IntFlag{
1146
                                        Name:  FlagFailoverBatchSizeWithAlias,
1147
                                        Usage: "Optional number of domains to failover in one batch",
1148
                                        Value: defaultBatchFailoverSize,
1149
                                },
1150
                        },
1151
                        Action: func(c *cli.Context) {
×
1152
                                AdminFailoverRollback(c)
×
1153
                        },
×
1154
                },
1155
                {
1156
                        Name:    "list",
1157
                        Aliases: []string{"l"},
1158
                        Usage:   "list failover workflow runs closed/open. This is just a simplified list cmd",
1159
                        Flags: []cli.Flag{
1160
                                cli.BoolFlag{
1161
                                        Name:  FlagOpenWithAlias,
1162
                                        Usage: "List for open workflow executions, default is to list for closed ones",
1163
                                },
1164
                                cli.IntFlag{
1165
                                        Name:  FlagPageSizeWithAlias,
1166
                                        Value: 10,
1167
                                        Usage: "Result page size",
1168
                                },
1169
                                cli.StringFlag{
1170
                                        Name:  FlagWorkflowIDWithAlias,
1171
                                        Usage: "Ignore this. It is a dummy flag which will be forced overwrite",
1172
                                },
1173
                                cli.BoolFlag{
1174
                                        Name: FlagFailoverDrillWithAlias,
1175
                                        Usage: "Optional to query failover workflow or failover drill workflow." +
1176
                                                " The default is normal failover workflow",
1177
                                },
1178
                        },
1179
                        Action: func(c *cli.Context) {
×
1180
                                AdminFailoverList(c)
×
1181
                        },
×
1182
                },
1183
        }
1184
}
1185

1186
func newAdminRebalanceCommands() []cli.Command {
1✔
1187
        return []cli.Command{
1✔
1188
                {
1✔
1189
                        Name:    "start",
1✔
1190
                        Aliases: []string{"s"},
1✔
1191
                        Usage:   "start rebalance workflow",
1✔
1192
                        Flags:   []cli.Flag{},
1✔
1193
                        Action: func(c *cli.Context) {
1✔
1194
                                AdminRebalanceStart(c)
×
1195
                        },
×
1196
                },
1197
                {
1198
                        Name:    "list",
1199
                        Aliases: []string{"l"},
1200
                        Usage:   "list rebalance workflow runs closed/open.",
1201
                        Flags: []cli.Flag{
1202
                                cli.BoolFlag{
1203
                                        Name:  FlagOpenWithAlias,
1204
                                        Usage: "List for open workflow executions, default is to list for closed ones",
1205
                                },
1206
                                cli.IntFlag{
1207
                                        Name:  FlagPageSizeWithAlias,
1208
                                        Value: 10,
1209
                                        Usage: "Result page size",
1210
                                },
1211
                        },
1212
                        Action: func(c *cli.Context) {
×
1213
                                AdminRebalanceList(c)
×
1214
                        },
×
1215
                },
1216
        }
1217
}
1218

1219
func newAdminConfigStoreCommands() []cli.Command {
1✔
1220
        return []cli.Command{
1✔
1221
                {
1✔
1222
                        Name:    "get",
1✔
1223
                        Aliases: []string{"g"},
1✔
1224
                        Usage:   "Get Dynamic Config Value",
1✔
1225
                        Flags: []cli.Flag{
1✔
1226
                                cli.StringFlag{
1✔
1227
                                        Name:     FlagDynamicConfigName,
1✔
1228
                                        Usage:    "Name of Dynamic Config parameter to get value of",
1✔
1229
                                        Required: true,
1✔
1230
                                },
1✔
1231
                                cli.StringSliceFlag{
1✔
1232
                                        Name:  FlagDynamicConfigFilter,
1✔
1233
                                        Usage: fmt.Sprintf(`Optional. Can be specified multiple times for multiple filters. ex: --%s '{"Name":"domainName","Value":"global-samples-domain"}'`, FlagDynamicConfigFilter),
1✔
1234
                                },
1✔
1235
                        },
1✔
1236
                        Action: func(c *cli.Context) {
1✔
1237
                                AdminGetDynamicConfig(c)
×
1238
                        },
×
1239
                },
1240
                {
1241
                        Name:    "update",
1242
                        Aliases: []string{"u"},
1243
                        Usage:   "Update Dynamic Config Value",
1244
                        Flags: []cli.Flag{
1245
                                cli.StringFlag{
1246
                                        Name:     FlagDynamicConfigName,
1247
                                        Usage:    "Name of Dynamic Config parameter to update value of",
1248
                                        Required: true,
1249
                                },
1250
                                cli.StringSliceFlag{
1251
                                        Name:     FlagDynamicConfigValue,
1252
                                        Usage:    fmt.Sprintf(`Can be specified multiple times for multiple values. ex: --%s '{"Value":true,"Filters":[]}'`, FlagDynamicConfigValue),
1253
                                        Required: true,
1254
                                },
1255
                        },
1256
                        Action: func(c *cli.Context) {
×
1257
                                AdminUpdateDynamicConfig(c)
×
1258
                        },
×
1259
                },
1260
                {
1261
                        Name:    "restore",
1262
                        Aliases: []string{"r"},
1263
                        Usage:   "Restore Dynamic Config Value",
1264
                        Flags: []cli.Flag{
1265
                                cli.StringFlag{
1266
                                        Name:     FlagDynamicConfigName,
1267
                                        Usage:    "Name of Dynamic Config parameter to restore",
1268
                                        Required: true,
1269
                                },
1270
                                cli.StringSliceFlag{
1271
                                        Name:  FlagDynamicConfigFilter,
1272
                                        Usage: fmt.Sprintf(`Optional. Can be specified multiple times for multiple filters. ex: --%s '{"Name":"domainName","Value":"global-samples-domain"}'`, FlagDynamicConfigFilter),
1273
                                },
1274
                        },
1275
                        Action: func(c *cli.Context) {
×
1276
                                AdminRestoreDynamicConfig(c)
×
1277
                        },
×
1278
                },
1279
                {
1280
                        Name:    "list",
1281
                        Aliases: []string{"l"},
1282
                        Usage:   "List Dynamic Config Value",
1283
                        Flags:   []cli.Flag{},
1284
                        Action: func(c *cli.Context) {
×
1285
                                AdminListDynamicConfig(c)
×
1286
                        },
×
1287
                },
1288
                {
1289
                        Name:    "listall",
1290
                        Aliases: []string{"la"},
1291
                        Usage:   "List all available configuration keys",
1292
                        Flags:   []cli.Flag{getFormatFlag()},
1293
                        Action: func(c *cli.Context) {
×
1294
                                AdminListConfigKeys(c)
×
1295
                        },
×
1296
                },
1297
        }
1298
}
1299

1300
func newAdminIsolationGroupCommands() []cli.Command {
1✔
1301
        return []cli.Command{
1✔
1302
                {
1✔
1303
                        Name:  "get-global",
1✔
1304
                        Usage: "gets the global isolation groups",
1✔
1305
                        Flags: []cli.Flag{},
1✔
1306
                        Action: func(c *cli.Context) {
1✔
1307
                                AdminGetGlobalIsolationGroups(c)
×
1308
                        },
×
1309
                },
1310
                {
1311
                        Name:  "update-global",
1312
                        Usage: "sets the global isolation groups",
1313
                        Flags: []cli.Flag{
1314
                                cli.StringFlag{
1315
                                        Name:     FlagIsolationGroupJSONConfigurations,
1316
                                        Usage:    `the configurations to upsert: eg: [{"Name": "zone-1": "State": 2}]. To remove groups, specify an empty configuration`,
1317
                                        Required: false,
1318
                                },
1319
                                cli.StringSliceFlag{
1320
                                        Name:     FlagIsolationGroupSetDrains,
1321
                                        Usage:    "Use to upsert the configuration for all drains. Note that this is an upsert operation and will overwrite all existing configuration",
1322
                                        Required: false,
1323
                                },
1324
                                cli.BoolFlag{
1325
                                        Name:     FlagIsolationGroupsRemoveAllDrains,
1326
                                        Usage:    "Removes all drains",
1327
                                        Required: false,
1328
                                },
1329
                        },
1330
                        Action: func(c *cli.Context) {
×
1331
                                AdminUpdateGlobalIsolationGroups(c)
×
1332
                        },
×
1333
                },
1334
                {
1335
                        Name:  "get-domain",
1336
                        Usage: "gets the domain isolation groups",
1337
                        Flags: []cli.Flag{
1338
                                cli.StringFlag{
1339
                                        Name:     FlagDomain,
1340
                                        Usage:    `The domain to operate on`,
1341
                                        Required: true,
1342
                                },
1343
                        },
1344
                        Action: func(c *cli.Context) {
×
1345
                                AdminGetDomainIsolationGroups(c)
×
1346
                        },
×
1347
                },
1348
                {
1349
                        Name:  "update-domain",
1350
                        Usage: "sets the domain isolation groups",
1351
                        Flags: []cli.Flag{
1352
                                cli.StringFlag{
1353
                                        Name:     FlagDomain,
1354
                                        Usage:    `The domain to operate on`,
1355
                                        Required: true,
1356
                                },
1357
                                cli.StringFlag{
1358
                                        Name:     FlagIsolationGroupJSONConfigurations,
1359
                                        Usage:    `the configurations to upsert: eg: [{"Name": "zone-1": "State": 2}]. To remove groups, specify an empty configuration`,
1360
                                        Required: false,
1361
                                },
1362
                                cli.StringSliceFlag{
1363
                                        Name:     FlagIsolationGroupSetDrains,
1364
                                        Usage:    "Use to upsert the configuration for all drains. Note that this is an upsert operation and will overwrite all existing configuration",
1365
                                        Required: false,
1366
                                },
1367
                                cli.BoolFlag{
1368
                                        Name:     FlagIsolationGroupsRemoveAllDrains,
1369
                                        Usage:    "Removes all drains",
1370
                                        Required: false,
1371
                                },
1372
                        },
1373
                        Action: func(c *cli.Context) {
×
1374
                                AdminUpdateDomainIsolationGroups(c)
×
1375
                        },
×
1376
                },
1377
        }
1378
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc