executeTokenStoreRemove removes a specific token from the token store
(ctx context.Context, client *csclient.Client, beaconID string, action Action)
| 195 | |
| 196 | // executeTokenStoreRemove removes a specific token from the token store |
| 197 | func (e *Executor) executeTokenStoreRemove(ctx context.Context, client *csclient.Client, beaconID string, action Action) (string, error) { |
| 198 | idVal, ok := action.Parameters["id"] |
| 199 | if !ok { |
| 200 | return "", fmt.Errorf("id parameter required for token_store_remove") |
| 201 | } |
| 202 | |
| 203 | var id int |
| 204 | switch v := idVal.(type) { |
| 205 | case float64: |
| 206 | id = int(v) |
| 207 | case int: |
| 208 | id = v |
| 209 | default: |
| 210 | return "", fmt.Errorf("id parameter must be a number") |
| 211 | } |
| 212 | |
| 213 | resp, err := client.TokenStoreRemove(ctx, beaconID, id) |
| 214 | if err != nil { |
| 215 | return "", err |
| 216 | } |
| 217 | |
| 218 | return e.fireAndForget(resp.TaskID, fmt.Sprintf("token store remove %d", id)) |
| 219 | } |
| 220 | |
| 221 | // executeTokenStoreRemoveAll removes all tokens from the token store |
| 222 | func (e *Executor) executeTokenStoreRemoveAll(ctx context.Context, client *csclient.Client, beaconID string) (string, error) { |
no test coverage detected