executeTokenStoreUse uses a token from the token store
(ctx context.Context, client *csclient.Client, beaconID string, action Action)
| 170 | |
| 171 | // executeTokenStoreUse uses a token from the token store |
| 172 | func (e *Executor) executeTokenStoreUse(ctx context.Context, client *csclient.Client, beaconID string, action Action) (string, error) { |
| 173 | idVal, ok := action.Parameters["id"] |
| 174 | if !ok { |
| 175 | return "", fmt.Errorf("id parameter required for token_store_use") |
| 176 | } |
| 177 | |
| 178 | var id int |
| 179 | switch v := idVal.(type) { |
| 180 | case float64: |
| 181 | id = int(v) |
| 182 | case int: |
| 183 | id = v |
| 184 | default: |
| 185 | return "", fmt.Errorf("id parameter must be a number") |
| 186 | } |
| 187 | |
| 188 | resp, err := client.TokenStoreUse(ctx, beaconID, id) |
| 189 | if err != nil { |
| 190 | return "", err |
| 191 | } |
| 192 | |
| 193 | return e.waitForOutput(ctx, client, resp.TaskID) |
| 194 | } |
| 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) { |
no test coverage detected