cli: add a string method to gvk struct (#19696)

This commit is contained in:
cskh 2023-11-21 11:29:00 -05:00 committed by GitHub
parent 8a89465e96
commit d3bf47fe08
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 0 deletions

View File

@ -185,6 +185,10 @@ type ListResponse struct {
Resources []map[string]interface{} `json:"resources"`
}
func (gvk *GVK) String() string {
return fmt.Sprintf("%s.%s.%s", gvk.Group, gvk.Version, gvk.Kind)
}
func (resource *Resource) Read(gvk *GVK, resourceName string, q *client.QueryOptions) (map[string]interface{}, error) {
r := resource.C.NewRequest("GET", strings.ToLower(fmt.Sprintf("/api/%s/%s/%s/%s", gvk.Group, gvk.Version, gvk.Kind, resourceName)))
r.SetQueryOptions(q)