// Validate verifies the resource configuration.
Validate verifies the resource configuration.
// Validate verifies the resource configuration .
func (r *Resource) Validate(rawResource components.RawResource) error {
	var c Config
	r.Name = &rawResource.Name
	r.Type = &rawResource.Type
	var md mapstructure.Metadata
	if err := mapstructure.DecodeMetadata(rawResource.Config, &c, &md); err != nil {
		return err
	}
	r.Config = c
	cs := validator.CustomStruct{Struct: c}
	if errs := validator.CheckRequiredFieldsInStruct(cs); len(errs) != 0 {
		clogger.Errorf("Missing/Empty key(s) found in the resource: [%s]", *r.Name)
		clogger.Fatal(errs)
	}
	r.validateConfigSource()
	r.validateConfigTarget()
	return nil
}
func ( r * Resource ) Validate ( rawResource components . RawResource ) error { var c Config r . Name = & rawResource . Name r . Type = & rawResource . Type var md mapstructure . Metadata if err := mapstructure . DecodeMetadata ( rawResource . Config , & c , & md ) ; err != nil { return err } r . Config = c cs := validator . CustomStruct { Struct : c } if errs := validator . CheckRequiredFieldsInStruct ( cs ) ; len ( errs ) != 0 { clogger . Errorf ( " " , * r . Name ) clogger . Fatal ( errs ) } r . validateConfigSource ( ) r . validateConfigTarget ( ) return nil }
Validate verifies the resource configuration.
Validate verifies the resource configuration .