resolvePolicyInputFiles parses each --policy-input-from-file value and resolves its file reference to a local path (downloading URLs to a temporary file, mirroring how --value is handled).
(raw []string)
| 190 | // resolves its file reference to a local path (downloading URLs to a temporary |
| 191 | // file, mirroring how --value is handled). |
| 192 | func resolvePolicyInputFiles(raw []string) ([]*action.PolicyInputFromFile, error) { |
| 193 | if len(raw) == 0 { |
| 194 | return nil, nil |
| 195 | } |
| 196 | |
| 197 | result := make([]*action.PolicyInputFromFile, 0, len(raw)) |
| 198 | for _, r := range raw { |
| 199 | pif, err := action.ParsePolicyInputFromFile(r) |
| 200 | if err != nil { |
| 201 | return nil, err |
| 202 | } |
| 203 | |
| 204 | path, err := resourceloader.GetPathForResource(pif.File) |
| 205 | if err != nil { |
| 206 | var uerr *resourceloader.UnrecognizedSchemeError |
| 207 | if errors.As(err, &uerr) { |
| 208 | path = pif.File |
| 209 | } else { |
| 210 | return nil, fmt.Errorf("loading policy input file: %w", err) |
| 211 | } |
| 212 | } |
| 213 | pif.File = path |
| 214 | |
| 215 | result = append(result, pif) |
| 216 | } |
| 217 | |
| 218 | return result, nil |
| 219 | } |
| 220 | |
| 221 | // displayMaterialInfo prints the material information in a table format. |
| 222 | func displayMaterialInfo(status *action.AttestationStatusMaterial, policyEvaluations []*action.PolicyEvaluation) error { |