(ctx context.Context, secretName string)
| 41 | } |
| 42 | |
| 43 | func (p *BackendProvider) FromCredentials(ctx context.Context, secretName string) (backend.UploaderDownloader, error) { |
| 44 | creds := &Credentials{} |
| 45 | if err := p.cReader.ReadCredentials(ctx, secretName, creds); err != nil { |
| 46 | return nil, err |
| 47 | } |
| 48 | |
| 49 | if err := creds.Validate(); err != nil { |
| 50 | return nil, fmt.Errorf("invalid credentials retrieved from storage: %w", err) |
| 51 | } |
| 52 | |
| 53 | return NewBackend(creds) |
| 54 | } |
| 55 | |
| 56 | func (p *BackendProvider) ValidateAndExtractCredentials(location string, credsJSON []byte) (any, error) { |
| 57 | creds, err := extractCreds(location, credsJSON) |
nothing calls this directly
no test coverage detected