refact(deps): bump k8s and client-go deps to version v0.20.2 (#294)

Signed-off-by: prateekpandey14 <prateek.pandey@mayadata.io>
This commit is contained in:
Prateek Pandey 2021-03-31 16:43:42 +05:30 committed by GitHub
parent 533e17a9aa
commit b1aa6ab51a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2196 changed files with 306727 additions and 251810 deletions

View file

@ -17,7 +17,10 @@ limitations under the License.
package helpers
import (
"os"
"strings"
"github.com/google/uuid"
)
// GetCaseInsensitiveMap coercs the map's keys to lower case, which only works
@ -43,3 +46,29 @@ func GetInsensitiveParameter(dict *map[string]string, key string) string {
insensitiveDict := GetCaseInsensitiveMap(dict)
return insensitiveDict[strings.ToLower(key)]
}
func exists(path string) (os.FileInfo, bool) {
info, err := os.Stat(path)
if os.IsNotExist(err) {
return nil, false
}
return info, true
}
// FileExists checks if a file exists and is not a directory
func FileExists(filepath string) bool {
info, present := exists(filepath)
return present && info.Mode().IsRegular()
}
// DirExists checks if a directory exists
func DirExists(path string) bool {
info, present := exists(path)
return present && info.IsDir()
}
// IsValidUUID validates whether a string is a valid UUID
func IsValidUUID(u string) bool {
_, err := uuid.Parse(u)
return err == nil
}