Documentation
¶
Overview ¶
Package service encodes the business logic for dealing with data sources.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrDataSourceAlreadyExists = util.UserVisibleError(codes.AlreadyExists, "data source already exists")
ErrDataSourceAlreadyExists is returned when a data source already exists
Functions ¶
func NewDataSourceService ¶
NewDataSourceService creates a new data source service.
Types ¶
type DataSourceMetadata ¶ added in v0.1.1
type DataSourceMetadata struct {
Type string `json:"type"`
ProviderAuth bool `json:"providerAuth"`
}
DataSourceMetadata is used to serialize additional datasource-level fields
type DataSourcesService ¶
type DataSourcesService interface {
// GetByName returns a data source by name.
GetByName(ctx context.Context, name string, project uuid.UUID, opts *ReadOptions) (*minderv1.DataSource, error)
// GetByID returns a data source by ID.
GetByID(ctx context.Context, id uuid.UUID, project uuid.UUID, opts *ReadOptions) (*minderv1.DataSource, error)
// List lists all data sources in the given project.
List(ctx context.Context, project uuid.UUID, opts *ReadOptions) ([]*minderv1.DataSource, error)
// Create creates a new data source.
Create(
ctx context.Context,
projectID uuid.UUID,
subscriptionID uuid.UUID,
ds *minderv1.DataSource,
opts *Options,
) (*minderv1.DataSource, error)
// Update updates an existing data source.
Update(
ctx context.Context,
projectID uuid.UUID,
subscriptionID uuid.UUID,
ds *minderv1.DataSource,
opts *Options,
) (*minderv1.DataSource, error)
// Upsert creates a new data source if it does not exist or updates it if it already exists.
// This is used in the subscription logic.
Upsert(ctx context.Context, projectID uuid.UUID, subscriptionID uuid.UUID, ds *minderv1.DataSource, opts *Options) error
// Delete deletes a data source in the given project.
//
// Note that one cannot delete a data source that is in use by a rule type.
Delete(ctx context.Context, id uuid.UUID, project uuid.UUID, opts *Options) error
// BuildDataSourceRegistry bundles up all data sources referenced in the rule type
// into a registry.
BuildDataSourceRegistry(ctx context.Context, rt *minderv1.RuleType, opts *Options) (*v1datasources.DataSourceRegistry, error)
}
DataSourcesService is an interface that defines the methods for the data sources service.
type Options ¶
type Options struct {
// contains filtered or unexported fields
}
Options is a struct that contains the options for a service call
func OptionsBuilder ¶
func OptionsBuilder() *Options
OptionsBuilder is a function that returns a new Options struct
func (*Options) WithProvider ¶ added in v0.1.1
WithProvider is a function that sets the provider field in the Options struct
func (*Options) WithTransaction ¶
func (o *Options) WithTransaction(qtx db.ExtendQuerier) *Options
WithTransaction is a function that sets the transaction field in the Options struct
type ReadOptions ¶
type ReadOptions struct {
Options
// contains filtered or unexported fields
}
ReadOptions is a struct that contains the options for a read service call This extends the Options struct and adds a hierarchical field.
func ReadBuilder ¶
func ReadBuilder() *ReadOptions
ReadBuilder is a function that returns a new ReadOptions struct
func (*ReadOptions) Hierarchical ¶
func (o *ReadOptions) Hierarchical() *ReadOptions
Hierarchical allows the service to search in the project hierarchy
func (*ReadOptions) WithProvider ¶ added in v0.1.1
func (o *ReadOptions) WithProvider(provider provinfv1.Provider) *ReadOptions
WithProvider is a function that sets the provider field in the ReadOptions struct
func (*ReadOptions) WithTransaction ¶
func (o *ReadOptions) WithTransaction(qtx db.ExtendQuerier) *ReadOptions
WithTransaction is a function that sets the transaction field in the Options struct
Directories
¶
| Path | Synopsis |
|---|---|
|
Package mock_service is a generated GoMock package.
|
Package mock_service is a generated GoMock package. |
|
fixtures
Package fixtures contains code for creating DataSourceService fixtures and is used in various parts of the code.
|
Package fixtures contains code for creating DataSourceService fixtures and is used in various parts of the code. |