func restAddProfileByYamlRaw(w http.ResponseWriter, r *http.Request) {
	// Get the YAML string
	body, err := ioutil.ReadAll(r.Body)
	if err != nil {
		LoggingClient.Error(err.Error())
		http.Error(w, err.Error(), http.StatusInternalServerError)
		return
	}

	var dp models.DeviceProfile

	err = yaml.Unmarshal(body, &dp)
	if err != nil {
		http.Error(w, err.Error(), http.StatusServiceUnavailable)
		LoggingClient.Error(err.Error())
		return
	}

	addDeviceProfile(dp, dbClient, w)
}
// Add a device profile with YAML content
// The YAML content is passed as a string in the http request
Add a device profile with YAML content
The YAML content is passed as a string in the http request
// Add a device profile with YAML content // The YAML content is passed as a string in the http request
func restAddProfileByYamlRaw(w http.ResponseWriter, r *http.Request) {
	body, err := ioutil.ReadAll(r.Body)
	if err != nil {
		LoggingClient.Error(err.Error())
		http.Error(w, err.Error(), http.StatusInternalServerError)
		return
	}
	var dp models.DeviceProfile
	err = yaml.Unmarshal(body, &dp)
	if err != nil {
		http.Error(w, err.Error(), http.StatusServiceUnavailable)
		LoggingClient.Error(err.Error())
		return
	}
	addDeviceProfile(dp, dbClient, w)
}
func restAddProfileByYamlRaw ( w http . ResponseWriter , r * http . Request ) { body , err := ioutil . ReadAll ( r . Body ) if err != nil { LoggingClient . Error ( err . Error ( ) ) http . Error ( w , err . Error ( ) , http . StatusInternalServerError ) return } var dp models . DeviceProfile err = yaml . Unmarshal ( body , & dp ) if err != nil { http . Error ( w , err . Error ( ) , http . StatusServiceUnavailable ) LoggingClient . Error ( err . Error ( ) ) return } addDeviceProfile ( dp , dbClient , w ) }
Add a device profile with YAML content
The YAML content is passed as a string in the http request
Add a device profile with YAML content The YAML content is passed as a string in the http request
// Get the YAML string