https://github.com/cybozu-go/scim
generic SCIM server/client library in Go
https://github.com/cybozu-go/scim
go scim
Last synced: 6 months ago
JSON representation
generic SCIM server/client library in Go
- Host: GitHub
- URL: https://github.com/cybozu-go/scim
- Owner: cybozu-go
- License: other
- Archived: true
- Created: 2022-05-27T07:00:13.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2022-10-20T01:59:47.000Z (over 3 years ago)
- Last Synced: 2025-08-12T04:23:27.468Z (11 months ago)
- Topics: go, scim
- Language: Go
- Homepage:
- Size: 675 KB
- Stars: 7
- Watchers: 8
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
scim
====
[](https://pkg.go.dev/github.com/cybozu-go/scim)
SCIM tools for Go (Work In Progress)
* [server](./server) - SCIM server
* [client](./client) - SCIM client
* [resource](./resource) - Definition of SCIM resource types
* [filter](./filter) - Basic SCIM filter parsing, with a simple SQL generator
# SYNOPSIS
```go
package examples_test
import (
"context"
"fmt"
"net/http/httptest"
"github.com/cybozu-go/scim/server"
)
func ExampleClient_UserCreate() {
srv := httptest.NewServer(server.MustNewServer(NewMockBackend()))
defer srv.Close()
// Create a SCIM client: this is wrapped in another function call
// to accomodate for debug tracing, but you can replace it with
// a client.New() call
cl := NewClient(srv.URL)
user, err := cl.User().Create().
DisplayName(`Daisuke Maki`).
ExternalID(`lestrrat`).
UserName(`lestrrat`).
Do(context.TODO())
if err != nil {
fmt.Printf("failed to create user: %s", err)
}
_ = user
// OUTPUT:
//
}
```
source: [./examples/client_user_create_example_test.go](https://github.com/cybozu-go/scim/blob/main/./examples/client_user_create_example_test.go)
# TODO
* Finish implementing sample server
* Probably move it to github.com/cybozu-go/scim-ent
* Implement check in CI to diff against generated code
* Streamline code generation
# Code Generation
## go generate ./resource
Generates code in `resource`, `sample/ent/schema`, and `sample`. If you made any changes that result in
changes to code under `sample/ent/schema`, you need to run `go generate ./sample` as well.
Source file is [`tools/cmd/genresources/objects.yml`](./tools/cmd/genresources/object.yml)
## go generate ./sample
Generates code for [`ent`](https://entgo.io), based on files under `sample/ent/schema`.
This generates code from ent code, and thus have not source file.
## go generate ./client
Generates client code. Requires some synchronization between `resource`.
Source file is [`tools/cmd/genclient/calls.yml`](./tools/cmd/genclient/calls.yml)
## go generate ./filter
Generates filter parser code from `filter/parser.go.y` support objects.
Source file is [`tools/cmd/genfilter/objects.yml`](./tools/cmd/genfilter/object.yml)
## go generate .
Generates options, as well as run all of `go generate` for `resource`, `sample`, `client`, and `filer`
Source files are located in various places, under the name `options.yml`