cli: add a string method to gvk struct

pull/19696/head
cskh 2023-11-20 13:20:57 -05:00
parent d7323ca22c
commit a94fcc7077
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)