2023-03-15 16:00:52 +00:00
|
|
|
// Copyright (c) HashiCorp, Inc.
|
|
|
|
// SPDX-License-Identifier: MPL-2.0
|
|
|
|
|
2021-07-15 05:56:37 +00:00
|
|
|
// DEPRECATED: this has been moved to go-secure-stdlib and will be removed
|
2017-03-07 16:21:22 +00:00
|
|
|
package parseutil
|
2016-07-11 17:46:23 +00:00
|
|
|
|
|
|
|
import (
|
|
|
|
"time"
|
2017-03-07 16:21:22 +00:00
|
|
|
|
2021-07-15 05:56:37 +00:00
|
|
|
extparseutil "github.com/hashicorp/go-secure-stdlib/parseutil"
|
2018-04-17 22:52:09 +00:00
|
|
|
sockaddr "github.com/hashicorp/go-sockaddr"
|
2016-07-11 17:46:23 +00:00
|
|
|
)
|
|
|
|
|
2021-02-22 18:44:55 +00:00
|
|
|
func ParseCapacityString(in interface{}) (uint64, error) {
|
2021-07-15 05:56:37 +00:00
|
|
|
return extparseutil.ParseCapacityString(in)
|
2021-02-22 18:44:55 +00:00
|
|
|
}
|
|
|
|
|
2017-02-27 19:42:00 +00:00
|
|
|
func ParseDurationSecond(in interface{}) (time.Duration, error) {
|
2021-07-15 05:56:37 +00:00
|
|
|
return extparseutil.ParseDurationSecond(in)
|
2016-07-11 17:46:23 +00:00
|
|
|
}
|
2017-03-07 16:21:22 +00:00
|
|
|
|
2020-09-09 20:53:51 +00:00
|
|
|
func ParseAbsoluteTime(in interface{}) (time.Time, error) {
|
2021-07-15 05:56:37 +00:00
|
|
|
return extparseutil.ParseAbsoluteTime(in)
|
2020-09-09 20:53:51 +00:00
|
|
|
}
|
|
|
|
|
2017-10-07 22:41:07 +00:00
|
|
|
func ParseInt(in interface{}) (int64, error) {
|
2021-07-15 05:56:37 +00:00
|
|
|
return extparseutil.ParseInt(in)
|
2017-10-07 22:41:07 +00:00
|
|
|
}
|
|
|
|
|
2017-03-07 16:21:22 +00:00
|
|
|
func ParseBool(in interface{}) (bool, error) {
|
2021-07-15 05:56:37 +00:00
|
|
|
return extparseutil.ParseBool(in)
|
2017-03-07 16:21:22 +00:00
|
|
|
}
|
2018-02-16 22:19:34 +00:00
|
|
|
|
2020-07-27 20:28:52 +00:00
|
|
|
func ParseString(in interface{}) (string, error) {
|
2021-07-15 05:56:37 +00:00
|
|
|
return extparseutil.ParseString(in)
|
2020-07-27 20:28:52 +00:00
|
|
|
}
|
|
|
|
|
2018-02-16 22:19:34 +00:00
|
|
|
func ParseCommaStringSlice(in interface{}) ([]string, error) {
|
2021-07-15 05:56:37 +00:00
|
|
|
return extparseutil.ParseCommaStringSlice(in)
|
2018-02-16 22:19:34 +00:00
|
|
|
}
|
2018-04-17 22:52:09 +00:00
|
|
|
|
|
|
|
func ParseAddrs(addrs interface{}) ([]*sockaddr.SockAddrMarshaler, error) {
|
2021-07-15 05:56:37 +00:00
|
|
|
return extparseutil.ParseAddrs(addrs)
|
2018-04-17 22:52:09 +00:00
|
|
|
}
|