code: func (r *Resource) UnmarshalJSON(buf []byte) error {
  	m := map[string]interface{}{}
  	if err := json.Unmarshal(buf, &m); err != nil {
  		return err
  	}
  
  	typeName := m["Type"].(string)
  	r.DependsOn, _ = m["DependsOn"].([]string)
  	r.Metadata, _ = m["Metadata"].(map[string]interface{})
  	r.DeletionPolicy, _ = m["DeletionPolicy"].(string)
  	r.Properties = NewResourceByType(typeName)
  	if r.Properties == nil {
  		return fmt.Errorf("unknown resource type: %s", typeName)
  	}
  
  	propertiesBuf, err := json.Marshal(m["Properties"])
  	if err != nil {
  		return err
  	}
  	return json.Unmarshal(propertiesBuf, r.Properties)
  }
docs: // UnmarshalJSON sets the object from the provided JSON representation