NewDynamicRESTMapper returns a dynamic RESTMapper for cfg. The dynamic RESTMapper dynamically discovers resource types at runtime.
(cfg *rest.Config, httpClient *http.Client)
| 33 | // NewDynamicRESTMapper returns a dynamic RESTMapper for cfg. The dynamic |
| 34 | // RESTMapper dynamically discovers resource types at runtime. |
| 35 | func NewDynamicRESTMapper(cfg *rest.Config, httpClient *http.Client) (meta.RESTMapper, error) { |
| 36 | if httpClient == nil { |
| 37 | return nil, fmt.Errorf("httpClient must not be nil, consider using rest.HTTPClientFor(c) to create a client") |
| 38 | } |
| 39 | |
| 40 | client, err := discovery.NewDiscoveryClientForConfigAndClient(cfg, httpClient) |
| 41 | if err != nil { |
| 42 | return nil, err |
| 43 | } |
| 44 | |
| 45 | return &mapper{ |
| 46 | mapper: restmapper.NewDiscoveryRESTMapper([]*restmapper.APIGroupResources{}), |
| 47 | client: client, |
| 48 | knownGroups: map[string]*restmapper.APIGroupResources{}, |
| 49 | apiGroups: map[string]*metav1.APIGroup{}, |
| 50 | }, nil |
| 51 | } |
| 52 | |
| 53 | // mapper is a RESTMapper that will lazily query the provided |
| 54 | // client for discovery information to do REST mappings. |
no outgoing calls
searching dependent graphs…