forked from CATechnologiesTest/kubeiql
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
85 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,56 @@ | ||
package main | ||
|
||
import ( | ||
// "context" | ||
// "context" | ||
"errors" | ||
"fmt" | ||
) | ||
|
||
func getOwners(resourceMap map[string]interface{}) (*resource, *resource) { | ||
func getOwners(resourceMap map[string]interface{}) (resource, resource) { | ||
return nil, nil | ||
} | ||
|
||
func mapItem(obj map[string]interface{}, item string) map[string]interface{} { | ||
return obj[item].(map[string]interface{}) | ||
} | ||
|
||
func getMetadata(resourceMap map[string]interface{}) metadata { | ||
if meta, ok := resourceMap["metadata"]; ok { | ||
if mmap, ok := meta.(map[string]interface{}); ok { | ||
return mapToMetadata(mmap) | ||
} | ||
} | ||
|
||
panic(errors.New( | ||
fmt.Sprintf("Invalid Kubernetes resource: %v", resourceMap))) | ||
} | ||
|
||
func getKind(resourceMap map[string]interface{}) string { | ||
if meta, ok := resourceMap["metadata"]; ok { | ||
if mmap, ok := meta.(map[string]interface{}); ok { | ||
if kind, ok := mmap["kind"]; ok { | ||
if kindstr, ok := kind.(string); ok { | ||
return kindstr | ||
} | ||
} | ||
} | ||
} | ||
|
||
panic(errors.New( | ||
fmt.Sprintf("Invalid Kubernetes resource: %v", resourceMap))) | ||
} | ||
|
||
func getUid(resourceMap map[string]interface{}) string { | ||
if meta, ok := resourceMap["metadata"]; ok { | ||
if mmap, ok := meta.(map[string]interface{}); ok { | ||
if uid, ok := mmap["uid"]; ok { | ||
if uidstr, ok := uid.(string); ok { | ||
return uidstr | ||
} | ||
} | ||
} | ||
} | ||
|
||
panic(errors.New( | ||
fmt.Sprintf("Invalid Kubernetes resource: %v", resourceMap))) | ||
} |