func NewValidatorFromConfig()

in pkg/gcv/validator.go [146:168]


func NewValidatorFromConfig(config *configs.Configuration, opts ...Option) (*Validator, error) {
	gcpCFClient, err := newCFClient(gcptarget.New(), config.GCPTemplates, config.GCPConstraints, opts...)
	if err != nil {
		return nil, fmt.Errorf("unable to set up GCP Constraint Framework client: %w", err)
	}

	k8sCFClient, err := newCFClient(&k8starget.K8sValidationTarget{}, config.K8STemplates, config.K8SConstraints, opts...)
	if err != nil {
		return nil, fmt.Errorf("unable to set up K8S Constraint Framework client: %w", err)
	}

	tfCFClient, err := newCFClient(tftarget.New(), config.TFTemplates, config.TFConstraints, opts...)
	if err != nil {
		return nil, fmt.Errorf("unable to set up TF Constraint Framework client: %w", err)
	}

	ret := &Validator{
		gcpCFClient: gcpCFClient,
		k8sCFClient: k8sCFClient,
		tfCFClient:  tfCFClient,
	}
	return ret, nil
}