New constructs a Client from a rest.Config.
(cfg *rest.Config)
| 27 | |
| 28 | // New constructs a Client from a rest.Config. |
| 29 | func New(cfg *rest.Config) (*Client, error) { |
| 30 | dyn, err := dynamic.NewForConfig(cfg) |
| 31 | if err != nil { |
| 32 | return nil, fmt.Errorf("dynamic client: %w", err) |
| 33 | } |
| 34 | disc, err := discovery.NewDiscoveryClientForConfig(cfg) |
| 35 | if err != nil { |
| 36 | return nil, fmt.Errorf("discovery client: %w", err) |
| 37 | } |
| 38 | mapper := restmapper.NewDeferredDiscoveryRESTMapper(memory.NewMemCacheClient(disc)) |
| 39 | return &Client{dyn: dyn, mapper: mapper}, nil |
| 40 | } |
| 41 | |
| 42 | // List returns the items of a Kind+Group, optionally scoped to a namespace. |
| 43 | func (c *Client) List(ctx context.Context, group, kind, namespace string) ([]unstructured.Unstructured, error) { |
nothing calls this directly
no outgoing calls
no test coverage detected