userstore

package
v1.6.1 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

AllDataLifeCycleStates is a slice of all DataLifeCycleState values

Functions

func GetRetentionTimeoutImmediateDeletion added in v0.7.2

func GetRetentionTimeoutImmediateDeletion() time.Time

GetRetentionTimeoutImmediateDeletion returns the immediate deletion retention timeout

func GetRetentionTimeoutIndefinite added in v0.7.2

func GetRetentionTimeoutIndefinite() time.Time

GetRetentionTimeoutIndefinite returns the indefinite retention timeout

Types

type Accessor added in v0.4.0

type Accessor struct {
	ID uuid.UUID `json:"id"`

	// Name of accessor, must be unique
	Name string `json:"name" validate:"length:1,256" required:"true"`

	// Description of the accessor
	Description string `json:"description"`

	// Version of the accessor
	Version int `json:"version"`

	// Specify whether to access live or soft-deleted data
	DataLifeCycleState DataLifeCycleState `json:"data_life_cycle_state"`

	// Configuration for which user records to return
	SelectorConfig UserSelectorConfig `json:"selector_config" required:"true"`

	// Purposes for which this accessor is used
	Purposes []ResourceID `json:"purposes" validate:"skip" required:"true"`

	// List of userstore columns being accessed and the transformers to apply to each column
	Columns []ColumnOutputConfig `json:"columns" validate:"skip" required:"true"`

	// Policy for what data is returned by this accessor, based on properties of the caller and the user records
	AccessPolicy ResourceID `json:"access_policy" validate:"skip" required:"true"`

	// Whether to override column access policies for this accessor
	AreColumnAccessPoliciesOverridden bool `` /* 126-byte string literal not displayed */

	// TODO: Deprecated, but preserved for backwards-compatibility. Remove in a future release.
	// Policy for token resolution in the case of transformers that tokenize data
	TokenAccessPolicy ResourceID `json:"token_access_policy,omitempty" validate:"skip"`

	// Whether this accessor is a system accessor
	IsSystem bool `` /* 155-byte string literal not displayed */

	// Whether this accessor is audit logged each time it is executed
	IsAuditLogged bool `json:"is_audit_logged" description:"Whether this accessor is audit logged each time it is executed."`

	// Whether this accessor is autogenerated
	IsAutogenerated bool `json:"is_autogenerated" description:"Whether this accessor is autogenerated."`

	// Whether this accessor uses the search index
	UseSearchIndex bool `` /* 313-byte string literal not displayed */
}

Accessor represents a customer-defined view and permissions policy on userstore data

type Address added in v0.6.3

type Address struct {
	ID                 string `json:"id,omitempty"`
	Country            string `json:"country,omitempty"`
	Name               string `json:"name,omitempty"`
	Organization       string `json:"organization,omitempty"`
	StreetAddressLine1 string `json:"street_address_line_1,omitempty"`
	StreetAddressLine2 string `json:"street_address_line_2,omitempty"`
	DependentLocality  string `json:"dependent_locality,omitempty"`
	Locality           string `json:"locality,omitempty"`
	AdministrativeArea string `json:"administrative_area,omitempty"`
	PostCode           string `json:"post_code,omitempty"`
	SortingCode        string `json:"sorting_code,omitempty"`
}

Address is a native userstore type that represents a physical address

type Column added in v0.3.0

type Column struct {
	// Columns may be renamed, but their ID cannot be changed.
	ID                       uuid.UUID         `json:"id"`
	Table                    string            `json:"table"` // TODO (sgarrity 6/24): validate & mark as required once people update
	Name                     string            `json:"name" validate:"length:1,128" required:"true"`
	DataType                 ResourceID        `json:"data_type" required:"true"`
	Type                     string            `json:"type" validate:"skip"`
	IsArray                  bool              `json:"is_array" required:"true"`
	DefaultValue             string            `json:"default_value"`
	SearchIndexed            bool              `json:"search_indexed"`
	AccessPolicy             ResourceID        `json:"access_policy" validate:"skip"`
	DefaultTransformer       ResourceID        `json:"default_transformer" validate:"skip"`
	DefaultTokenAccessPolicy ResourceID        `json:"default_token_access_policy" validate:"skip"`
	IndexType                ColumnIndexType   `json:"index_type" required:"true"`
	IsSystem                 bool              `` /* 149-byte string literal not displayed */
	Constraints              ColumnConstraints `json:"constraints" description:"Optional constraints for configuring the behavior of the associated column DataType."`
}

Column represents a single field/column/value to be collected/stored/managed in the user data store of a tenant.

type ColumnConstraints added in v1.0.0

type ColumnConstraints struct {
	ImmutableRequired bool          `` /* 181-byte string literal not displayed */
	PartialUpdates    bool          `` /* 226-byte string literal not displayed */
	UniqueIDRequired  bool          `` /* 222-byte string literal not displayed */
	UniqueRequired    bool          `` /* 155-byte string literal not displayed */
	Fields            []ColumnField `` /* 153-byte string literal not displayed */
}

ColumnConstraints represents the data type constraints for a column

func (ColumnConstraints) Validate added in v1.1.0

func (o ColumnConstraints) Validate() error

Validate implements Validateable

type ColumnDataType added in v1.2.0

type ColumnDataType struct {
	ID                   uuid.UUID           `json:"id"`
	Name                 string              `json:"name" validate:"length:1,128" required:"true"`
	Description          string              `json:"description" validate:"length:1,128" required:"true"`
	IsCompositeFieldType bool                `json:"is_composite_field_type" description:"Whether the data type can be used for a composite field."`
	IsNative             bool                `json:"is_native" description:"Whether this is a native non-editable data type."`
	CompositeAttributes  CompositeAttributes `json:"composite_attributes"`
}

ColumnDataType represents the settings for a data type

type ColumnField added in v1.0.0

type ColumnField struct {
	Type                string `json:"type" required:"true"`
	Name                string `` /* 290-byte string literal not displayed */
	CamelCaseName       string `` /* 126-byte string literal not displayed */
	StructName          string `json:"struct_name" description:"Read-only snake-case version of field name, with all letters lowercase. (ex. id_field_1)"`
	Required            bool   `json:"required" description:"Whether a value must be specified for the field."`
	IgnoreForUniqueness bool   `` /* 138-byte string literal not displayed */
}

ColumnField represents the settings for a column field

func (ColumnField) Validate added in v1.1.0

func (o ColumnField) Validate() error

Validate implements Validateable

type ColumnIndexType added in v0.6.0

type ColumnIndexType string

ColumnIndexType is an enum for supported column index types

const (
	// ColumnIndexTypeNone is the default value
	ColumnIndexTypeNone ColumnIndexType = "none"

	// ColumnIndexTypeIndexed indicates that the column should be indexed
	ColumnIndexTypeIndexed ColumnIndexType = "indexed"

	// ColumnIndexTypeUnique indicates that the column should be indexed and unique
	ColumnIndexTypeUnique ColumnIndexType = "unique"
)

type ColumnInputConfig added in v0.6.4

type ColumnInputConfig struct {
	Column     ResourceID `json:"column"`
	Normalizer ResourceID `json:"normalizer"`

	// Validator is deprecated in favor of Normalizer
	Validator ResourceID `json:"validator"`
}

ColumnInputConfig is a struct that contains a column and the normalizer to use for that column

type ColumnOutputConfig added in v0.6.4

type ColumnOutputConfig struct {
	Column            ResourceID `json:"column"`
	Transformer       ResourceID `json:"transformer" validate:"skip"`
	TokenAccessPolicy ResourceID `json:"token_access_policy" validate:"skip"`
}

ColumnOutputConfig is a struct that contains a column and the transformer to apply to that column

type CompositeAttributes added in v1.2.0

type CompositeAttributes struct {
	IncludeID bool             `json:"include_id" description:"Whether the composite data type must include an id field."`
	Fields    []CompositeField `json:"fields" description:"The set of fields associated with a composite data type."`
}

CompositeAttributes represents the attributes for a composite data type

type CompositeField added in v1.2.0

type CompositeField struct {
	DataType            ResourceID `json:"data_type" required:"true"`
	Name                string     `` /* 290-byte string literal not displayed */
	CamelCaseName       string     `` /* 126-byte string literal not displayed */
	StructName          string     `json:"struct_name" description:"Read-only snake-case version of field name, with all letters lowercase. (ex. id_field_1)"`
	Required            bool       `json:"required" description:"Whether a value must be specified for the field."`
	IgnoreForUniqueness bool       `` /* 139-byte string literal not displayed */
}

CompositeField represents the settings for a composite data type field

type CompositeValue added in v1.0.0

type CompositeValue map[string]interface{}

CompositeValue is a map of strings to value

type DataLifeCycleState added in v0.7.2

type DataLifeCycleState string

DataLifeCycleState identifies the life-cycle state for a piece of data - either live or soft-deleted.

const (
	DataLifeCycleStateDefault     DataLifeCycleState = ""
	DataLifeCycleStateLive        DataLifeCycleState = "live"
	DataLifeCycleStateSoftDeleted DataLifeCycleState = "softdeleted"

	// maps to softdeleted
	DataLifeCycleStatePostDelete DataLifeCycleState = "postdelete"

	// maps to live
	DataLifeCycleStatePreDelete DataLifeCycleState = "predelete"
)

Supported data life cycle states

func (DataLifeCycleState) Enum added in v1.1.0

func (t DataLifeCycleState) Enum() []interface{}

Enum implements Enum

func (DataLifeCycleState) GetConcrete added in v0.7.2

func (dlcs DataLifeCycleState) GetConcrete() DataLifeCycleState

GetConcrete returns the concrete data life cycle state for the given data life cycle state

func (DataLifeCycleState) GetDefaultRetentionTimeout added in v0.7.2

func (dlcs DataLifeCycleState) GetDefaultRetentionTimeout() time.Time

GetDefaultRetentionTimeout returns the default retention timeout for the data life cycle state

func (DataLifeCycleState) IsLive added in v0.7.2

func (dlcs DataLifeCycleState) IsLive() bool

IsLive return true if the concrete data life cycle state is live

func (DataLifeCycleState) MarshalText added in v1.1.0

func (t DataLifeCycleState) MarshalText() ([]byte, error)

MarshalText implements encoding.TextMarshaler (for JSON)

func (*DataLifeCycleState) UnmarshalText added in v1.1.0

func (t *DataLifeCycleState) UnmarshalText(b []byte) error

UnmarshalText implements encoding.TextMarshaler (for JSON)

func (*DataLifeCycleState) Validate added in v1.1.0

func (t *DataLifeCycleState) Validate() error

Validate implements Validateable

type Mutator added in v0.4.0

type Mutator struct {
	ID uuid.UUID `json:"id"`

	// Name of mutator, must be unique
	Name string `json:"name" validate:"length:1,128" required:"true"`

	// Description of the mutator
	Description string `json:"description"`

	// Version of the mutator
	Version int `json:"version"`

	// Configuration for which user records to modify
	SelectorConfig UserSelectorConfig `json:"selector_config" required:"true"`

	// The set of userstore columns to modify for each user record
	Columns []ColumnInputConfig `json:"columns" validate:"skip" required:"true"`

	// Policy for whether the data for each user record can be updated
	AccessPolicy ResourceID `json:"access_policy" validate:"skip" required:"true"`

	IsSystem bool `` /* 152-byte string literal not displayed */
}

Mutator represents a customer-defined scope and permissions policy for updating userstore data

type Purpose added in v0.6.4

type Purpose struct {
	ID          uuid.UUID `json:"id"`
	Name        string    `json:"name" validate:"length:1,128" required:"true"`
	Description string    `json:"description"`
	IsSystem    bool      `` /* 152-byte string literal not displayed */
}

Purpose represents a customer-defined purpose for userstore columns

type Record

type Record map[string]interface{}

Record is a single "row" of data containing 0 or more Columns from userstore's schema The key is the name of the column

func (Record) BoolValue added in v0.6.4

func (r Record) BoolValue(key string) bool

BoolValue returns a boolean value for the specified key

func (Record) StringValue added in v0.6.4

func (r Record) StringValue(key string) string

StringValue returns a string value for the specified key

func (Record) UUIDValue added in v0.6.4

func (r Record) UUIDValue(key string) uuid.UUID

UUIDValue returns a UUID value for the specified key

type ResourceID added in v0.6.4

type ResourceID struct {
	ID   uuid.UUID `json:"id"`
	Name string    `json:"name"`
}

ResourceID is a struct that contains a name and ID, only one of which is required to be set

func (ResourceID) EquivalentTo added in v1.2.0

func (r ResourceID) EquivalentTo(other ResourceID) bool

EquivalentTo returns true if the resources are compatible with each other

func (ResourceID) Validate added in v0.6.4

func (r ResourceID) Validate() error

Validate implements Validateable

type SQLShimDatabase added in v1.3.0

type SQLShimDatabase struct {
	ID       uuid.UUID `json:"id"`
	Name     string    `json:"name" validate:"notempty"`
	Type     string    `json:"type" validate:"notempty"`
	Host     string    `json:"host" validate:"notempty"`
	Port     int       `json:"port" validate:"notzero"`
	Schemas  []string  `json:"schemas"`
	Username string    `json:"username" validate:"notempty"`
	Password string    `json:"password" validate:"skip"`
}

SQLShimDatabase represents an external database that tenant customers can connect to via a SQLShim proxy

func (SQLShimDatabase) EqualsIgnoringNilIDSchemasAndPassword added in v1.6.0

func (s SQLShimDatabase) EqualsIgnoringNilIDSchemasAndPassword(other SQLShimDatabase) bool

EqualsIgnoringNilIDSchemasAndPassword returns true if the two columns are equal, ignoring ID if one is nil, and ignoring password and schemas field

type ShimObjectStore added in v1.6.0

type ShimObjectStore struct {
	ID              uuid.UUID  `json:"id"`
	Name            string     `json:"name" validate:"notempty"`
	Type            string     `json:"type" validate:"notempty"`
	Region          string     `json:"region" validate:"notempty"`
	AccessKeyID     string     `json:"access_key_id" validate:"skip"`
	SecretAccessKey string     `json:"secret_access_key" validate:"skip"`
	RoleARN         string     `json:"role_arn" validate:"skip"`
	AccessPolicy    ResourceID `json:"access_policy" validate:"skip"`
}

ShimObjectStore represents an external object store that tenant customers can connect to via a proxy

func (ShimObjectStore) EqualsIgnoringNilIDAndSecret added in v1.6.0

func (s ShimObjectStore) EqualsIgnoringNilIDAndSecret(other ShimObjectStore) bool

EqualsIgnoringNilIDAndSecret returns true if the two columns are equal, ignoring ID if one is nil, and ignoring secret access key

type UserSelectorConfig added in v0.5.0

type UserSelectorConfig struct {
	WhereClause string `json:"where_clause" validate:"notempty" example:"{id} = ANY (?)"`
}

UserSelectorConfig is the configuration for a UserSelector

func (UserSelectorConfig) MatchesAll added in v1.1.0

func (u UserSelectorConfig) MatchesAll() bool

MatchesAll returns true if the UserSelectorConfig is configured to match all users

type UserSelectorValues added in v0.5.0

type UserSelectorValues []interface{}

UserSelectorValues are the values passed for the UserSelector of an accessor or mutator

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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