func restDeleteProfileByName(w http.ResponseWriter, r *http.Request) {
	vars := mux.Vars(r)
	n, err := url.QueryUnescape(vars[NAME])
	if err != nil {
		LoggingClient.Error(err.Error())
		http.Error(w, err.Error(), http.StatusBadRequest)
		return
	}

	op := device_profile.NewDeleteByNameExecutor(dbClient, n)
	err = op.Execute()
	if err != nil {
		LoggingClient.Error(err.Error())
		switch err.(type) {
		case errors.ErrDeviceProfileNotFound:
			http.Error(w, err.Error(), http.StatusNotFound)
		case errors.ErrDeviceProfileInvalidState:
			http.Error(w, err.Error(), http.StatusConflict)
		default:
			http.Error(w, err.Error(), http.StatusInternalServerError)
		}

		return
	}

	w.Header().Set("Content-Type", "application/json")
	w.WriteHeader(http.StatusOK)
	w.Write([]byte("true"))
}
// Delete the device profile based on its name
Delete the device profile based on its name
// Delete the device profile based on its name
func restDeleteProfileByName(w http.ResponseWriter, r *http.Request) {
	vars := mux.Vars(r)
	n, err := url.QueryUnescape(vars[NAME])
	if err != nil {
		LoggingClient.Error(err.Error())
		http.Error(w, err.Error(), http.StatusBadRequest)
		return
	}
	op := device_profile.NewDeleteByNameExecutor(dbClient, n)
	err = op.Execute()
	if err != nil {
		LoggingClient.Error(err.Error())
		switch err.(type) {
		case errors.ErrDeviceProfileNotFound:
			http.Error(w, err.Error(), http.StatusNotFound)
		case errors.ErrDeviceProfileInvalidState:
			http.Error(w, err.Error(), http.StatusConflict)
		default:
			http.Error(w, err.Error(), http.StatusInternalServerError)
		}
		return
	}
	w.Header().Set("Content-Type", "application/json")
	w.WriteHeader(http.StatusOK)
	w.Write([]byte("true"))
}
func restDeleteProfileByName ( w http . ResponseWriter , r * http . Request ) { vars := mux . Vars ( r ) n , err := url . QueryUnescape ( vars [ NAME ] ) if err != nil { LoggingClient . Error ( err . Error ( ) ) http . Error ( w , err . Error ( ) , http . StatusBadRequest ) return } op := device_profile . NewDeleteByNameExecutor ( dbClient , n ) err = op . Execute ( ) if err != nil { LoggingClient . Error ( err . Error ( ) ) switch err . ( type ) { case errors . ErrDeviceProfileNotFound : http . Error ( w , err . Error ( ) , http . StatusNotFound ) case errors . ErrDeviceProfileInvalidState : http . Error ( w , err . Error ( ) , http . StatusConflict ) default : http . Error ( w , err . Error ( ) , http . StatusInternalServerError ) } return } w . Header ( ) . Set ( " " , " " ) w . WriteHeader ( http . StatusOK ) w . Write ( [ ] byte ( " " ) ) }
Delete the device profile based on its name
Delete the device profile based on its name