Documentation ¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { v1.SchemaServiceClient v1.PermissionsServiceClient v1.WatchServiceClient // contains filtered or unexported fields }
Client represents an open connection to Authzed.
Clients are backed by a gRPC client and as such are thread-safe.
func NewClient ¶
func NewClient(endpoint string, opts ...grpc.DialOption) (*Client, error)
NewClient initializes a brand new client for interacting with Authzed.
Example ¶
systemCerts, err := grpcutil.WithSystemCerts(grpcutil.VerifyCA) if err != nil { log.Fatalf("failed to load system certs: %s", err) } client, err := authzed.NewClient( "grpc.authzed.com:443", grpcutil.WithBearerToken("tc_my_token_deadbeefdeadbeefdeadbeef"), systemCerts, ) if err != nil { log.Fatalf("failed to connect to authzed: %s", err) } log.Println(client)
Output:
type ClientWithExperimental ¶ added in v0.9.0
type ClientWithExperimental struct { Client v1.ExperimentalServiceClient }
ClientWithExperimental represents and open connection to Authzed with experimental services available.
Clients are backed by a gRPC client and as such are thread-safe.
func NewClientWithExperimentalAPIs ¶ added in v0.9.0
func NewClientWithExperimentalAPIs(endpoint string, opts ...grpc.DialOption) (*ClientWithExperimental, error)
NewClientWithExperimentalAPIs initializes a brand new client for interacting with Authzed.
type ConflictStrategy ¶ added in v0.11.0
type ConflictStrategy int
ConflictStrategy is an enumeration type that represents the strategy to be used when a conflict occurs during a bulk import of relationships into SpiceDB.
const ( // Fail - The operation will fail if any duplicate relationships are found. Fail ConflictStrategy = iota // Skip - The operation will ignore duplicates and continue with the import. Skip // Touch - The operation will retry the import with TOUCH semantics in case of duplicates. Touch )
type RetryableClient ¶ added in v0.11.0
type RetryableClient struct {
ClientWithExperimental
}
RetryableClient represents an open connection to SpiceDB with experimental services available. It also adds a new method for retrying bulk imports with different conflict strategies.
Clients are backed by a gRPC client and as such are thread-safe.
func NewRetryableClient ¶ added in v0.11.0
func NewRetryableClient(endpoint string, opts ...grpc.DialOption) (*RetryableClient, error)
NewRetryableClient initializes a brand new client for interacting with SpiceDB.
func (*RetryableClient) RetryableBulkImportRelationships ¶ added in v0.11.0
func (rc *RetryableClient) RetryableBulkImportRelationships(ctx context.Context, relationships []*v1.Relationship, conflictStrategy ConflictStrategy) error
RetryableBulkImportRelationships is a wrapper around BulkImportRelationships. It retries the bulk import with different conflict strategies in case of failure. The conflict strategy can be one of Fail, Skip, or Touch. Fail will return an error if any duplicate relationships are found. Skip will ignore duplicates and continue with the import. Touch will retry the import with TOUCH semantics in case of duplicates.