Total Lines | 32 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | package main |
||
2 | |||
3 | import ( |
||
4 | "context" |
||
5 | "log" |
||
6 | |||
7 | v1 "github.com/Permify/permify-go/generated/base/v1" |
||
8 | permify "github.com/Permify/permify-go/v1" |
||
9 | "google.golang.org/grpc" |
||
10 | "google.golang.org/grpc/credentials/insecure" |
||
11 | ) |
||
12 | |||
13 | func main() { |
||
14 | client, err := permify.NewClient( |
||
15 | permify.Config{ |
||
16 | Endpoint: `localhost:3478`, |
||
17 | }, |
||
18 | grpc.WithTransportCredentials(insecure.NewCredentials()), |
||
19 | ) |
||
20 | if err != nil { |
||
21 | log.Fatalf("failed to create Permify client: %v", err) |
||
22 | } |
||
23 | |||
24 | ct, err := client.Tenancy.Create(context.Background(), &v1.TenantCreateRequest{ |
||
25 | Id: "t1", |
||
26 | Name: "tenant 1", |
||
27 | }) |
||
28 | if err != nil { |
||
29 | log.Fatalf("failed to create tenant: %v", err) |
||
30 | } |
||
31 | |||
32 | log.Printf("Tenant created: %v", ct) |
||
33 | } |
||
34 |