MCPcopy Create free account
hub / github.com/elimity-com/scim / Create

Method Create

resource_handler_test.go:31–54  ·  view source on GitHub ↗
(r *http.Request, attributes ResourceAttributes)

Source from the content-addressed store, hash-verified

29}
30
31func (h testResourceHandler) Create(r *http.Request, attributes ResourceAttributes) (Resource, error) {
32 // create unique identifier
33 rand.Seed(time.Now().UnixNano())
34 id := fmt.Sprintf("%04d", rand.Intn(9999))
35
36 // store resource
37 h.data[id] = testData{
38 resourceAttributes: attributes,
39 }
40
41 now := time.Now()
42
43 // return stored resource
44 return Resource{
45 ID: id,
46 ExternalID: h.externalID(attributes),
47 Attributes: attributes,
48 Meta: Meta{
49 Created: &now,
50 LastModified: &now,
51 Version: fmt.Sprintf("v%s", id),
52 },
53 }, nil
54}
55
56func (h testResourceHandler) Delete(r *http.Request, id string) error {
57 // check if resource exists

Callers

nothing calls this directly

Calls 1

externalIDMethod · 0.95

Tested by

no test coverage detected