service

package
v0.0.0-...-5597880 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SubjectTypeUser           string = "user"
	SubjectTypeGroup          string = "group"
	SubjectTypeServiceAccount string = "serviceAccount"
)
View Source
const (
	MappingServiceMetabase string = "metabase"
)
View Source
const (
	MetabaseRestrictedCollectionTag = "🔐"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Access

type Access struct {
	ID              uuid.UUID  `json:"id"`
	Subject         string     `json:"subject"`
	Owner           string     `json:"owner"`
	Granter         string     `json:"granter"`
	Expires         *time.Time `json:"expires"`
	Created         time.Time  `json:"created"`
	Revoked         *time.Time `json:"revoked"`
	DatasetID       uuid.UUID  `json:"datasetID"`
	AccessRequestID *uuid.UUID `json:"accessRequestID"`
}

type AccessRequest

type AccessRequest struct {
	ID          uuid.UUID           `json:"id"`
	DatasetID   uuid.UUID           `json:"datasetID"`
	Subject     string              `json:"subject"`
	SubjectType string              `json:"subjectType"`
	Created     time.Time           `json:"created"`
	Status      AccessRequestStatus `json:"status"`
	Closed      *time.Time          `json:"closed"`
	Expires     *time.Time          `json:"expires"`
	Granter     *string             `json:"granter"`
	Owner       string              `json:"owner"`
	Polly       *Polly              `json:"polly"`
	Reason      *string             `json:"reason"`
}

type AccessRequestForGranter

type AccessRequestForGranter struct {
	AccessRequest
	DataproductID   uuid.UUID `json:"dataproductID"`
	DataproductSlug string    `json:"dataproductSlug"`
	DatasetName     string    `json:"datasetName"`
	DataproductName string    `json:"dataproductName"`
}

type AccessRequestStatus

type AccessRequestStatus string
const (
	AccessRequestStatusPending  AccessRequestStatus = "pending"
	AccessRequestStatusApproved AccessRequestStatus = "approved"
	AccessRequestStatusDenied   AccessRequestStatus = "denied"
)

type AccessRequestsWrapper

type AccessRequestsWrapper struct {
	AccessRequests []*AccessRequest `json:"accessRequests"`
}

type AccessService

type AccessService interface {
	GetAccessRequests(ctx context.Context, datasetID uuid.UUID) (*AccessRequestsWrapper, error)
	CreateAccessRequest(ctx context.Context, user *User, input NewAccessRequestDTO) error
	DeleteAccessRequest(ctx context.Context, user *User, accessRequestID uuid.UUID) error
	UpdateAccessRequest(ctx context.Context, input UpdateAccessRequestDTO) error
	ApproveAccessRequest(ctx context.Context, user *User, accessRequestID uuid.UUID) error
	DenyAccessRequest(ctx context.Context, user *User, accessRequestID uuid.UUID, reason *string) error
	RevokeAccessToDataset(ctx context.Context, user *User, id uuid.UUID, gcpProjectID string) error
	GrantAccessToDataset(ctx context.Context, user *User, input GrantAccessData, gcpProjectID string) error
}

type AccessStorage

type AccessStorage interface {
	CreateAccessRequestForDataset(ctx context.Context, datasetID uuid.UUID, pollyDocumentationID uuid.NullUUID, subject, owner string, expires *time.Time) (*AccessRequest, error)
	DeleteAccessRequest(ctx context.Context, accessRequestID uuid.UUID) error
	DenyAccessRequest(ctx context.Context, user *User, accessRequestID uuid.UUID, reason *string) error
	GetAccessRequest(ctx context.Context, accessRequestID uuid.UUID) (*AccessRequest, error)
	GetAccessToDataset(ctx context.Context, id uuid.UUID) (*Access, error)
	GetUnrevokedExpiredAccess(ctx context.Context) ([]*Access, error)
	GrantAccessToDatasetAndApproveRequest(ctx context.Context, user *User, datasetID uuid.UUID, subject, accessRequestOwner string, accessRequestID uuid.UUID, expires *time.Time) error
	GrantAccessToDatasetAndRenew(ctx context.Context, datasetID uuid.UUID, expires *time.Time, subject, owner, granter string) error
	ListAccessRequestsForDataset(ctx context.Context, datasetID uuid.UUID) ([]*AccessRequest, error)
	ListAccessRequestsForOwner(ctx context.Context, owner []string) ([]*AccessRequest, error)
	ListActiveAccessToDataset(ctx context.Context, datasetID uuid.UUID) ([]*Access, error)
	RevokeAccessToDataset(ctx context.Context, id uuid.UUID) error
	UpdateAccessRequest(ctx context.Context, input UpdateAccessRequestDTO) error
}

type AccessibleDataset

type AccessibleDataset struct {
	Dataset
	DataproductName string  `json:"dataproductName"`
	Slug            string  `json:"slug"`
	DpSlug          string  `json:"dpSlug"`
	Group           string  `json:"group"`
	Subject         *string `json:"subject"`
}

type AccessibleDatasets

type AccessibleDatasets struct {
	// owned
	Owned []*AccessibleDataset `json:"owned"`
	// granted
	Granted []*AccessibleDataset `json:"granted"`
	// service account granted
	ServiceAccountGranted []*AccessibleDataset `json:"serviceAccountGranted"`
}

type Attributes

type Attributes struct {
	ContentType     string
	ContentEncoding string
	Size            int64
	SizeStr         string
}

type BQColumns

type BQColumns struct {
	BQColumns []*BigqueryColumn `json:"bqColumns"`
}

type BQDatasets

type BQDatasets struct {
	BQDatasets []string `json:"bqDatasets"`
}

type BQTables

type BQTables struct {
	BQTables []*BigQueryTable `json:"bqTables"`
}

type BigQuery

type BigQuery struct {
	ID            uuid.UUID
	DatasetID     uuid.UUID
	ProjectID     string            `json:"projectID"`
	Dataset       string            `json:"dataset"`
	Table         string            `json:"table"`
	TableType     BigQueryTableType `json:"tableType"`
	LastModified  time.Time         `json:"lastModified"`
	Created       time.Time         `json:"created"`
	Expires       *time.Time        `json:"expired"`
	Description   string            `json:"description"`
	PiiTags       *string           `json:"piiTags"`
	MissingSince  *time.Time        `json:"missingSince"`
	PseudoColumns []string          `json:"pseudoColumns"`
	Schema        []*BigqueryColumn `json:"schema"`
}

type BigQueryAPI

type BigQueryAPI interface {
	Grant(ctx context.Context, projectID, datasetID, tableID, member string) error
	Revoke(ctx context.Context, projectID, datasetID, tableID, member string) error
	AddToAuthorizedViews(ctx context.Context, srcProjectID, srcDataset, sinkProjectID, sinkDataset, sinkTable string) error
	MakeBigQueryUrlForJoinableViews(name, projectID, datasetID, tableID string) string
	CreateJoinableViewsForUser(ctx context.Context, name string, datasources []JoinableViewDatasource) (string, string, map[string]string, error)
	CreateJoinableView(ctx context.Context, joinableDatasetID string, datasource JoinableViewDatasource) (string, error)
	ComposeJoinableViewQuery(plainTable DatasourceForJoinableView, joinableDatasetID string) string
	TableMetadata(ctx context.Context, projectID string, datasetID string, tableID string) (BigqueryMetadata, error)
	GetTables(ctx context.Context, projectID, datasetID string) ([]*BigQueryTable, error)
	GetDatasets(ctx context.Context, projectID string) ([]string, error)
	CreatePseudonymisedView(ctx context.Context, projectID, datasetID, tableID string, piiColumns []string) (string, string, string, error)
	DeleteJoinableView(ctx context.Context, joinableViewName, refProjectID, refDatasetID, refTableID string) error
	DeletePseudoView(ctx context.Context, pseudoProjectID, pseudoDatasetID, pseudoTableID string) error
	DeleteJoinableDataset(ctx context.Context, datasetID string) error
}

type BigQueryDataSourceUpdate

type BigQueryDataSourceUpdate struct {
	PiiTags       *string
	PseudoColumns []string
	DatasetID     uuid.UUID
}

type BigQueryService

type BigQueryService interface {
	SyncBigQueryTables(ctx context.Context) error
	UpdateMetadata(ctx context.Context, ds *BigQuery) error
	GetBigQueryTables(ctx context.Context, projectID string, datasetID string) (*BQTables, error)
	GetBigQueryDatasets(ctx context.Context, projectID string) (*BQDatasets, error)
	GetBigQueryColumns(ctx context.Context, projectID string, datasetID string, tableID string) (*BQColumns, error)
}

type BigQueryStorage

type BigQueryStorage interface {
	GetBigqueryDatasource(ctx context.Context, datasetID uuid.UUID, isReference bool) (*BigQuery, error)
	GetBigqueryDatasources(ctx context.Context) ([]*BigQuery, error)
	UpdateBigqueryDatasourceSchema(ctx context.Context, datasetID uuid.UUID, meta BigqueryMetadata) error
	UpdateBigqueryDatasourceMissing(ctx context.Context, datasetID uuid.UUID) error
	UpdateBigqueryDatasource(ctx context.Context, input BigQueryDataSourceUpdate) error
	GetPseudoDatasourcesToDelete(ctx context.Context) ([]*BigQuery, error)
}

type BigQueryTable

type BigQueryTable struct {
	Description  string            `json:"description"`
	LastModified time.Time         `json:"lastModified"`
	Name         string            `json:"name"`
	Type         BigQueryTableType `json:"type"`
}

type BigQueryTableType

type BigQueryTableType string
const (
	// RegularTable is a regular table.
	RegularTable BigQueryTableType = "TABLE"
	// ViewTable is a table type describing that the table is a logical view.
	// See more information at https://cloud.google.com//docs/views.
	ViewTable BigQueryTableType = "VIEW"
	// ExternalTable is a table type describing that the table is an external
	// table (also known as a federated data source). See more information at
	// https://cloud.google.com/bigquery/external-data-sources.
	ExternalTable BigQueryTableType = "EXTERNAL"
	// MaterializedView represents a managed storage table that's derived from
	// a base table.
	MaterializedView BigQueryTableType = "MATERIALIZED_VIEW"
	// Snapshot represents an immutable point in time snapshot of some other
	// table.
	Snapshot BigQueryTableType = "SNAPSHOT"
)

type BigqueryColumn

type BigqueryColumn struct {
	Name        string `json:"name"`
	Type        string `json:"type"`
	Mode        string `json:"mode"`
	Description string `json:"description"`
}

type BigqueryMetadata

type BigqueryMetadata struct {
	Schema       BigquerySchema    `json:"schema"`
	TableType    BigQueryTableType `json:"tableType"`
	LastModified time.Time         `json:"lastModified"`
	Created      time.Time         `json:"created"`
	Expires      time.Time         `json:"expires"`
	Description  string            `json:"description"`
}

type BigquerySchema

type BigquerySchema struct {
	Columns []*BigqueryColumn
}

type Binding

type Binding struct {
	Role    string
	Members []string
}

func (Binding) Validate

func (b Binding) Validate() error

type Dashboard

type Dashboard struct {
	ID  uuid.UUID
	Url string
}

type DataProductsService

type DataProductsService interface {
	CreateDataproduct(ctx context.Context, user *User, input NewDataproduct) (*DataproductMinimal, error)
	UpdateDataproduct(ctx context.Context, user *User, id uuid.UUID, input UpdateDataproductDto) (*DataproductMinimal, error)
	DeleteDataproduct(ctx context.Context, user *User, id uuid.UUID) (*DataproductWithDataset, error)
	CreateDataset(ctx context.Context, user *User, input NewDataset) (*Dataset, error)
	DeleteDataset(ctx context.Context, user *User, id uuid.UUID) (string, error)
	UpdateDataset(ctx context.Context, user *User, id uuid.UUID, input UpdateDatasetDto) (string, error)
	GetDataset(ctx context.Context, id uuid.UUID) (*Dataset, error)
	GetAccessiblePseudoDatasetsForUser(ctx context.Context, user *User) ([]*PseudoDataset, error)
	GetDatasetsMinimal(ctx context.Context) ([]*DatasetMinimal, error)
	GetDataproduct(ctx context.Context, id uuid.UUID) (*DataproductWithDataset, error)
}

type DataProductsStorage

type DataProductsStorage interface {
	CreateDataproduct(ctx context.Context, input NewDataproduct) (*DataproductMinimal, error)
	CreateDataset(ctx context.Context, ds NewDataset, referenceDatasource *NewBigQuery, user *User) (*Dataset, error)
	DeleteDataproduct(ctx context.Context, id uuid.UUID) error
	DeleteDataset(ctx context.Context, id uuid.UUID) error
	GetAccessibleDatasets(ctx context.Context, userGroups []string, requester string) (owned []*AccessibleDataset, granted []*AccessibleDataset, serviceAccountGranted []*AccessibleDataset, err error)
	GetAccessiblePseudoDatasourcesByUser(ctx context.Context, subjectsAsOwner []string, subjectsAsAccesser []string) ([]*PseudoDataset, error)
	GetDataproduct(ctx context.Context, id uuid.UUID) (*DataproductWithDataset, error)
	GetDataproductKeywords(ctx context.Context, dpid uuid.UUID) ([]string, error)
	GetDataproducts(ctx context.Context, ids []uuid.UUID) ([]DataproductWithDataset, error)
	GetDataproductsByTeamID(ctx context.Context, teamIDs []uuid.UUID) ([]*Dataproduct, error)
	GetDataproductsNumberByTeam(ctx context.Context, teamID uuid.UUID) (int64, error)
	GetDataproductsWithDatasetsAndAccessRequests(ctx context.Context, ids []uuid.UUID, groups []string) ([]DataproductWithDataset, []AccessRequestForGranter, error)
	GetDataset(ctx context.Context, id uuid.UUID) (*Dataset, error)
	GetDatasetsMinimal(ctx context.Context) ([]*DatasetMinimal, error)
	GetOwnerGroupOfDataset(ctx context.Context, datasetID uuid.UUID) (string, error)
	SetDatasourceDeleted(ctx context.Context, id uuid.UUID) error
	UpdateDataproduct(ctx context.Context, id uuid.UUID, input UpdateDataproductDto) (*DataproductMinimal, error)
	UpdateDataset(ctx context.Context, id uuid.UUID, input UpdateDatasetDto) (string, error)
}

type Dataproduct

type Dataproduct struct {
	ID              uuid.UUID         `json:"id"`
	Name            string            `json:"name"`
	Created         time.Time         `json:"created"`
	LastModified    time.Time         `json:"lastModified"`
	Description     *string           `json:"description"`
	Slug            string            `json:"slug"`
	Owner           *DataproductOwner `json:"owner"`
	Keywords        []string          `json:"keywords"`
	TeamName        *string           `json:"teamName"`
	ProductAreaName string            `json:"productAreaName"`
}

type DataproductMinimal

type DataproductMinimal struct {
	ID           uuid.UUID         `json:"id"`
	Name         string            `json:"name"`
	Created      time.Time         `json:"created"`
	LastModified time.Time         `json:"lastModified"`
	Description  *string           `json:"description"`
	Slug         string            `json:"slug"`
	Owner        *DataproductOwner `json:"owner"`
}

type DataproductOwner

type DataproductOwner struct {
	Group            string     `json:"group"`
	TeamkatalogenURL *string    `json:"teamkatalogenURL"`
	TeamContact      *string    `json:"teamContact"`
	TeamID           *uuid.UUID `json:"teamID"`
	ProductAreaID    *uuid.UUID `json:"productAreaID"`
}

type DataproductWithDataset

type DataproductWithDataset struct {
	Dataproduct
	Datasets []*DatasetInDataproduct `json:"datasets"`
}

func (DataproductWithDataset) IsSearchResult

func (DataproductWithDataset) IsSearchResult()

type Dataset

type Dataset struct {
	ID                       uuid.UUID  `json:"id"`
	DataproductID            uuid.UUID  `json:"dataproductID"`
	Name                     string     `json:"name"`
	Created                  time.Time  `json:"created"`
	LastModified             time.Time  `json:"lastModified"`
	Description              *string    `json:"description"`
	Slug                     string     `json:"slug"`
	Repo                     *string    `json:"repo"`
	Pii                      PiiLevel   `json:"pii"`
	Keywords                 []string   `json:"keywords"`
	AnonymisationDescription *string    `json:"anonymisationDescription"`
	TargetUser               *string    `json:"targetUser"`
	Access                   []*Access  `json:"access"`
	Mappings                 []string   `json:"mappings"`
	Datasource               *BigQuery  `json:"datasource"`
	MetabaseUrl              *string    `json:"metabaseUrl"`
	MetabaseDeletedAt        *time.Time `json:"metabaseDeletedAt"`
}

func (Dataset) IsSearchResult

func (Dataset) IsSearchResult()

type DatasetInDataproduct

type DatasetInDataproduct struct {
	ID                     uuid.UUID `json:"id"`
	DataproductID          uuid.UUID `json:"-"`
	Name                   string    `json:"name"`
	Created                time.Time `json:"created"`
	LastModified           time.Time `json:"lastModified"`
	Description            *string   `json:"description"`
	Slug                   string    `json:"slug"`
	Keywords               []string  `json:"keywords"`
	DataSourceLastModified time.Time `json:"dataSourceLastModified"`
}

type DatasetMap

type DatasetMap struct {
	Services []string `json:"services"`
}

type DatasetMinimal

type DatasetMinimal struct {
	ID              uuid.UUID `json:"id"`
	Name            string    `json:"name"`
	Created         time.Time `json:"created"`
	BigQueryProject string    `json:"project"`
	BigQueryDataset string    `json:"dataset"`
	BigQueryTable   string    `json:"table"`
}

type DatasourceForJoinableView

type DatasourceForJoinableView struct {
	Project       string
	Dataset       string
	Table         string
	PseudoColumns []string
}

type DatasourceType

type DatasourceType string

type GCPProject

type GCPProject struct {
	ID    string `json:"id"`
	Name  string `json:"name"`
	Group *Group `json:"group"`
}

type GrantAccessData

type GrantAccessData struct {
	DatasetID   uuid.UUID  `json:"datasetID"`
	Expires     *time.Time `json:"expires"`
	Subject     *string    `json:"subject"`
	Owner       *string    `json:"owner"`
	SubjectType *string    `json:"subjectType"`
}

type Group

type Group struct {
	Name  string `json:"name"`
	Email string `json:"email"`
}

type Groups

type Groups []Group

func (Groups) Contains

func (g Groups) Contains(email string) bool

func (Groups) Emails

func (g Groups) Emails() []string

func (Groups) Get

func (g Groups) Get(email string) (Group, bool)

func (Groups) Names

func (g Groups) Names() []string

type InsightProduct

type InsightProduct struct {
	// id of the insight product.
	ID uuid.UUID `json:"id"`
	// name of the insight product.
	Name string `json:"name"`
	// creator of the insight product.
	Creator string `json:"creator"`
	// description of the insight product.
	Description string `json:"description"`
	// type of the insight product.
	Type string `json:"type"`
	// link to the insight product.
	Link string `json:"link"`
	// keywords for the insight product used as tags.
	Keywords []string `json:"keywords"`
	// group is the owner group of the insight product
	Group string `json:"group"`
	// teamkatalogenURL of the creator
	TeamkatalogenURL *string `json:"teamkatalogenURL,omitempty"`
	// Id of the creator's team.
	TeamID *uuid.UUID `json:"teamID,omitempty"`
	// created is the timestamp for when the insight product was created
	Created time.Time `json:"created"`
	// lastModified is the timestamp for when the insight product was last modified
	LastModified    *time.Time `json:"lastModified,omitempty"`
	TeamName        *string    `json:"teamName"`
	ProductAreaName string     `json:"productAreaName"`
}

InsightProduct contains the metadata of insight product.

type InsightProductService

type InsightProductService interface {
	GetInsightProduct(ctx context.Context, id uuid.UUID) (*InsightProduct, error)
	UpdateInsightProduct(ctx context.Context, user *User, id uuid.UUID, input UpdateInsightProductDto) (*InsightProduct, error)
	CreateInsightProduct(ctx context.Context, user *User, input NewInsightProduct) (*InsightProduct, error)
	DeleteInsightProduct(ctx context.Context, user *User, id uuid.UUID) (*InsightProduct, error)
}

type InsightProductStorage

type InsightProductStorage interface {
	GetInsightProductsNumberByTeam(ctx context.Context, teamID uuid.UUID) (int64, error)
	GetInsightProductsByTeamID(ctx context.Context, teamIDs []uuid.UUID) ([]*InsightProduct, error)
	GetInsightProductsByGroups(ctx context.Context, groups []string) ([]*InsightProduct, error)
	GetInsightProductWithTeamkatalogen(ctx context.Context, id uuid.UUID) (*InsightProduct, error)
	UpdateInsightProduct(ctx context.Context, id uuid.UUID, in UpdateInsightProductDto) (*InsightProduct, error)
	CreateInsightProduct(ctx context.Context, creator string, in NewInsightProduct) (*InsightProduct, error)
	DeleteInsightProduct(ctx context.Context, id uuid.UUID) error
}

type JoinableView

type JoinableView struct {
	// id is the id of the joinable view set
	ID      uuid.UUID  `json:"id"`
	Name    string     `json:"name"`
	Created time.Time  `json:"created"`
	Expires *time.Time `json:"expires"`
}

type JoinableViewDatasource

type JoinableViewDatasource struct {
	RefDatasource    *DatasourceForJoinableView
	PseudoDatasource *DatasourceForJoinableView
}

type JoinableViewForOwner

type JoinableViewForOwner struct {
	ID        uuid.UUID
	Name      string
	Owner     string
	Created   time.Time
	Expires   *time.Time
	ProjectID string
	DatasetID string
	TableID   string
}

type JoinableViewForReferenceAndUser

type JoinableViewForReferenceAndUser struct {
	ID      uuid.UUID
	Dataset string
}

type JoinableViewToBeDeletedWithRefDatasource

type JoinableViewToBeDeletedWithRefDatasource struct {
	JoinableViewID   uuid.UUID
	JoinableViewName string
	BqProjectID      string
	BqDatasetID      string
	BqTableID        string
}

type JoinableViewWithDataset

type JoinableViewWithDataset struct {
	BqProject           string
	BqDataset           string
	BqTable             string
	Deleted             *time.Time
	DatasetID           uuid.NullUUID
	JoinableViewID      uuid.UUID
	Group               string
	JoinableViewName    string
	JoinableViewCreated time.Time
	JoinableViewExpires *time.Time
}

type JoinableViewWithDatasource

type JoinableViewWithDatasource struct {
	JoinableView
	PseudoDatasources []PseudoDatasource `json:"pseudoDatasources"`
}

type JoinableViewWithReference

type JoinableViewWithReference struct {
	Owner               string
	JoinableViewID      uuid.UUID
	JoinableViewDataset string
	PseudoViewID        uuid.UUID
	PseudoProjectID     string
	PseudoDataset       string
	PseudoTable         string
	Expires             sql.NullTime
}

type JoinableViewsService

type JoinableViewsService interface {
	GetJoinableViewsForUser(ctx context.Context, user *User) ([]JoinableView, error)
	GetJoinableView(ctx context.Context, user *User, id uuid.UUID) (*JoinableViewWithDatasource, error)
	CreateJoinableViews(ctx context.Context, user *User, input NewJoinableViews) (string, error)
	GetJoinableViewsToBeDeletedWithRefDatasource(ctx context.Context) ([]JoinableViewToBeDeletedWithRefDatasource, error)
	GetJoinableViewsWithReference(ctx context.Context) ([]JoinableViewWithReference, error)
	SetJoinableViewDeleted(ctx context.Context, id uuid.UUID) error
}

type JoinableViewsStorage

type JoinableViewsStorage interface {
	GetJoinableViewsForReferenceAndUser(ctx context.Context, user string, pseudoDatasetID uuid.UUID) ([]JoinableViewForReferenceAndUser, error)
	GetJoinableViewsForOwner(ctx context.Context, user *User) ([]JoinableViewForOwner, error)
	GetJoinableViewWithDataset(ctx context.Context, id uuid.UUID) ([]JoinableViewWithDataset, error)
	CreateJoinableViewsDB(ctx context.Context, name, owner string, expires *time.Time, datasourceIDs []uuid.UUID) (string, error)
	GetJoinableViewsToBeDeletedWithRefDatasource(ctx context.Context) ([]JoinableViewToBeDeletedWithRefDatasource, error)
	GetJoinableViewsWithReference(ctx context.Context) ([]JoinableViewWithReference, error)
	SetJoinableViewDeleted(ctx context.Context, id uuid.UUID) error
}

type KeywordItem

type KeywordItem struct {
	Keyword string `json:"keyword"`
	Count   int    `json:"count"`
}

type KeywordsList

type KeywordsList struct {
	KeywordItems []KeywordItem `json:"keywordItems"`
}

type KeywordsService

type KeywordsService interface {
	GetKeywordsListSortedByPopularity(ctx context.Context) (*KeywordsList, error)
	UpdateKeywords(ctx context.Context, user *User, input UpdateKeywordsDto) error
}

type KeywordsStorage

type KeywordsStorage interface {
	GetKeywordsListSortedByPopularity(ctx context.Context) (*KeywordsList, error)
	UpdateKeywords(ctx context.Context, input UpdateKeywordsDto) error
}

type MetabaseAPI

type MetabaseAPI interface {
	AddPermissionGroupMember(ctx context.Context, groupID int, email string) error
	ArchiveCollection(ctx context.Context, colID int) error
	AutoMapSemanticTypes(ctx context.Context, dbID int) error
	CreateCollection(ctx context.Context, name string) (int, error)
	CreateCollectionWithAccess(ctx context.Context, groupID int, name string) (int, error)
	CreateDatabase(ctx context.Context, team, name, saJSON, saEmail string, ds *BigQuery) (int, error)
	GetPermissionGroups(ctx context.Context) ([]MetabasePermissionGroup, error)
	GetOrCreatePermissionGroup(ctx context.Context, name string) (int, error)
	CreatePermissionGroup(ctx context.Context, name string) (int, error)
	Databases(ctx context.Context) ([]MetabaseDatabase, error)
	DeleteDatabase(ctx context.Context, id int) error
	DeletePermissionGroup(ctx context.Context, groupID int) error
	EnsureValidSession(ctx context.Context) error
	GetPermissionGroup(ctx context.Context, groupID int) ([]MetabasePermissionGroupMember, error)
	HideTables(ctx context.Context, ids []int) error
	OpenAccessToDatabase(ctx context.Context, databaseID int) error
	PerformRequest(ctx context.Context, method, path string, buffer io.ReadWriter) (*http.Response, error)
	RemovePermissionGroupMember(ctx context.Context, memberID int) error
	RestrictAccessToDatabase(ctx context.Context, groupID int, databaseID int) error
	SetCollectionAccess(ctx context.Context, groupID int, collectionID int) error
	ShowTables(ctx context.Context, ids []int) error
	Tables(ctx context.Context, dbID int) ([]MetabaseTable, error)
	GetCollections(ctx context.Context) ([]*MetabaseCollection, error)
	UpdateCollection(ctx context.Context, collection *MetabaseCollection) error
}

type MetabaseCollection

type MetabaseCollection struct {
	ID          int
	Name        string
	Description string
}

MetabaseCollection represents a subset of the metadata returned for a Metabase collection

type MetabaseDatabase

type MetabaseDatabase struct {
	ID        int
	Name      string
	DatasetID string
	ProjectID string
	NadaID    string
	SAEmail   string
}

type MetabaseField

type MetabaseField struct{}

type MetabaseMetadata

type MetabaseMetadata struct {
	DatasetID         uuid.UUID
	DatabaseID        *int
	PermissionGroupID *int
	CollectionID      *int
	SAEmail           string
	DeletedAt         *time.Time
	SyncCompleted     *time.Time
}

type MetabasePermissionGroup

type MetabasePermissionGroup struct {
	ID      int                             `json:"id"`
	Name    string                          `json:"name"`
	Members []MetabasePermissionGroupMember `json:"members"`
}

type MetabasePermissionGroupMember

type MetabasePermissionGroupMember struct {
	ID    int    `json:"membership_id"`
	Email string `json:"email"`
}

type MetabaseService

type MetabaseService interface {
	SyncTableVisibility(ctx context.Context, mbMeta *MetabaseMetadata, bq BigQuery) error
	SyncAllTablesVisibility(ctx context.Context) error
	RevokeMetabaseAccess(ctx context.Context, dsID uuid.UUID, subject string) error
	RevokeMetabaseAccessFromAccessID(ctx context.Context, accessID uuid.UUID) error
	DeleteDatabase(ctx context.Context, dsID uuid.UUID) error
	GrantMetabaseAccess(ctx context.Context, dsID uuid.UUID, subject, subjectType string) error
	CreateMappingRequest(ctx context.Context, user *User, datasetID uuid.UUID, services []string) error
	MapDataset(ctx context.Context, datasetID uuid.UUID, services []string) error
}

type MetabaseStorage

type MetabaseStorage interface {
	CreateMetadata(ctx context.Context, datasetID uuid.UUID) error
	DeleteMetadata(ctx context.Context, datasetID uuid.UUID) error
	DeleteRestrictedMetadata(ctx context.Context, datasetID uuid.UUID) error
	GetAllMetadata(ctx context.Context) ([]*MetabaseMetadata, error)
	GetMetadata(ctx context.Context, datasetID uuid.UUID, includeDeleted bool) (*MetabaseMetadata, error)
	GetOpenTablesInSameBigQueryDataset(ctx context.Context, projectID, dataset string) ([]string, error)
	RestoreMetadata(ctx context.Context, datasetID uuid.UUID) error
	SetCollectionMetabaseMetadata(ctx context.Context, datasetID uuid.UUID, collectionID int) (*MetabaseMetadata, error)
	SetDatabaseMetabaseMetadata(ctx context.Context, datasetID uuid.UUID, databaseID int) (*MetabaseMetadata, error)
	SetPermissionGroupMetabaseMetadata(ctx context.Context, datasetID uuid.UUID, groupID int) (*MetabaseMetadata, error)
	SetServiceAccountMetabaseMetadata(ctx context.Context, datasetID uuid.UUID, saEmail string) (*MetabaseMetadata, error)
	SetSyncCompletedMetabaseMetadata(ctx context.Context, datasetID uuid.UUID) error
	SoftDeleteMetadata(ctx context.Context, datasetID uuid.UUID) error
}

type MetabaseTable

type MetabaseTable struct {
	Name   string `json:"name"`
	ID     int    `json:"id"`
	Fields []struct {
		DatabaseType string `json:"database_type"`
		ID           int    `json:"id"`
		SemanticType string `json:"semantic_type"`
	} `json:"fields"`
}

type MetabaseUser

type MetabaseUser struct {
	Email string `json:"email"`
	ID    int    `json:"id"`
}

type Middleware

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

Middleware is a handler that exposes prometheus metrics for the number of requests, the latency and the response size, partitioned by status code, method and HTTP path.

func PrometheusMiddleware

func PrometheusMiddleware(name string, buckets ...float64) *Middleware

NewMiddleware returns a new prometheus Middleware handler.

func (*Middleware) Handler

func (m *Middleware) Handler() middleware

func (*Middleware) Initialize

func (m *Middleware) Initialize(path, method string, code int)

type NadaToken

type NadaToken struct {
	Team  string    `json:"team"`
	Token uuid.UUID `json:"token"`
}

type NaisConsoleAPI

type NaisConsoleAPI interface {
	GetGoogleProjectsForAllTeams(ctx context.Context) (map[string]string, error)
}

type NaisConsoleService

type NaisConsoleService interface {
	UpdateAllTeamProjects(ctx context.Context) error
}

type NaisConsoleStorage

type NaisConsoleStorage interface {
	GetAllTeamProjects(ctx context.Context) (map[string]string, error)
	UpdateAllTeamProjects(ctx context.Context, teamProjects map[string]string) error
	GetTeamProject(ctx context.Context, naisTeam string) (string, error)
}

type NewAccessRequestDTO

type NewAccessRequestDTO struct {
	DatasetID   uuid.UUID   `json:"datasetID"`
	Subject     *string     `json:"subject"`
	SubjectType *string     `json:"subjectType"`
	Owner       *string     `json:"owner"`
	Expires     *time.Time  `json:"expires"`
	Polly       *PollyInput `json:"polly"`
}

type NewBigQuery

type NewBigQuery struct {
	ProjectID string  `json:"projectID"`
	Dataset   string  `json:"dataset"`
	Table     string  `json:"table"`
	PiiTags   *string `json:"piiTags"`
}

type NewDataproduct

type NewDataproduct struct {
	// name of dataproduct
	Name string `json:"name"`
	// description of the dataproduct
	Description *string `json:"description,omitempty"`
	// owner group email for the dataproduct.
	Group string `json:"group"`
	// owner Teamkatalogen URL for the dataproduct.
	TeamkatalogenURL *string `json:"teamkatalogenURL,omitempty"`
	// The contact information of the team who owns the dataproduct, which can be slack channel, slack account, email, and so on.
	TeamContact *string `json:"teamContact,omitempty"`
	// Id of the team's product area.
	ProductAreaID *uuid.UUID `json:"productAreaID,omitempty"`
	// Id of the team.
	TeamID *uuid.UUID `json:"teamID,omitempty"`
	Slug   *string
}

NewDataproduct contains metadata for creating a new dataproduct

type NewDataset

type NewDataset struct {
	DataproductID            uuid.UUID   `json:"dataproductID"`
	Name                     string      `json:"name"`
	Description              *string     `json:"description"`
	Slug                     *string     `json:"slug"`
	Repo                     *string     `json:"repo"`
	Pii                      PiiLevel    `json:"pii"`
	Keywords                 []string    `json:"keywords"`
	BigQuery                 NewBigQuery `json:"bigquery"`
	AnonymisationDescription *string     `json:"anonymisationDescription"`
	GrantAllUsers            *bool       `json:"grantAllUsers"`
	TargetUser               *string     `json:"targetUser"`
	Metadata                 BigqueryMetadata
	PseudoColumns            []string `json:"pseudoColumns"`
}

type NewInsightProduct

type NewInsightProduct struct {
	Name        string   `json:"name"`
	Description *string  `json:"description,omitempty"`
	Type        string   `json:"type"`
	Link        string   `json:"link"`
	Keywords    []string `json:"keywords"`
	// Group is the owner group of the insight product
	Group string `json:"group"`
	// TeamkatalogenURL of the creator
	TeamkatalogenURL *string `json:"teamkatalogenURL,omitempty"`
	// Id of the creator's product area.
	ProductAreaID *uuid.UUID `json:"productAreaID,omitempty"`
	// Id of the creator's team.
	TeamID *uuid.UUID `json:"teamID,omitempty"`
}

NewInsightProduct contains the metadata and content of insight products.

type NewJoinableViews

type NewJoinableViews struct {
	// Name is the name of the joinable views which will be used as the name of the dataset in bigquery, which contains all the joinable views
	Name    string     `json:"name"`
	Expires *time.Time `json:"expires"`
	// DatasetIDs is the IDs of the datasets which are made joinable.
	DatasetIDs []uuid.UUID `json:"datasetIDs"`
}

NewJoinableViews contains metadata for creating joinable views

type NewStory

type NewStory struct {
	// id of data story.
	ID *uuid.UUID `json:"id"`
	// name of the data story.
	Name string `json:"name"`
	// description of the data story.
	Description *string `json:"description"`
	// keywords for the story used as tags.
	Keywords []string `json:"keywords"`
	// teamkatalogenURL of the creator.
	TeamkatalogenURL *string `json:"teamkatalogenURL"`
	// Id of the creator's product area.
	ProductAreaID *uuid.UUID `json:"productAreaID"`
	// Id of the creator's team.
	TeamID *uuid.UUID `json:"teamID"`
	// group is the owner group of the data story.
	Group string `json:"group"`
}

NewStory contains the metadata and content of data stories.

func (NewStory) Validate

func (s NewStory) Validate() error

type Object

type Object struct {
	Name   string
	Bucket string
	Attrs  Attributes
}

type ObjectWithData

type ObjectWithData struct {
	*Object
	Data []byte
}

type PiiLevel

type PiiLevel string
const (
	PiiLevelSensitive  PiiLevel = "sensitive"
	PiiLevelAnonymised PiiLevel = "anonymised"
	PiiLevelNone       PiiLevel = "none"
)

type Polly

type Polly struct {
	ID uuid.UUID `json:"id"`
	QueryPolly
}

type PollyAPI

type PollyAPI interface {
	SearchPolly(ctx context.Context, q string) ([]*QueryPolly, error)
}

type PollyInput

type PollyInput struct {
	ID *uuid.UUID `json:"id"`
	QueryPolly
}

type PollyService

type PollyService interface {
	SearchPolly(ctx context.Context, q string) ([]*QueryPolly, error)
}

type PollyStorage

type PollyStorage interface {
	CreatePollyDocumentation(ctx context.Context, input PollyInput) (Polly, error)
	GetPollyDocumentation(ctx context.Context, id uuid.UUID) (*Polly, error)
}

type ProductArea

type ProductArea struct {
	*TeamkatalogenProductArea
	Teams        []*Team `json:"teams"`
	DashboardURL string  `json:"dashboardURL"`
}

type ProductAreaService

type ProductAreaService interface {
	GetProductAreas(ctx context.Context) (*ProductAreasDto, error)
	GetProductAreaWithAssets(ctx context.Context, id uuid.UUID) (*ProductAreaWithAssets, error)
}

type ProductAreaStorage

type ProductAreaStorage interface {
	GetProductArea(ctx context.Context, paID uuid.UUID) (*ProductArea, error)
	GetProductAreas(ctx context.Context) ([]*ProductArea, error)
	GetDashboard(ctx context.Context, id uuid.UUID) (*Dashboard, error)
	UpsertProductAreaAndTeam(ctx context.Context, pa []*UpsertProductAreaRequest, t []*UpsertTeamRequest) error
}

type ProductAreaWithAssets

type ProductAreaWithAssets struct {
	*ProductArea
	Teams []*TeamWithAssets `json:"teams"`
}

type ProductAreasDto

type ProductAreasDto struct {
	ProductAreas []*ProductArea `json:"productAreas"`
}

FIXME: we need to simplify these structs, there is too much duplication

type PseudoDataset

type PseudoDataset struct {
	// name is the name of the dataset
	Name string `json:"name"`
	// datasetID is the id of the dataset
	DatasetID uuid.UUID `json:"datasetID"`
	// datasourceID is the id of the bigquery datasource
	DatasourceID uuid.UUID `json:"datasourceID"`
}

PseudoDataset contains information about a pseudo dataset

type PseudoDatasource

type PseudoDatasource struct {
	BigQueryUrl string `json:"bigqueryUrl"`
	Accessible  bool   `json:"accessible"`
	Deleted     bool   `json:"deleted"`
}

type QueryPolly

type QueryPolly struct {
	ExternalID string `json:"externalID"`
	Name       string `json:"name"`
	URL        string `json:"url"`
}

type ResultItem

type ResultItem interface {
	IsSearchResult()
}

type SearchOptions

type SearchOptions struct {
	// Freetext search
	Text string `json:"text"`
	// Filter on keyword
	Keywords []string `json:"keywords"`
	// Filter on group
	Groups []string `json:"groups"`
	// Filter on team_id
	TeamIDs []uuid.UUID `json:"teamIDs"`
	// Filter on enabled services
	Services []string `json:"services"`
	// Filter on types
	Types []string `json:"types"`

	Limit  *int `json:"limit"`
	Offset *int `json:"offset"`
}

type SearchResult

type SearchResult struct {
	Results []*SearchResultRow `json:"results"`
}

type SearchResultRaw

type SearchResultRaw struct {
	ElementID   uuid.UUID
	ElementType string
	Rank        float32
	Excerpt     string
}

type SearchResultRow

type SearchResultRow struct {
	Excerpt string     `json:"excerpt"`
	Result  ResultItem `json:"result"`
	Rank    float64    `json:"rank"`
}

type SearchService

type SearchService interface {
	Search(ctx context.Context, query *SearchOptions) (*SearchResult, error)
}

type SearchStorage

type SearchStorage interface {
	Search(ctx context.Context, query *SearchOptions) ([]*SearchResultRaw, error)
}

type ServiceAccount

type ServiceAccount struct {
	*ServiceAccountMeta
	Keys     []*ServiceAccountKey
	Bindings []*Binding
}

type ServiceAccountAPI

type ServiceAccountAPI interface {
	// ListServiceAccounts returns a list of service accounts in the project
	// with their keys and role bindings.
	ListServiceAccounts(ctx context.Context, project string) ([]*ServiceAccount, error)

	// EnsureServiceAccountWithKeyAndBinding creates a service account in the project, and adds the
	// specified role binding to the service account at a project level.
	EnsureServiceAccountWithKeyAndBinding(ctx context.Context, sa *ServiceAccountRequest) (*ServiceAccountWithPrivateKey, error)

	// DeleteServiceAccountAndBindings deletes a service account and its role bindings
	// in the project. Deleting the service account will also delete all associated keys.
	DeleteServiceAccountAndBindings(ctx context.Context, project, email string) error
}

type ServiceAccountKey

type ServiceAccountKey struct {
	Name         string
	KeyAlgorithm string
	KeyOrigin    string
	KeyType      string
}

type ServiceAccountKeyWithPrivateKeyData

type ServiceAccountKeyWithPrivateKeyData struct {
	*ServiceAccountKey
	PrivateKeyData []byte
}

type ServiceAccountMeta

type ServiceAccountMeta struct {
	Description string
	DisplayName string
	Email       string
	Name        string
	ProjectId   string
	UniqueId    string
}

type ServiceAccountRequest

type ServiceAccountRequest struct {
	ProjectID   string
	AccountID   string
	DisplayName string
	Description string
	Binding     *Binding
}

func (ServiceAccountRequest) Validate

func (s ServiceAccountRequest) Validate() error

type ServiceAccountWithPrivateKey

type ServiceAccountWithPrivateKey struct {
	*ServiceAccountMeta
	Key *ServiceAccountKeyWithPrivateKeyData
}

type SlackAPI

type SlackAPI interface {
	SendSlackNotification(channel, message string) error
	IsValidSlackChannel(name string) error
}

type SlackService

type SlackService interface {
	IsValidSlackChannel(name string) error
}

type Story

type Story struct {
	// id of the data story.
	ID uuid.UUID `json:"id"`
	// name of the data story.
	Name string `json:"name"`
	// creator of the data story.
	Creator string `json:"creator"`
	// description of the data story.
	Description string `json:"description"`
	// keywords for the story used as tags.
	Keywords []string `json:"keywords"`
	// teamkatalogenURL of the creator.
	TeamkatalogenURL *string `json:"teamkatalogenURL"`
	// Id of the creator's team.
	TeamID *uuid.UUID `json:"teamID"`
	// created is the timestamp for when the data story was created.
	Created time.Time `json:"created"`
	// lastModified is the timestamp for when the dataproduct was last modified.
	LastModified *time.Time `json:"lastModified"`
	// group is the owner group of the data story.
	Group           string  `json:"group"`
	TeamName        *string `json:"teamName"`
	ProductAreaName string  `json:"productAreaName"`
}

Story contains the metadata and content of data stories.

func (Story) IsSearchResult

func (Story) IsSearchResult()

type StoryAPI

type StoryAPI interface {
	WriteFilesToBucket(ctx context.Context, storyID string, files []*UploadFile, cleanupOnFailure bool) error
	WriteFileToBucket(ctx context.Context, pathPrefix string, file *UploadFile) error
	DeleteStoryFolder(ctx context.Context, storyID string) error
	GetIndexHtmlPath(ctx context.Context, prefix string) (string, error)
	GetObject(ctx context.Context, path string) (*ObjectWithData, error)
	DeleteObjectsWithPrefix(ctx context.Context, prefix string) (int, error)
}

type StoryService

type StoryService interface {
	GetStory(ctx context.Context, id uuid.UUID) (*Story, error)
	CreateStory(ctx context.Context, creatorEmail string, newStory *NewStory, files []*UploadFile) (*Story, error)
	CreateStoryWithTeamAndProductArea(ctx context.Context, creatorEmail string, newStory *NewStory) (*Story, error)
	DeleteStory(ctx context.Context, user *User, id uuid.UUID) (*Story, error)
	UpdateStory(ctx context.Context, user *User, id uuid.UUID, input UpdateStoryDto) (*Story, error)
	GetObject(ctx context.Context, path string) (*ObjectWithData, error)
	RecreateStoryFiles(ctx context.Context, id uuid.UUID, creatorEmail string, files []*UploadFile) error
	AppendStoryFiles(ctx context.Context, id uuid.UUID, creatorEmail string, files []*UploadFile) error
	GetIndexHtmlPath(ctx context.Context, prefix string) (string, error)
}

type StoryStorage

type StoryStorage interface {
	GetStoriesWithTeamkatalogenByGroups(ctx context.Context, groups []string) ([]*Story, error)
	GetStoriesWithTeamkatalogenByIDs(ctx context.Context, ids []uuid.UUID) ([]*Story, error)
	GetStoriesNumberByTeam(ctx context.Context, teamID uuid.UUID) (int64, error)
	GetStoriesByTeamID(ctx context.Context, teamIDs []uuid.UUID) ([]*Story, error)
	GetStory(ctx context.Context, id uuid.UUID) (*Story, error)
	CreateStory(ctx context.Context, creator string, newStory *NewStory) (*Story, error)
	DeleteStory(ctx context.Context, id uuid.UUID) error
	UpdateStory(ctx context.Context, id uuid.UUID, input UpdateStoryDto) (*Story, error)
}

type Team

type Team struct {
	*TeamkatalogenTeam
	DataproductsNumber    int `json:"dataproductsNumber"`
	StoriesNumber         int `json:"storiesNumber"`
	InsightProductsNumber int `json:"insightProductsNumber"`
}

type TeamKatalogenAPI

type TeamKatalogenAPI interface {
	GetTeam(ctx context.Context, teamID uuid.UUID) (*TeamkatalogenTeam, error)
	GetTeamCatalogURL(teamID uuid.UUID) string
	GetTeamsInProductArea(ctx context.Context, paID uuid.UUID) ([]*TeamkatalogenTeam, error)
	GetProductAreas(ctx context.Context) ([]*TeamkatalogenProductArea, error)
	Search(ctx context.Context, gcpGroups []string) ([]TeamkatalogenResult, error)
}

type TeamKatalogenService

type TeamKatalogenService interface {
	SearchTeamKatalogen(ctx context.Context, gcpGroups []string) ([]TeamkatalogenResult, error)
}

type TeamWithAssets

type TeamWithAssets struct {
	*TeamkatalogenTeam
	Dataproducts    []*Dataproduct    `json:"dataproducts"`
	Stories         []*Story          `json:"stories"`
	InsightProducts []*InsightProduct `json:"insightProducts"`
	DashboardURL    string            `json:"dashboardURL"`
}

type TeamkatalogenProductArea

type TeamkatalogenProductArea struct {
	// id is the id of the product area.
	ID uuid.UUID `json:"id"`
	// name is the name of the product area.
	Name string `json:"name"`
	// areaType is the type of the product area.
	AreaType string `json:"areaType"`

	// FIXME: Can probably get rid of this
	Teams []Team `json:"teams"`
}

type TeamkatalogenResult

type TeamkatalogenResult struct {
	TeamID        string `json:"teamID"`
	URL           string `json:"url"`
	Name          string `json:"name"`
	Description   string `json:"description"`
	ProductAreaID string `json:"productAreaID"`
}

type TeamkatalogenTeam

type TeamkatalogenTeam struct {
	// id is the team external id in teamkatalogen.
	ID uuid.UUID `json:"id"`
	// name is the name of the team.
	Name string `json:"name"`
	// productAreaID is the id of the product area.
	ProductAreaID uuid.UUID `json:"productAreaID"`
}

type ThirdPartyMappingStorage

type ThirdPartyMappingStorage interface {
	MapDataset(ctx context.Context, datasetID uuid.UUID, Services []string) error
	GetAddMetabaseDatasetMappings(ctx context.Context) ([]uuid.UUID, error)
	GetRemoveMetabaseDatasetMappings(ctx context.Context) ([]uuid.UUID, error)
}

type TokenService

type TokenService interface {
	RotateNadaToken(ctx context.Context, user *User, team string) error
	GetTeamFromNadaToken(ctx context.Context, token string) (string, error)
	GetNadaTokenForTeam(ctx context.Context, team string) (string, error)
	GetNadaTokens(ctx context.Context) (map[string]string, error)
	ValidateToken(ctx context.Context, token string) (bool, error)
}

type TokenStorage

type TokenStorage interface {
	GetNadaTokensForTeams(ctx context.Context, teams []string) ([]NadaToken, error)
	GetNadaTokens(ctx context.Context) (map[string]string, error)
	GetNadaToken(ctx context.Context, team string) (string, error)
	RotateNadaToken(ctx context.Context, team string) error
}

type UpdateAccessRequestDTO

type UpdateAccessRequestDTO struct {
	ID      uuid.UUID   `json:"id"`
	Owner   string      `json:"owner"`
	Expires *time.Time  `json:"expires"`
	Polly   *PollyInput `json:"polly"`
}

type UpdateDataproductDto

type UpdateDataproductDto struct {
	Name             string     `json:"name"`
	Description      *string    `json:"description"`
	Slug             *string    `json:"slug"`
	Pii              PiiLevel   `json:"pii"`
	TeamkatalogenURL *string    `json:"teamkatalogenURL"`
	TeamContact      *string    `json:"teamContact"`
	ProductAreaID    *uuid.UUID `json:"productAreaID"`
	TeamID           *uuid.UUID `json:"teamID"`
}

type UpdateDatasetDto

type UpdateDatasetDto struct {
	Name                     string     `json:"name"`
	Description              *string    `json:"description"`
	Slug                     *string    `json:"slug"`
	Repo                     *string    `json:"repo"`
	Pii                      PiiLevel   `json:"pii"`
	Keywords                 []string   `json:"keywords"`
	DataproductID            *uuid.UUID `json:"dataproductID"`
	AnonymisationDescription *string    `json:"anonymisationDescription"`
	PiiTags                  *string    `json:"piiTags"`
	TargetUser               *string    `json:"targetUser"`
	PseudoColumns            []string   `json:"pseudoColumns"`
}

type UpdateInsightProductDto

type UpdateInsightProductDto struct {
	Name             string     `json:"name"`
	Description      string     `json:"description"`
	TypeArg          string     `json:"type"`
	Link             string     `json:"link"`
	Keywords         []string   `json:"keywords"`
	TeamkatalogenURL *string    `json:"teamkatalogenURL"`
	ProductAreaID    *uuid.UUID `json:"productAreaID"`
	TeamID           *uuid.UUID `json:"teamID"`
	Group            string     `json:"group"`
}

type UpdateKeywordsDto

type UpdateKeywordsDto struct {
	ObsoleteKeywords []string `json:"obsoleteKeywords"`
	ReplacedKeywords []string `json:"replacedKeywords"`
	NewText          []string `json:"newText"`
}

type UpdateStoryDto

type UpdateStoryDto struct {
	Name             string     `json:"name"`
	Description      string     `json:"description"`
	Keywords         []string   `json:"keywords"`
	TeamkatalogenURL *string    `json:"teamkatalogenURL"`
	ProductAreaID    *uuid.UUID `json:"productAreaID"`
	TeamID           *uuid.UUID `json:"teamID"`
	Group            string     `json:"group"`
}

type UploadFile

type UploadFile struct {
	// path of the file uploaded
	Path string `json:"path"`
	// file data
	ReadCloser io.ReadCloser
}

type UpsertProductAreaRequest

type UpsertProductAreaRequest struct {
	ID   uuid.UUID
	Name string
}

type UpsertTeamRequest

type UpsertTeamRequest struct {
	ID            uuid.UUID
	ProductAreaID uuid.UUID
	Name          string
}

FIXCME: does this belong here?

type User

type User struct {
	Name            string `json:"name"`
	Email           string `json:"email"`
	AzureGroups     Groups
	GoogleGroups    Groups
	AllGoogleGroups Groups
	Expiry          time.Time `json:"expiry"`
}

func (User) Validate

func (u User) Validate() error

type UserInfo

type UserInfo struct {
	// name of user
	Name string `json:"name"`

	// email of user.
	Email string `json:"email"`

	// googleGroups is the google groups the user is member of.
	GoogleGroups Groups `json:"googleGroups"`

	// allGoogleGroups is the all the known google groups of the user domains.
	AllGoogleGroups Groups `json:"allGoogleGroups"`

	// azureGroups is the azure groups the user is member of.
	AzureGroups Groups `json:"azureGroups"`

	// gcpProjects is GCP projects the user is a member of.
	GcpProjects []GCPProject `json:"gcpProjects"`

	// nadaTokens is a list of the nada tokens for each team the logged in user is a part of.
	NadaTokens []NadaToken `json:"nadaTokens"`

	// loginExpiration is when the token expires.
	LoginExpiration time.Time `json:"loginExpiration"`

	// dataproducts is a list of dataproducts with one of the users groups as owner.
	Dataproducts []Dataproduct `json:"dataproducts"`

	// accessable is a list of datasets which the user has either owns or has explicit access to.
	Accessable AccessibleDatasets `json:"accessable"`

	// stories is the stories owned by the user's group
	Stories []*Story `json:"stories"`

	// insight products is the insight products owned by the user's group
	InsightProducts []InsightProduct `json:"insightProducts"`

	// accessRequests is a list of access requests where either the user or one of the users groups is owner.
	AccessRequests []AccessRequest `json:"accessRequests"`

	// accessRequestsAsGranter is a list of access requests where one of the users groups is obliged to handle.
	AccessRequestsAsGranter []AccessRequestForGranter `json:"accessRequestsAsGranter"`
}

type UserService

type UserService interface {
	GetUserData(ctx context.Context, user *User) (*UserInfo, error)
}

Jump to

Keyboard shortcuts

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