executeTokenStoreStealAndUse steals a token, stores it, and immediately applies it
(ctx context.Context, client *csclient.Client, beaconID string, action Action)
| 145 | |
| 146 | // executeTokenStoreStealAndUse steals a token, stores it, and immediately applies it |
| 147 | func (e *Executor) executeTokenStoreStealAndUse(ctx context.Context, client *csclient.Client, beaconID string, action Action) (string, error) { |
| 148 | pidVal, ok := action.Parameters["pid"] |
| 149 | if !ok { |
| 150 | return "", fmt.Errorf("pid parameter required for token_store_steal_use") |
| 151 | } |
| 152 | |
| 153 | var pid int |
| 154 | switch v := pidVal.(type) { |
| 155 | case float64: |
| 156 | pid = int(v) |
| 157 | case int: |
| 158 | pid = v |
| 159 | default: |
| 160 | return "", fmt.Errorf("pid parameter must be a number") |
| 161 | } |
| 162 | |
| 163 | resp, err := client.TokenStoreStealAndUse(ctx, beaconID, pid) |
| 164 | if err != nil { |
| 165 | return "", err |
| 166 | } |
| 167 | |
| 168 | return e.waitForOutput(ctx, client, resp.TaskID) |
| 169 | } |
| 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) { |
no test coverage detected