-
Notifications
You must be signed in to change notification settings - Fork 32
/
commands.taskqueue_update_build_ids.go
80 lines (71 loc) · 2.13 KB
/
commands.taskqueue_update_build_ids.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
package temporalcli
import (
"fmt"
"go.temporal.io/sdk/client"
)
func (c *TemporalTaskQueueUpdateBuildIdsCommand) updateBuildIds(cctx *CommandContext, options *client.UpdateWorkerBuildIdCompatibilityOptions) error {
cl, err := c.Parent.ClientOptions.dialClient(cctx)
if err != nil {
return err
}
defer cl.Close()
if err := cl.UpdateWorkerBuildIdCompatibility(cctx, options); err != nil {
return fmt.Errorf("error updating task queue build IDs: %w", err)
}
cctx.Printer.Println("Successfully updated task queue build IDs")
return nil
}
func (c *TemporalTaskQueueUpdateBuildIdsAddNewDefaultCommand) run(cctx *CommandContext, args []string) error {
options := &client.UpdateWorkerBuildIdCompatibilityOptions{
TaskQueue: c.TaskQueue,
Operation: &client.BuildIDOpAddNewIDInNewDefaultSet{
BuildID: c.BuildId,
},
}
err := c.Parent.updateBuildIds(cctx, options)
if err != nil {
return err
}
return nil
}
func (c *TemporalTaskQueueUpdateBuildIdsAddNewCompatibleCommand) run(cctx *CommandContext, args []string) error {
options := &client.UpdateWorkerBuildIdCompatibilityOptions{
TaskQueue: c.TaskQueue,
Operation: &client.BuildIDOpAddNewCompatibleVersion{
BuildID: c.BuildId,
ExistingCompatibleBuildID: c.ExistingCompatibleBuildId,
MakeSetDefault: c.SetAsDefault,
},
}
err := c.Parent.updateBuildIds(cctx, options)
if err != nil {
return err
}
return nil
}
func (c *TemporalTaskQueueUpdateBuildIdsPromoteSetCommand) run(cctx *CommandContext, args []string) error {
options := &client.UpdateWorkerBuildIdCompatibilityOptions{
TaskQueue: c.TaskQueue,
Operation: &client.BuildIDOpPromoteSet{
BuildID: c.BuildId,
},
}
err := c.Parent.updateBuildIds(cctx, options)
if err != nil {
return err
}
return nil
}
func (c *TemporalTaskQueueUpdateBuildIdsPromoteIdInSetCommand) run(cctx *CommandContext, args []string) error {
options := &client.UpdateWorkerBuildIdCompatibilityOptions{
TaskQueue: c.TaskQueue,
Operation: &client.BuildIDOpPromoteIDWithinSet{
BuildID: c.BuildId,
},
}
err := c.Parent.updateBuildIds(cctx, options)
if err != nil {
return err
}
return nil
}