ParseBackend constructs a structured backend description from the storage URL.
(rawURL string, options *BackendOptions)
| 44 | // ParseBackend constructs a structured backend description from the |
| 45 | // storage URL. |
| 46 | func ParseBackend(rawURL string, options *BackendOptions) (*backuppb.StorageBackend, error) { |
| 47 | if len(rawURL) == 0 { |
| 48 | return nil, errors.Annotate(berrors.ErrStorageInvalidConfig, "empty store is not allowed") |
| 49 | } |
| 50 | u, err := ParseRawURL(rawURL) |
| 51 | if err != nil { |
| 52 | return nil, errors.Trace(err) |
| 53 | } |
| 54 | return parseBackend(u, rawURL, options) |
| 55 | } |
| 56 | |
| 57 | func parseBackend(u *url.URL, rawURL string, options *BackendOptions) (*backuppb.StorageBackend, error) { |
| 58 | if rawURL == "" { |