MCPcopy
hub / github.com/minio/minio-go / amzRestoreToStruct

Function amzRestoreToStruct

utils.go:68–84  ·  view source on GitHub ↗
(restore string)

Source from the content-addressed store, hash-verified

66var restoreRegex = regexp.MustCompile(`ongoing-request="(.*?)"(, expiry-date="(.*?)")?`)
67
68func 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.
87func xmlDecoder(body io.Reader, v interface{}) error {

Callers 1

ToObjectInfoFunction · 0.85

Calls 1

parseRFC7231TimeFunction · 0.85

Tested by

no test coverage detected