Documentation
¶
Index ¶
- Constants
- type Access
- type AccessRequest
- type AccessRequestForGranter
- type AccessRequestStatus
- type AccessRequestsWrapper
- type AccessService
- type AccessStorage
- type AccessibleDataset
- type AccessibleDatasets
- type Attributes
- type BQColumns
- type BQDatasets
- type BQTables
- type BigQuery
- type BigQueryAPI
- type BigQueryDataSourceUpdate
- type BigQueryService
- type BigQueryStorage
- type BigQueryTable
- type BigQueryTableType
- type BigqueryColumn
- type BigqueryMetadata
- type BigquerySchema
- type Binding
- type Dashboard
- type DataProductsService
- type DataProductsStorage
- type Dataproduct
- type DataproductMinimal
- type DataproductOwner
- type DataproductWithDataset
- type Dataset
- type DatasetInDataproduct
- type DatasetMap
- type DatasetMinimal
- type DatasourceForJoinableView
- type DatasourceType
- type GCPProject
- type GrantAccessData
- type Group
- type Groups
- type InsightProduct
- type InsightProductService
- type InsightProductStorage
- type JoinableView
- type JoinableViewDatasource
- type JoinableViewForOwner
- type JoinableViewForReferenceAndUser
- type JoinableViewToBeDeletedWithRefDatasource
- type JoinableViewWithDataset
- type JoinableViewWithDatasource
- type JoinableViewWithReference
- type JoinableViewsService
- type JoinableViewsStorage
- type KeywordItem
- type KeywordsList
- type KeywordsService
- type KeywordsStorage
- type MetabaseAPI
- type MetabaseCollection
- type MetabaseDatabase
- type MetabaseField
- type MetabaseMetadata
- type MetabasePermissionGroup
- type MetabasePermissionGroupMember
- type MetabaseService
- type MetabaseStorage
- type MetabaseTable
- type MetabaseUser
- type Middleware
- type NadaToken
- type NaisConsoleAPI
- type NaisConsoleService
- type NaisConsoleStorage
- type NewAccessRequestDTO
- type NewBigQuery
- type NewDataproduct
- type NewDataset
- type NewInsightProduct
- type NewJoinableViews
- type NewStory
- type Object
- type ObjectWithData
- type PiiLevel
- type Polly
- type PollyAPI
- type PollyInput
- type PollyService
- type PollyStorage
- type ProductArea
- type ProductAreaService
- type ProductAreaStorage
- type ProductAreaWithAssets
- type ProductAreasDto
- type PseudoDataset
- type PseudoDatasource
- type QueryPolly
- type ResultItem
- type SearchOptions
- type SearchResult
- type SearchResultRaw
- type SearchResultRow
- type SearchService
- type SearchStorage
- type ServiceAccount
- type ServiceAccountAPI
- type ServiceAccountKey
- type ServiceAccountKeyWithPrivateKeyData
- type ServiceAccountMeta
- type ServiceAccountRequest
- type ServiceAccountWithPrivateKey
- type SlackAPI
- type SlackService
- type Story
- type StoryAPI
- type StoryService
- type StoryStorage
- type Team
- type TeamKatalogenAPI
- type TeamKatalogenService
- type TeamWithAssets
- type TeamkatalogenProductArea
- type TeamkatalogenResult
- type TeamkatalogenTeam
- type ThirdPartyMappingStorage
- type TokenService
- type TokenStorage
- type UpdateAccessRequestDTO
- type UpdateDataproductDto
- type UpdateDatasetDto
- type UpdateInsightProductDto
- type UpdateKeywordsDto
- type UpdateStoryDto
- type UploadFile
- type UpsertProductAreaRequest
- type UpsertTeamRequest
- type User
- type UserInfo
- type UserService
Constants ¶
const ( SubjectTypeUser string = "user" SubjectTypeGroup string = "group" SubjectTypeServiceAccount string = "serviceAccount" )
const (
MappingServiceMetabase string = "metabase"
)
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 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 AccessibleDatasets ¶
type AccessibleDatasets struct { // owned Owned []*AccessibleDataset `json:"owned"` // granted Granted []*AccessibleDataset `json:"granted"` // service account granted ServiceAccountGranted []*AccessibleDataset `json:"serviceAccountGranted"` }
type Attributes ¶
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 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 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 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 DataproductOwner ¶
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 DatasourceType ¶
type DatasourceType string
type GCPProject ¶
type GrantAccessData ¶
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 JoinableViewDatasource ¶
type JoinableViewDatasource struct { RefDatasource *DatasourceForJoinableView PseudoDatasource *DatasourceForJoinableView }
type JoinableViewForOwner ¶
type JoinableViewWithDataset ¶
type JoinableViewWithDatasource ¶
type JoinableViewWithDatasource struct { JoinableView PseudoDatasources []PseudoDatasource `json:"pseudoDatasources"` }
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 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 ¶
MetabaseCollection represents a subset of the metadata returned for a Metabase collection
type MetabaseDatabase ¶
type MetabaseField ¶
type MetabaseField struct{}
type MetabaseMetadata ¶
type MetabasePermissionGroup ¶
type MetabasePermissionGroup struct { ID int `json:"id"` Name string `json:"name"` Members []MetabasePermissionGroupMember `json:"members"` }
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 MetabaseUser ¶
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 NaisConsoleAPI ¶
type NaisConsoleService ¶
type NaisConsoleStorage ¶
type NewAccessRequestDTO ¶
type NewBigQuery ¶
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.
type Object ¶
type Object struct { Name string Bucket string Attrs Attributes }
type ObjectWithData ¶
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 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 QueryPolly ¶
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 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 ServiceAccountKeyWithPrivateKeyData ¶
type ServiceAccountKeyWithPrivateKeyData struct { *ServiceAccountKey PrivateKeyData []byte }
type ServiceAccountMeta ¶
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 SlackService ¶
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 TeamkatalogenTeam ¶
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 UpdateAccessRequestDTO ¶
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 UpdateStoryDto ¶
type UploadFile ¶
type UploadFile struct { // path of the file uploaded Path string `json:"path"` // file data ReadCloser io.ReadCloser }
type UpsertTeamRequest ¶
FIXCME: does this belong here?
type User ¶
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"` }