93
94
// AdminDescribeTaskQueuePartition displays task queue partition information
95
>
func AdminDescribeTaskQueuePartition(c *cli.Context, clientFactory ClientFactory) error {
task_queue_commands.go
96
>
// extracting the namespace
97
>
namespace, err := getRequiredOption(c, FlagNamespace)
98
>
if err != nil {
99
return err
100
}
101
102
// extracting the task queue name
104
>
if err != nil {
105
return err
106
}
107
108
// extracting the task queue type
110
>
if err != nil {
111
return err
112
}
113
115
>
if err != nil {
116
>
return fmt.Errorf("invalid task queue type: %w", err)
117
>
}
118
>
tqType := enumspb.TaskQueueType(tlTypeInt)
119
>
if tqType == enumspb.TASK_QUEUE_TYPE_UNSPECIFIED {
120
>
return errors.New("invalid task queue type") // nolint
121
>
}
122
123
// extracting the task queue partition id
125
>
if c.IsSet(FlagPartitionID) {
126
>
partitionID = c.Int(FlagPartitionID)
127
>
}
128
129
// extracting the task queue partition sticky name
131
>
if c.IsSet(FlagStickyName) {
132
>
stickyName = c.String(FlagStickyName)
133
>
}
134
135
// extracting the task queue partition buildId's
137
>
if c.IsSet(FlagBuildIDs) {
138
>
buildIDs = c.StringSlice(FlagBuildIDs)
139
>
}
140
141
// extracting the unversioned flag
143
>
if c.IsSet(FlagUnversioned) {
144
>
unversioned = c.Bool(FlagUnversioned)
145
>
}
146
147
// extracting the allActive flag
149
>
if c.IsSet(FlagAllActive) {
150
>
allActive = c.Bool(FlagAllActive)
151
>
}
152
154
>
TaskQueue: tqName,
155
>
TaskQueueType: tqType,
156
>
}
157
>
if stickyName != "" {
158
>
tqPartition.PartitionId = &taskqueuespb.TaskQueuePartition_StickyName{StickyName: stickyName}
159
>
} else {
160
>
tqPartition.PartitionId = &taskqueuespb.TaskQueuePartition_NormalPartitionId{NormalPartitionId: int32(partitionID)}
161
>
}
162
164
>
req := &adminservice.DescribeTaskQueuePartitionRequest{
165
>
Namespace: namespace,
166
>
TaskQueuePartition: tqPartition,
167
>
BuildIds: &taskqueuepb.TaskQueueVersionSelection{
168
>
BuildIds: buildIDs,
169
>
Unversioned: unversioned,
170
>
AllActive: allActive,
171
>
},
172
>
}
173
>
174
>
ctx, cancel := newContext(c)
175
>
defer cancel()
176
>
if response, e := client.DescribeTaskQueuePartition(ctx, req); e != nil {
177
return fmt.Errorf("unable to describe Task Queue Partition: %w", e)
179
>
prettyPrintJSONObject(c, response)
180
>
181
>
}
182
>
return nil
183
}
184