schema

package
v0.11.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 17, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	// Get retrieves the fully self-contained Schema version for the corresponding Schema
	// ID. The call will fail if the caller does not have permission the SchemaID.
	Get(ctx context.Context, id stately.SchemaID, version stately.SchemaVersionID) (*schemaservice.SchemaModel, error)

	// Put appends a Schema version to the StatelyDB Schema. If the caller attempts
	// to put a SchemaVersion for a Schema that does not exist the request will fail.
	// If the caller does not have permissions to access the SchemaID the request will fail.
	// If the Schema is not valid the request will fail. If a previous Schema
	// already exists, then the new version will only be accepted if the
	// new Schema is backwards compatible.
	Put(
		ctx context.Context,
		fileDescriptor *descriptorpb.FileDescriptorProto,
		changeDescription string,
		schemaID stately.SchemaID,
		options ...*PutOptions,
	) (*schemaservice.PutResponse, error)

	// Validate ensures the provided file descriptor proto is a valid stately schema
	// and returns a list of validation errors. This does not persist the schema
	// nor does it require auth.
	Validate(
		ctx context.Context,
		fileDescriptor *descriptorpb.FileDescriptorProto,
	) (*schemaservice.ValidateResponse, error)

	// ListAuditLog retrieves the audit log for the Schema associated with the provided schemaID.
	// The audit log consists of a list of audit log entries that represent each change to the Schema including
	// its creation. The list is ordered by the time of the change with the most recent change first.
	// If there is no Schema for the provided Schema ID, an empty list will be returned.
	ListAuditLog(
		ctx context.Context,
		schemaID stately.SchemaID,
		options ...*ListAuditLogOptions,
	) ([]*schemaservice.SchemaAuditLogEntry, error)

	// Bind associates a Schema with a Store. The caller must have permission
	// to access the SchemaID and StoreID. If a different Schema is already
	// bound to the Store, the request will fail. The schemaID must exist
	// in the same organization as the storeID or the request will fail.
	//
	// (option) force will perform the bind operation, even if the store is
	// already bound to a schema. This is very dangerous if your store already
	// has items that are not compatible with the new schema. You must be
	// exceedingly sure the store is empty or that ALL items are compatible with
	// the new schema.
	Bind(
		ctx context.Context,
		schemaID stately.SchemaID,
		storeID stately.StoreID,
		force bool,
	) error

	// Create creates a new Schema with the given name and description.
	// The caller must have permission to create a Schema in the organization
	Create(
		ctx context.Context,
		projectID stately.ProjectID,
		name string,
		description string,
	) (stately.SchemaID, error)
}

Client models all schema management related apis.

func NewClient

func NewClient(appCtx context.Context, options ...*stately.Options) (Client, error)

NewClient creates a new client with the given options.

type ListAuditLogOptions

type ListAuditLogOptions struct {
	// Limit is the maximum number of entries to return.
	Limit uint32
}

ListAuditLogOptions are optional parameters for ListAuditLog.

type PutOptions

type PutOptions struct {
	// If DryRun is true the request will be validated against the existing schema but not applied.
	DryRun bool
	// If force is true, the schema will be applied even if it is backwards incompatible.
	Force bool
}

PutOptions are optional parameters for Put.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL