mirror of
https://github.com/netbirdio/management-refactor.git
synced 2026-05-22 17:12:59 -07:00
29 lines
441 B
Go
29 lines
441 B
Go
package groups
|
|
|
|
import "github.com/netbirdio/netbird/management/server/http/api"
|
|
|
|
type Resource struct {
|
|
ID string
|
|
Type string
|
|
}
|
|
|
|
func (r *Resource) ToAPIResponse() *api.Resource {
|
|
if r.ID == "" && r.Type == "" {
|
|
return nil
|
|
}
|
|
|
|
return &api.Resource{
|
|
Id: r.ID,
|
|
Type: api.ResourceType(r.Type),
|
|
}
|
|
}
|
|
|
|
func (r *Resource) FromAPIRequest(req *api.Resource) {
|
|
if req == nil {
|
|
return
|
|
}
|
|
|
|
r.ID = req.Id
|
|
r.Type = string(req.Type)
|
|
}
|