AdminGetTaskQueueUserData returns the per-type user data for a task queue partition
(c *cli.Context, clientFactory ClientFactory)
| 184 | |
| 185 | // AdminGetTaskQueueUserData returns the per-type user data for a task queue partition |
| 186 | func AdminGetTaskQueueUserData(c *cli.Context, clientFactory ClientFactory) error { |
| 187 | namespace, err := getRequiredOption(c, FlagNamespace) |
| 188 | if err != nil { |
| 189 | return err |
| 190 | } |
| 191 | |
| 192 | tqName, err := getRequiredOption(c, FlagTaskQueue) |
| 193 | if err != nil { |
| 194 | return err |
| 195 | } |
| 196 | |
| 197 | tlTypeInt, err := StringToEnum(c.String(FlagTaskQueueType), enumspb.TaskQueueType_value) |
| 198 | if err != nil { |
| 199 | return fmt.Errorf("invalid task queue type: %w", err) |
| 200 | } |
| 201 | tqType := enumspb.TaskQueueType(tlTypeInt) |
| 202 | if tqType == enumspb.TASK_QUEUE_TYPE_UNSPECIFIED { |
| 203 | tqType = enumspb.TASK_QUEUE_TYPE_WORKFLOW |
| 204 | } |
| 205 | |
| 206 | partitionID := 0 |
| 207 | if c.IsSet(FlagPartitionID) { |
| 208 | partitionID = c.Int(FlagPartitionID) |
| 209 | } |
| 210 | |
| 211 | client := clientFactory.AdminClient(c) |
| 212 | req := &adminservice.GetTaskQueueUserDataRequest{ |
| 213 | Namespace: namespace, |
| 214 | TaskQueue: tqName, |
| 215 | TaskQueueType: tqType, |
| 216 | PartitionId: int32(partitionID), |
| 217 | } |
| 218 | |
| 219 | ctx, cancel := newContext(c) |
| 220 | defer cancel() |
| 221 | response, e := client.GetTaskQueueUserData(ctx, req) |
| 222 | if e != nil { |
| 223 | return fmt.Errorf("unable to get Task Queue User Data: %w", e) |
| 224 | } |
| 225 | prettyPrintJSONObject(c, response) |
| 226 | return nil |
| 227 | } |
| 228 | |
| 229 | // AdminForceUnloadTaskQueuePartition forcefully unloads a task queue partition |
| 230 | func AdminForceUnloadTaskQueuePartition(c *cli.Context, clientFactory ClientFactory) error { |
no test coverage detected