data_source

package
v0.33.0-dev0 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2023 License: Apache-2.0 Imports: 19 Imported by: 9

Documentation

Overview

Package data_source provides the tooling to build the Raito data source import file. Simply use the NewDataSourceFileCreator function by passing in the config coming from the CLI to create the necessary file(s). The returned DataSourceFileCreator can then be used (using the AddDataObjects function) to write DataObjects to the file. Make sure to call the Close function on the creator at the end (tip: use defer).

Index

Constants

View Source
const (
	/*
		Data Source features
	*/
	ColumnMasking   = "columnMasking"
	RowFiltering    = "rowFiltering"
	ColumnFiltering = "columnFiltering"

	/*
		The list of standard Data Object Types
	*/
	Datasource = "datasource"
	Database   = "database"
	Schema     = "schema"
	Table      = "table"
	View       = "view"
	Column     = "column"
	Dataset    = "dataset"
	Bucket     = "bucket"
	Object     = "object"
	Folder     = "folder"
	File       = "file"
)
View Source
const DataSourceSyncerName = "dataSourceSyncer"

DataSourceSyncerName constant should not be used directly when implementing plugins. It's the registration name for the data source syncer plugin, used by the CLI and the cli-plugin-base library (RegisterPlugins function) to register the plugins.

Variables

View Source
var DataSourceSyncService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "data_source.DataSourceSyncService",
	HandlerType: (*DataSourceSyncServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "CliVersionInformation",
			Handler:    _DataSourceSyncService_CliVersionInformation_Handler,
		},
		{
			MethodName: "SyncDataSource",
			Handler:    _DataSourceSyncService_SyncDataSource_Handler,
		},
		{
			MethodName: "GetDataSourceMetaData",
			Handler:    _DataSourceSyncService_GetDataSourceMetaData_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "data_source/data_source.proto",
}

DataSourceSyncService_ServiceDesc is the grpc.ServiceDesc for DataSourceSyncService service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

View Source
var File_data_source_data_source_proto protoreflect.FileDescriptor
View Source
var MinimalCliVersion = semver.MustParse("0.33.0-0")

Functions

func RegisterDataSourceSyncServiceServer added in v0.32.0

func RegisterDataSourceSyncServiceServer(s grpc.ServiceRegistrar, srv DataSourceSyncServiceServer)

Types

type DataObject

type DataObject struct {
	ExternalId       string                 `json:"externalId"`
	Name             string                 `json:"name"`
	FullName         string                 `json:"fullName"`
	Type             string                 `json:"type"`
	Description      string                 `json:"description"`
	ParentExternalId string                 `json:"parentExternalId"`
	Tags             map[string]interface{} `json:"tags"`
}

DataObject represents a data object in the format that is suitable to be imported into a Raito data source.

type DataObjectReference added in v0.6.0

type DataObjectReference struct {
	FullName string `json:"fullName" yaml:"fullName"`
	Type     string `json:"type" yaml:"type"`
}

DataObjectReference represents the reference to a DataObject suitable for e.g. defining the What in Access Provider import

type DataObjectType added in v0.15.0

type DataObjectType struct {
	Name        string                      `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	Type        string                      `protobuf:"bytes,2,opt,name=type,proto3" json:"type,omitempty"`
	Label       string                      `protobuf:"bytes,3,opt,name=label,proto3" json:"label,omitempty"`
	Icon        string                      `protobuf:"bytes,4,opt,name=icon,proto3" json:"icon,omitempty"`
	Permissions []*DataObjectTypePermission `protobuf:"bytes,5,rep,name=permissions,proto3" json:"permissions,omitempty"`
	Children    []string                    `protobuf:"bytes,6,rep,name=children,proto3" json:"children,omitempty"`
	// contains filtered or unexported fields
}

func (*DataObjectType) Descriptor deprecated added in v0.32.0

func (*DataObjectType) Descriptor() ([]byte, []int)

Deprecated: Use DataObjectType.ProtoReflect.Descriptor instead.

func (*DataObjectType) GetChildren added in v0.32.0

func (x *DataObjectType) GetChildren() []string

func (*DataObjectType) GetIcon added in v0.32.0

func (x *DataObjectType) GetIcon() string

func (*DataObjectType) GetLabel added in v0.32.0

func (x *DataObjectType) GetLabel() string

func (*DataObjectType) GetName added in v0.32.0

func (x *DataObjectType) GetName() string

func (*DataObjectType) GetPermissions added in v0.32.0

func (x *DataObjectType) GetPermissions() []*DataObjectTypePermission

func (*DataObjectType) GetType added in v0.32.0

func (x *DataObjectType) GetType() string

func (*DataObjectType) ProtoMessage added in v0.32.0

func (*DataObjectType) ProtoMessage()

func (*DataObjectType) ProtoReflect added in v0.32.0

func (x *DataObjectType) ProtoReflect() protoreflect.Message

func (*DataObjectType) Reset added in v0.32.0

func (x *DataObjectType) Reset()

func (*DataObjectType) String added in v0.32.0

func (x *DataObjectType) String() string

type DataObjectTypePermission added in v0.15.0

type DataObjectTypePermission struct {
	Permission        string   `protobuf:"bytes,1,opt,name=permission,proto3" json:"permission,omitempty"`
	GlobalPermissions []string `protobuf:"bytes,2,rep,name=globalPermissions,proto3" json:"globalPermissions,omitempty"`
	Description       string   `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"`
	Action            []string `protobuf:"bytes,4,rep,name=action,proto3" json:"action,omitempty"`
	// contains filtered or unexported fields
}

NoLinting ToSupport GQL schema (temporarily)

func (*DataObjectTypePermission) Descriptor deprecated added in v0.32.0

func (*DataObjectTypePermission) Descriptor() ([]byte, []int)

Deprecated: Use DataObjectTypePermission.ProtoReflect.Descriptor instead.

func (*DataObjectTypePermission) GetAction added in v0.32.0

func (x *DataObjectTypePermission) GetAction() []string

func (*DataObjectTypePermission) GetDescription added in v0.32.0

func (x *DataObjectTypePermission) GetDescription() string

func (*DataObjectTypePermission) GetGlobalPermissions added in v0.32.0

func (x *DataObjectTypePermission) GetGlobalPermissions() []string

func (*DataObjectTypePermission) GetPermission added in v0.32.0

func (x *DataObjectTypePermission) GetPermission() string

func (*DataObjectTypePermission) ProtoMessage added in v0.32.0

func (*DataObjectTypePermission) ProtoMessage()

func (*DataObjectTypePermission) ProtoReflect added in v0.32.0

func (x *DataObjectTypePermission) ProtoReflect() protoreflect.Message

func (*DataObjectTypePermission) Reset added in v0.32.0

func (x *DataObjectTypePermission) Reset()

func (*DataObjectTypePermission) String added in v0.32.0

func (x *DataObjectTypePermission) String() string

type DataSourceDetails added in v0.12.0

type DataSourceDetails struct {
	// contains filtered or unexported fields
}

DataSourceDetails is a helper to abstract this from the plugin and just expose some setters. The import file creator then automatically prepends the import file with this DataObject

func (*DataSourceDetails) SetDescription added in v0.12.0

func (d *DataSourceDetails) SetDescription(desc string)

func (*DataSourceDetails) SetFullname added in v0.12.0

func (d *DataSourceDetails) SetFullname(name string)

func (*DataSourceDetails) SetName added in v0.12.0

func (d *DataSourceDetails) SetName(name string)

type DataSourceFileCreator

type DataSourceFileCreator interface {
	AddDataObjects(dataObjects ...*DataObject) error
	SetDataSourceName(name string)
	SetDataSourceFullname(name string)
	SetDataSourceDescription(desc string)
	Close()
	GetDataObjectCount() int
	GetDataSourceDetails() *DataSourceDetails
}

DataSourceFileCreator describes the interface for easily creating the data object import files to be imported by the Raito CLI. Use GetDataSourceDetails() to access DataSourceDetails setters like SetAvailablePermission()

func NewDataSourceFileCreator

func NewDataSourceFileCreator(config *DataSourceSyncConfig) (DataSourceFileCreator, error)

NewDataSourceFileCreator creates a new DataSourceFileCreator based on the configuration coming from the Raito CLI.

type DataSourceSyncConfig added in v0.15.0

type DataSourceSyncConfig struct {
	ConfigMap    *config.ConfigMap `protobuf:"bytes,1,opt,name=config_map,json=configMap,proto3" json:"config_map,omitempty"`
	TargetFile   string            `protobuf:"bytes,2,opt,name=target_file,json=targetFile,proto3" json:"target_file,omitempty"`
	DataSourceId string            `protobuf:"bytes,3,opt,name=data_source_id,json=dataSourceId,proto3" json:"data_source_id,omitempty"`
	// contains filtered or unexported fields
}

DataSourceSyncConfig represents the configuration that is passed from the CLI to the DataAccessSyncer plugin interface. It contains all the necessary configuration parameters for the plugin to function.

func (*DataSourceSyncConfig) Descriptor deprecated added in v0.32.0

func (*DataSourceSyncConfig) Descriptor() ([]byte, []int)

Deprecated: Use DataSourceSyncConfig.ProtoReflect.Descriptor instead.

func (*DataSourceSyncConfig) GetConfigMap added in v0.32.0

func (x *DataSourceSyncConfig) GetConfigMap() *config.ConfigMap

func (*DataSourceSyncConfig) GetDataSourceId added in v0.32.0

func (x *DataSourceSyncConfig) GetDataSourceId() string

func (*DataSourceSyncConfig) GetTargetFile added in v0.32.0

func (x *DataSourceSyncConfig) GetTargetFile() string

func (*DataSourceSyncConfig) ProtoMessage added in v0.32.0

func (*DataSourceSyncConfig) ProtoMessage()

func (*DataSourceSyncConfig) ProtoReflect added in v0.32.0

func (x *DataSourceSyncConfig) ProtoReflect() protoreflect.Message

func (*DataSourceSyncConfig) Reset added in v0.32.0

func (x *DataSourceSyncConfig) Reset()

func (*DataSourceSyncConfig) String added in v0.32.0

func (x *DataSourceSyncConfig) String() string

type DataSourceSyncResult added in v0.15.0

type DataSourceSyncResult struct {
	Error *error1.ErrorResult `protobuf:"bytes,1,opt,name=error,proto3" json:"error,omitempty"`
	// contains filtered or unexported fields
}

DataSourceSyncResult represents the result from the data source sync process. A potential error is also modeled in here so specific errors remain intact when passed over RPC.

func (*DataSourceSyncResult) Descriptor deprecated added in v0.32.0

func (*DataSourceSyncResult) Descriptor() ([]byte, []int)

Deprecated: Use DataSourceSyncResult.ProtoReflect.Descriptor instead.

func (*DataSourceSyncResult) GetError added in v0.32.0

func (x *DataSourceSyncResult) GetError() *error1.ErrorResult

func (*DataSourceSyncResult) ProtoMessage added in v0.32.0

func (*DataSourceSyncResult) ProtoMessage()

func (*DataSourceSyncResult) ProtoReflect added in v0.32.0

func (x *DataSourceSyncResult) ProtoReflect() protoreflect.Message

func (*DataSourceSyncResult) Reset added in v0.32.0

func (x *DataSourceSyncResult) Reset()

func (*DataSourceSyncResult) String added in v0.32.0

func (x *DataSourceSyncResult) String() string

type DataSourceSyncServiceClient added in v0.32.0

type DataSourceSyncServiceClient interface {
	CliVersionInformation(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*version.CliBuildInformation, error)
	SyncDataSource(ctx context.Context, in *DataSourceSyncConfig, opts ...grpc.CallOption) (*DataSourceSyncResult, error)
	GetDataSourceMetaData(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*MetaData, error)
}

DataSourceSyncServiceClient is the client API for DataSourceSyncService service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.

func NewDataSourceSyncServiceClient added in v0.32.0

func NewDataSourceSyncServiceClient(cc grpc.ClientConnInterface) DataSourceSyncServiceClient

type DataSourceSyncServiceServer added in v0.32.0

type DataSourceSyncServiceServer interface {
	CliVersionInformation(context.Context, *emptypb.Empty) (*version.CliBuildInformation, error)
	SyncDataSource(context.Context, *DataSourceSyncConfig) (*DataSourceSyncResult, error)
	GetDataSourceMetaData(context.Context, *emptypb.Empty) (*MetaData, error)
	// contains filtered or unexported methods
}

DataSourceSyncServiceServer is the server API for DataSourceSyncService service. All implementations must embed UnimplementedDataSourceSyncServiceServer for forward compatibility

type DataSourceSyncer added in v0.15.0

type DataSourceSyncer interface {
	version.CliVersionHandler

	SyncDataSource(ctx context.Context, config *DataSourceSyncConfig) (*DataSourceSyncResult, error)
	GetDataSourceMetaData(ctx context.Context) (*MetaData, error)
}

DataSourceSyncer interface needs to be implemented by any plugin that wants to import data objects into a Raito data source.

type DataSourceSyncerPlugin added in v0.15.0

type DataSourceSyncerPlugin struct {
	plugin.Plugin

	Impl DataSourceSyncer
}

DataSourceSyncerPlugin is used on the server (CLI) and client (plugin) side to integrate with the plugin system. A plugin should not be using this directly, but instead depend on the cli-plugin-base library to register the plugins.

func (DataSourceSyncerPlugin) GRPCClient added in v0.32.0

func (DataSourceSyncerPlugin) GRPCClient(ctx context.Context, broker *plugin.GRPCBroker, c *grpc.ClientConn) (interface{}, error)

func (*DataSourceSyncerPlugin) GRPCServer added in v0.32.0

func (p *DataSourceSyncerPlugin) GRPCServer(broker *plugin.GRPCBroker, s *grpc.Server) error

type DataSourceSyncerVersionHandler added in v0.33.0

type DataSourceSyncerVersionHandler struct {
}

func (*DataSourceSyncerVersionHandler) CliVersionInformation added in v0.33.0

type GlobalPermission added in v0.31.0

type GlobalPermission string

type GlobalPermissionSet added in v0.31.0

type GlobalPermissionSet map[GlobalPermission]struct{}

func CreateGlobalPermissionSet added in v0.31.0

func CreateGlobalPermissionSet(permissions ...GlobalPermission) GlobalPermissionSet

func DeleteGlobalPermission added in v0.31.0

func DeleteGlobalPermission() GlobalPermissionSet

DeleteGlobalPermission Get all rights to delete data and the table

func InsertGlobalPermission added in v0.31.0

func InsertGlobalPermission() GlobalPermissionSet

InsertGlobalPermission Get rights to add data

func JoinGlobalPermissionsSets added in v0.31.0

func JoinGlobalPermissionsSets(sets ...GlobalPermissionSet) GlobalPermissionSet

func ReadGlobalPermission added in v0.31.0

func ReadGlobalPermission() GlobalPermissionSet

ReadGlobalPermission Get access to read the data

func UpdateGlobalPermission added in v0.31.0

func UpdateGlobalPermission() GlobalPermissionSet

UpdateGlobalPermission Get rights to modify data, not to delete a row

func WriteGlobalPermission added in v0.31.0

func WriteGlobalPermission() GlobalPermissionSet

WriteGlobalPermission Get all rights to (over)write data

func (GlobalPermissionSet) Append added in v0.31.0

func (s GlobalPermissionSet) Append(permission ...GlobalPermission)

func (GlobalPermissionSet) MarshalJSON added in v0.31.0

func (s GlobalPermissionSet) MarshalJSON() ([]byte, error)

func (GlobalPermissionSet) StringValues added in v0.32.0

func (s GlobalPermissionSet) StringValues() []string

func (*GlobalPermissionSet) UnmarshalJSON added in v0.31.0

func (s *GlobalPermissionSet) UnmarshalJSON(data []byte) error

func (GlobalPermissionSet) Values added in v0.31.0

type MetaData added in v0.15.0

type MetaData struct {
	DataObjectTypes   []*DataObjectType `protobuf:"bytes,1,rep,name=dataObjectTypes,proto3" json:"dataObjectTypes,omitempty"`
	SupportedFeatures []string          `protobuf:"bytes,2,rep,name=supportedFeatures,proto3" json:"supportedFeatures,omitempty"`
	Type              string            `protobuf:"bytes,3,opt,name=type,proto3" json:"type,omitempty"`
	Icon              string            `protobuf:"bytes,4,opt,name=icon,proto3" json:"icon,omitempty"`
	// contains filtered or unexported fields
}

NoLinting ToSupport GQL schema (temporarily)

func (*MetaData) Descriptor deprecated added in v0.32.0

func (*MetaData) Descriptor() ([]byte, []int)

Deprecated: Use MetaData.ProtoReflect.Descriptor instead.

func (*MetaData) GetDataObjectTypes added in v0.32.0

func (x *MetaData) GetDataObjectTypes() []*DataObjectType

func (*MetaData) GetIcon added in v0.32.0

func (x *MetaData) GetIcon() string

func (*MetaData) GetSupportedFeatures added in v0.32.0

func (x *MetaData) GetSupportedFeatures() []string

func (*MetaData) GetType added in v0.32.0

func (x *MetaData) GetType() string

func (*MetaData) ProtoMessage added in v0.32.0

func (*MetaData) ProtoMessage()

func (*MetaData) ProtoReflect added in v0.32.0

func (x *MetaData) ProtoReflect() protoreflect.Message

func (*MetaData) Reset added in v0.32.0

func (x *MetaData) Reset()

func (*MetaData) String added in v0.32.0

func (x *MetaData) String() string

type UnimplementedDataSourceSyncServiceServer added in v0.32.0

type UnimplementedDataSourceSyncServiceServer struct {
}

UnimplementedDataSourceSyncServiceServer must be embedded to have forward compatible implementations.

func (UnimplementedDataSourceSyncServiceServer) CliVersionInformation added in v0.33.0

func (UnimplementedDataSourceSyncServiceServer) GetDataSourceMetaData added in v0.32.0

func (UnimplementedDataSourceSyncServiceServer) SyncDataSource added in v0.32.0

type UnsafeDataSourceSyncServiceServer added in v0.32.0

type UnsafeDataSourceSyncServiceServer interface {
	// contains filtered or unexported methods
}

UnsafeDataSourceSyncServiceServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to DataSourceSyncServiceServer will result in compilation errors.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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