(r *http.Request, id string)
| 67 | } |
| 68 | |
| 69 | func (h testResourceHandler) Get(r *http.Request, id string) (Resource, error) { |
| 70 | // check if resource exists |
| 71 | data, ok := h.data[id] |
| 72 | if !ok { |
| 73 | return Resource{}, errors.ScimErrorResourceNotFound(id) |
| 74 | } |
| 75 | |
| 76 | created, _ := time.ParseInLocation(time.RFC3339, fmt.Sprintf("%v", data.meta["created"]), time.UTC) |
| 77 | lastModified, _ := time.Parse(time.RFC3339, fmt.Sprintf("%v", data.meta["lastModified"])) |
| 78 | |
| 79 | // return resource with given identifier |
| 80 | return Resource{ |
| 81 | ID: id, |
| 82 | ExternalID: h.externalID(data.resourceAttributes), |
| 83 | Attributes: data.resourceAttributes, |
| 84 | Meta: Meta{ |
| 85 | Created: &created, |
| 86 | LastModified: &lastModified, |
| 87 | Version: fmt.Sprintf("%v", data.meta["version"]), |
| 88 | }, |
| 89 | }, nil |
| 90 | } |
| 91 | |
| 92 | func (h testResourceHandler) GetAll(r *http.Request, params ListRequestParams) (Page, error) { |
| 93 | if params.Count == 0 { |
nothing calls this directly
no test coverage detected