(ref string, expected ...string)
| 328 | } |
| 329 | |
| 330 | func ensureScheme(ref string, expected ...string) (string, error) { |
| 331 | scheme, id := RefParts(ref) |
| 332 | for _, ex := range expected { |
| 333 | if scheme == ex { |
| 334 | return id, nil |
| 335 | } |
| 336 | } |
| 337 | |
| 338 | return "", fmt.Errorf("unexpected policy reference scheme: %q", scheme) |
| 339 | } |
| 340 | |
| 341 | func RefParts(ref string) (string, string) { |
| 342 | parts := strings.SplitN(ref, "://", 2) |