Add states to counts

This commit is contained in:
Darren Shepherd
2020-03-12 19:14:40 -07:00
parent 4f6e4d4e16
commit d457428bff
4 changed files with 149 additions and 51 deletions

View File

@@ -20,6 +20,7 @@ type Factory struct {
clientCfg *rest.Config
watchClientCfg *rest.Config
metadata metadata.Interface
dynamic dynamic.Interface
Config *rest.Config
}
@@ -66,7 +67,13 @@ func NewFactory(cfg *rest.Config, impersonate bool) (*Factory, error) {
return nil, err
}
d, err := dynamic.NewForConfig(cfg)
if err != nil {
return nil, err
}
return &Factory{
dynamic: d,
metadata: md,
impersonate: impersonate,
tableClientCfg: tableClientCfg,
@@ -81,6 +88,10 @@ func (p *Factory) MetadataClient() metadata.Interface {
return p.metadata
}
func (p *Factory) DynamicClient() dynamic.Interface {
return p.dynamic
}
func (p *Factory) Client(ctx *types.APIRequest, s *types.APISchema, namespace string) (dynamic.ResourceInterface, error) {
return newClient(ctx, p.clientCfg, s, namespace, p.impersonate)
}