Skip to content

Commit

Permalink
review changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Ofir-Lapid committed Nov 18, 2021
1 parent e242662 commit a5847f2
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions kubebeat/beater/file_system_fetcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,19 @@ import (
"syscall"
)

// FileSystemFetcher implement the Fetcher interface
// The FileSystemFetcher meant to fetch file/directories from the file system and ship it
// to the Kubebeat
type FileSystemFetcher struct {
filesPaths []string // Files and directories paths for the fetcher to extract info from
}

const (
FILE_SYSTEM_INPUT_TYPE = "file-system"
FileSystemInputType = "file-system"
)

// FileSystemResourceData represents a struct for a system resource data
// This struct is being used by the fileSystemFetcher when
type FileSystemResourceData struct {
FileName string `json:"fileName"`
FileMode string `json:"fileMode"`
Expand Down Expand Up @@ -68,15 +73,14 @@ func FromFileInfo(info os.FileInfo, path string) FileSystemResourceData {
group, _ := user.LookupGroupId(g)
mod := strconv.FormatUint(uint64(info.Mode().Perm()), 8)

data :=
FileSystemResourceData{
FileName: info.Name(),
FileMode: mod,
Uid: usr.Name,
Gid: group.Name,
Path: path,
InputType: FILE_SYSTEM_INPUT_TYPE,
}
data := FileSystemResourceData{
FileName: info.Name(),
FileMode: mod,
Uid: usr.Name,
Gid: group.Name,
Path: path,
InputType: FileSystemInputType,
}

return data
}

0 comments on commit a5847f2

Please sign in to comment.