func NewConfigurationFromContents()

in pkg/gcv/configs/config.go [522:543]


func NewConfigurationFromContents(unstructuredObjects []*unstructured.Unstructured, regoLib []string) (*Configuration, error) {
	configuration := newConfiguration()
	configuration.regoLib = regoLib
	var errs multierror.Errors
	for _, u := range unstructuredObjects {
		if err := configuration.loadUnstructured(u); err != nil {
			yamlPath := u.GetAnnotations()[yamlPath]
			name := u.GetName()
			errs.Add(errors.Wrapf(err, "failed to load resource %s %s", yamlPath, name))
		}
	}
	if !errs.Empty() {
		return nil, errs.ToError()

	}

	if err := configuration.finishLoad(); err != nil {
		return nil, errors.Wrapf(err, "config error")
	}

	return configuration, nil
}