(restore string)
| 66 | var restoreRegex = regexp.MustCompile(`ongoing-request="(.*?)"(, expiry-date="(.*?)")?`) |
| 67 | |
| 68 | func amzRestoreToStruct(restore string) (ongoing bool, expTime time.Time, err error) { |
| 69 | matches := restoreRegex.FindStringSubmatch(restore) |
| 70 | if len(matches) != 4 { |
| 71 | return false, time.Time{}, errors.New("unexpected restore header") |
| 72 | } |
| 73 | ongoing, err = strconv.ParseBool(matches[1]) |
| 74 | if err != nil { |
| 75 | return false, time.Time{}, err |
| 76 | } |
| 77 | if matches[3] != "" { |
| 78 | expTime, err = parseRFC7231Time(matches[3]) |
| 79 | if err != nil { |
| 80 | return false, time.Time{}, err |
| 81 | } |
| 82 | } |
| 83 | return ongoing, expTime, err |
| 84 | } |
| 85 | |
| 86 | // xmlDecoder provide decoded value in xml. |
| 87 | func xmlDecoder(body io.Reader, v interface{}) error { |
no test coverage detected