(location string, credsJSON []byte)
| 73 | } |
| 74 | |
| 75 | func extractCreds(location string, credsJSON []byte) (*Credentials, error) { |
| 76 | var creds *Credentials |
| 77 | if err := json.Unmarshal(credsJSON, &creds); err != nil { |
| 78 | return nil, fmt.Errorf("unmarshaling credentials: %w", err) |
| 79 | } |
| 80 | |
| 81 | // We do not allow overriding the location |
| 82 | creds.Location = location |
| 83 | |
| 84 | if err := creds.Validate(); err != nil { |
| 85 | return nil, fmt.Errorf("invalid credentials: %w", err) |
| 86 | } |
| 87 | |
| 88 | return creds, nil |
| 89 | } |
| 90 | |
| 91 | type Credentials struct { |
| 92 | // AWS Access Key ID |