MCPcopy Create free account
hub / github.com/crossplane-contrib/function-patch-and-transform / ValidateResources

Function ValidateResources

validate.go:35–53  ·  view source on GitHub ↗

ValidateResources validates the Resources object.

(r *v1beta1.Resources)

Source from the content-addressed store, hash-verified

33
34// ValidateResources validates the Resources object.
35func ValidateResources(r *v1beta1.Resources) *field.Error {
36 for _, ps := range r.PatchSets {
37 if err := ValidatePatchSet(ps); err != nil {
38 return err
39 }
40 }
41 if len(r.Resources) == 0 && (r.Environment == nil || len(r.Environment.Patches) == 0) {
42 return field.Required(field.NewPath("resources"), "resources or environment patches are required")
43 }
44 for i, r := range r.Resources {
45 if err := ValidateComposedTemplate(r); err != nil {
46 return WrapFieldError(err, field.NewPath("resources").Index(i))
47 }
48 }
49 if err := ValidateEnvironment(r.Environment); err != nil {
50 return WrapFieldError(err, field.NewPath("environment"))
51 }
52 return nil
53}
54
55// ValidateComposedTemplate validates a ComposedTemplate.
56func ValidateComposedTemplate(t v1beta1.ComposedTemplate) *field.Error {

Callers 1

RunFunctionMethod · 0.85

Calls 4

ValidatePatchSetFunction · 0.85
ValidateComposedTemplateFunction · 0.85
WrapFieldErrorFunction · 0.85
ValidateEnvironmentFunction · 0.85

Tested by

no test coverage detected