MCPcopy
hub / github.com/kubernetes/client-go / SubResource

Method SubResource

rest/request.go:203–220  ·  view source on GitHub ↗

SubResource sets a sub-resource path which can be multiple segments after the resource name but before the suffix.

(subresources ...string)

Source from the content-addressed store, hash-verified

201// SubResource sets a sub-resource path which can be multiple segments after the resource
202// name but before the suffix.
203func (r *Request) SubResource(subresources ...string) *Request {
204 if r.err != nil {
205 return r
206 }
207 subresource := path.Join(subresources...)
208 if len(r.subresource) != 0 {
209 r.err = fmt.Errorf("subresource already set to %q, cannot change to %q", r.resource, subresource)
210 return r
211 }
212 for _, s := range subresources {
213 if msgs := IsValidPathSegmentName(s); len(msgs) != 0 {
214 r.err = fmt.Errorf("invalid subresource %q: %v", s, msgs)
215 return r
216 }
217 }
218 r.subresource = subresource
219 return r
220}
221
222// Name sets the name of a resource to access (<resource>/[ns/<namespace>/]<name>)
223func (r *Request) Name(resourceName string) *Request {

Callers 15

TestInvalidSegmentsFunction · 0.95
GetMethod · 0.80
UpdateMethod · 0.80
PatchMethod · 0.80
UpdateStatusMethod · 0.80
PatchMethod · 0.80
EvictMethod · 0.80
PatchMethod · 0.80
PatchMethod · 0.80
PatchMethod · 0.80
PatchMethod · 0.80
PatchMethod · 0.80

Calls 2

IsValidPathSegmentNameFunction · 0.85
ErrorfMethod · 0.65

Tested by 3

TestInvalidSegmentsFunction · 0.76
TestRequestSetTwiceErrorFunction · 0.64