data_usage

package
v0.69.2 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2025 License: Apache-2.0 Imports: 20 Imported by: 5

Documentation

Index

Constants

View Source
const DataUsageSyncerName = "dataUsageSyncer"

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

Variables

View Source
var DataUsageSyncService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "data_usage.DataUsageSyncService",
	HandlerType: (*DataUsageSyncServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "CliVersionInformation",
			Handler:    _DataUsageSyncService_CliVersionInformation_Handler,
		},
		{
			MethodName: "SyncDataUsage",
			Handler:    _DataUsageSyncService_SyncDataUsage_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "data_usage/data_usage.proto",
}

DataUsageSyncService_ServiceDesc is the grpc.ServiceDesc for DataUsageSyncService 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_usage_data_usage_proto protoreflect.FileDescriptor
View Source
var MinimalCliVersion = semver.MustParse("0.33.0-0")

Functions

func ActionTypeStrings added in v0.66.0

func ActionTypeStrings() []string

ActionTypeStrings returns a slice of all String values of the enum

func RegisterDataUsageSyncServiceServer added in v0.32.0

func RegisterDataUsageSyncServiceServer(s grpc.ServiceRegistrar, srv DataUsageSyncServiceServer)

Types

type ActionType added in v0.66.0

type ActionType int
const (
	UnknownAction ActionType = iota
	Read
	Write
	Admin
)

func ActionTypeString added in v0.66.0

func ActionTypeString(s string) (ActionType, error)

ActionTypeString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.

func ActionTypeValues added in v0.66.0

func ActionTypeValues() []ActionType

ActionTypeValues returns all values of the enum

func (ActionType) IsAActionType added in v0.66.0

func (i ActionType) IsAActionType() bool

IsAActionType returns "true" if the value is listed in the enum definition. "false" otherwise

func (ActionType) MarshalJSON added in v0.66.0

func (i ActionType) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface for ActionType

func (ActionType) String added in v0.66.0

func (i ActionType) String() string

func (*ActionType) UnmarshalJSON added in v0.66.0

func (i *ActionType) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface for ActionType

type DataUsageFileCreator

type DataUsageFileCreator interface {
	AddStatements(statements []Statement) error
	Close()
	GetStatementCount() int
	GetImportFileSize() uint64
	GetActualFileNames() []string
}

DataUsageFileCreator describes the interface for easily creating the data usage import files to be exported from the Raito CLI.

func NewDataUsageFileCreator

func NewDataUsageFileCreator(config *DataUsageSyncConfig) (DataUsageFileCreator, error)

type DataUsageSyncConfig added in v0.15.0

type DataUsageSyncConfig 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"`
	MaxBytesPerFile uint64            `protobuf:"varint,3,opt,name=max_bytes_per_file,json=maxBytesPerFile,proto3" json:"max_bytes_per_file,omitempty"`
	// contains filtered or unexported fields
}

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

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

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

Deprecated: Use DataUsageSyncConfig.ProtoReflect.Descriptor instead.

func (*DataUsageSyncConfig) GetConfigMap added in v0.32.0

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

func (*DataUsageSyncConfig) GetMaxBytesPerFile added in v0.68.0

func (x *DataUsageSyncConfig) GetMaxBytesPerFile() uint64

func (*DataUsageSyncConfig) GetTargetFile added in v0.32.0

func (x *DataUsageSyncConfig) GetTargetFile() string

func (*DataUsageSyncConfig) ProtoMessage added in v0.32.0

func (*DataUsageSyncConfig) ProtoMessage()

func (*DataUsageSyncConfig) ProtoReflect added in v0.32.0

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

func (*DataUsageSyncConfig) Reset added in v0.32.0

func (x *DataUsageSyncConfig) Reset()

func (*DataUsageSyncConfig) String added in v0.32.0

func (x *DataUsageSyncConfig) String() string

type DataUsageSyncResult added in v0.15.0

type DataUsageSyncResult struct {

	// Deprecated: Marked as deprecated in data_usage/data_usage.proto.
	Error       *error1.ErrorResult `protobuf:"bytes,1,opt,name=error,proto3" json:"error,omitempty"`
	Statements  int32               `protobuf:"varint,2,opt,name=statements,proto3" json:"statements,omitempty"`
	TargetFiles []string            `protobuf:"bytes,3,rep,name=target_files,json=targetFiles,proto3" json:"target_files,omitempty"`
	// contains filtered or unexported fields
}

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

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

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

Deprecated: Use DataUsageSyncResult.ProtoReflect.Descriptor instead.

func (*DataUsageSyncResult) GetError deprecated added in v0.32.0

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

Deprecated: Marked as deprecated in data_usage/data_usage.proto.

func (*DataUsageSyncResult) GetStatements added in v0.37.0

func (x *DataUsageSyncResult) GetStatements() int32

func (*DataUsageSyncResult) GetTargetFiles added in v0.68.0

func (x *DataUsageSyncResult) GetTargetFiles() []string

func (*DataUsageSyncResult) ProtoMessage added in v0.32.0

func (*DataUsageSyncResult) ProtoMessage()

func (*DataUsageSyncResult) ProtoReflect added in v0.32.0

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

func (*DataUsageSyncResult) Reset added in v0.32.0

func (x *DataUsageSyncResult) Reset()

func (*DataUsageSyncResult) String added in v0.32.0

func (x *DataUsageSyncResult) String() string

type DataUsageSyncServiceClient added in v0.32.0

type DataUsageSyncServiceClient interface {
	CliVersionInformation(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*version.CliBuildInformation, error)
	SyncDataUsage(ctx context.Context, in *DataUsageSyncConfig, opts ...grpc.CallOption) (*DataUsageSyncResult, error)
}

DataUsageSyncServiceClient is the client API for DataUsageSyncService 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 NewDataUsageSyncServiceClient added in v0.32.0

func NewDataUsageSyncServiceClient(cc grpc.ClientConnInterface) DataUsageSyncServiceClient

type DataUsageSyncServiceServer added in v0.32.0

type DataUsageSyncServiceServer interface {
	CliVersionInformation(context.Context, *emptypb.Empty) (*version.CliBuildInformation, error)
	SyncDataUsage(context.Context, *DataUsageSyncConfig) (*DataUsageSyncResult, error)
	// contains filtered or unexported methods
}

DataUsageSyncServiceServer is the server API for DataUsageSyncService service. All implementations must embed UnimplementedDataUsageSyncServiceServer for forward compatibility

type DataUsageSyncer added in v0.15.0

type DataUsageSyncer interface {
	version.CliVersionHandler

	SyncDataUsage(ctx context.Context, config *DataUsageSyncConfig) (*DataUsageSyncResult, error)
}

DataUsageSyncer interface needs to be implemented by any plugin that wants to import data usage information into a Raito data source.

type DataUsageSyncerPlugin added in v0.15.0

type DataUsageSyncerPlugin struct {
	plugin.Plugin

	Impl DataUsageSyncer
}

DataUsageSyncerPlugin 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 (DataUsageSyncerPlugin) GRPCClient added in v0.32.0

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

func (*DataUsageSyncerPlugin) GRPCServer added in v0.32.0

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

type DataUsageSyncerVersionHandler added in v0.33.0

type DataUsageSyncerVersionHandler struct {
}

func (*DataUsageSyncerVersionHandler) CliVersionInformation added in v0.33.0

type Statement

type Statement struct {
	// ExternalId is the unique identifier for the statement
	ExternalId string `json:"externalId"`

	// AccessedDataObjects is a list of data objects that were accessed by the statement
	AccessedDataObjects []UsageDataObjectItem `json:"accessedDataObjects"`

	// User is the user email that executed the statement
	User string `json:"user,omitempty"`

	// Role is the role used to execute the statement (if applicable)
	Role string `json:"role,omitempty"`

	// Success indicates if the statement was successful
	Success bool `json:"success"`

	// Status is the raw status of the statement
	Status string `json:"status,omitempty"`

	// Query is the raw query that was executed
	Query string `json:"query"`

	// StartTime is the time the statement started executing
	StartTime int64 `json:"startTime,omitempty"`

	// EndTime is the time the statement finished executing
	EndTime int64 `json:"endTime,omitempty"`

	// Bytes is the number of bytes returned by the statement
	Bytes int `json:"bytes,omitempty"`

	// Rows is the number of rows returned by the statement
	Rows int `json:"rows,omitempty"`

	// Credits is the number of credits used by the statement
	Credits float32 `json:"credits,omitempty"`

	// Parsing information
	Error string `json:"error,omitempty"`
}

type UnimplementedDataUsageSyncServiceServer added in v0.32.0

type UnimplementedDataUsageSyncServiceServer struct {
}

UnimplementedDataUsageSyncServiceServer must be embedded to have forward compatible implementations.

func (UnimplementedDataUsageSyncServiceServer) CliVersionInformation added in v0.33.0

func (UnimplementedDataUsageSyncServiceServer) SyncDataUsage added in v0.32.0

type UnsafeDataUsageSyncServiceServer added in v0.32.0

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

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

type UsageDataObjectItem added in v0.66.0

type UsageDataObjectItem struct {
	// Permissions is a list of permissions that were used to access the data object
	Permissions []string `json:"permissions,omitempty"` // Deprecated: please use GlobalPermission instead

	// GlobalPermission is the global permission that was used to access the data object
	GlobalPermission ActionType `json:"globalPermission,omitempty"`

	// DataObject represents the data object that was accessed
	DataObject UsageDataObjectReference `json:"dataObject"`
}

type UsageDataObjectReference added in v0.66.0

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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