mirror of
https://github.com/mainflux/mainflux.git
synced 2025-05-08 19:29:17 +08:00

* MF-1489 - Add API for deleting policies Signed-off-by: Burak Sekili <buraksekili@gmail.com> * update request and decoder naming Signed-off-by: Burak Sekili <buraksekili@gmail.com> * update swagger doc summary for the endpoint Signed-off-by: Burak Sekili <buraksekili@gmail.com> Co-authored-by: Drasko DRASKOVIC <drasko.draskovic@gmail.com>
48 lines
717 B
Go
48 lines
717 B
Go
package policies
|
|
|
|
import "net/http"
|
|
|
|
type createPolicyRes struct {
|
|
created bool
|
|
}
|
|
|
|
func (res createPolicyRes) Code() int {
|
|
if res.created {
|
|
return http.StatusCreated
|
|
}
|
|
|
|
return http.StatusOK
|
|
}
|
|
|
|
func (res createPolicyRes) Headers() map[string]string {
|
|
return map[string]string{}
|
|
}
|
|
|
|
func (res createPolicyRes) Empty() bool {
|
|
return false
|
|
}
|
|
|
|
type deletePoliciesRes struct {
|
|
deleted bool
|
|
}
|
|
|
|
func (res deletePoliciesRes) Code() int {
|
|
if res.deleted {
|
|
return http.StatusNoContent
|
|
}
|
|
|
|
return http.StatusOK
|
|
}
|
|
|
|
func (res deletePoliciesRes) Headers() map[string]string {
|
|
return map[string]string{}
|
|
}
|
|
|
|
func (res deletePoliciesRes) Empty() bool {
|
|
return false
|
|
}
|
|
|
|
type errorRes struct {
|
|
Err string `json:"error"`
|
|
}
|