Documentation ¶
Index ¶
- Constants
- Variables
- func GetDataproduct(ctx context.Context, id string) (*DataproductWithDataset, *APIError)
- func GetDataproducts(ctx context.Context, ids []uuid.UUID) ([]DataproductWithDataset, *APIError)
- func GetDataset(ctx context.Context, id string) (*Dataset, *APIError)
- func GetDatasetsMinimal(ctx context.Context) ([]*DatasetMinimal, *APIError)
- func GetProductAreaWithAssets(ctx context.Context, id string) (*ProductAreaWithAssets, *APIError)
- func GetProductAreas(ctx context.Context) (*ProductAreasDto, *APIError)
- func Init(db *sql.DB, tk teamkatalogen.Teamkatalogen, l *logrus.Logger, ...)
- func New(repo *database.Repo, gcsClient *gcs.Client, ...) *chi.Mux
- func Search(ctx context.Context, query *SearchOptions) (*SearchResult, *APIError)
- func TrimNaisTeamPrefix(team string) string
- type APIError
- func DBErrorToAPIError(err error, message string) *APIError
- func NewAPIError(status int, err error, message string) *APIError
- func NewInternalError(err error, message string) *APIError
- func RotateNadaToken(ctx context.Context, team string) *APIError
- func SearchTeamKatalogen(ctx context.Context, gcpGroups []string) ([]teamkatalogen.TeamkatalogenResult, *APIError)
- type Access
- type AccessRequest
- type AccessRequestForGranter
- type AccessRequestStatus
- type AccessRequestsWrapper
- type AccessibleDataset
- type AccessibleDatasets
- type BQColumns
- type BQDatasets
- type BQTables
- type BigQuery
- type Dataproduct
- type DataproductOwner
- type DataproductWithDataset
- type Dataset
- type DatasetInDataproduct
- type DatasetMinimal
- type DatasourceType
- type GCPProject
- type HTTP
- type HTTPAPI
- type InsightProduct
- type KeywordItem
- type KeywordsList
- type Middleware
- type MockHTTP
- type NadaToken
- type OAuth2
- type PiiLevel
- type Polly
- type PollyInput
- type ProductArea
- type ProductAreaWithAssets
- type ProductAreasDto
- type QueryPolly
- type ResultItem
- type SearchOptions
- type SearchResult
- type SearchResultRow
- type Story
- type Team
- type TeamWithAssets
- type UserInfo
Constants ¶
View Source
const ( RedirectURICookie = "redirecturi" OAuthStateCookie = "oauthstate" )
Variables ¶
Functions ¶
func GetDataproduct ¶
func GetDataproduct(ctx context.Context, id string) (*DataproductWithDataset, *APIError)
func GetDataproducts ¶
func GetDatasetsMinimal ¶
func GetDatasetsMinimal(ctx context.Context) ([]*DatasetMinimal, *APIError)
func GetProductAreaWithAssets ¶
func GetProductAreaWithAssets(ctx context.Context, id string) (*ProductAreaWithAssets, *APIError)
func GetProductAreas ¶
func GetProductAreas(ctx context.Context) (*ProductAreasDto, *APIError)
func Init ¶
func Init(db *sql.DB, tk teamkatalogen.Teamkatalogen, l *logrus.Logger, projects *auth.TeamProjectsMapping, e *event.Manager)
func New ¶
func New( repo *database.Repo, gcsClient *gcs.Client, teamCatalog teamkatalogen.Teamkatalogen, httpAPI HTTPAPI, authMW auth.MiddlewareHandler, gqlServer *handler.Server, promReg *prometheus.Registry, amplitudeClient amplitude.Amplitude, teamTokenCreds string, log *logrus.Logger, ) *chi.Mux
func Search ¶
func Search(ctx context.Context, query *SearchOptions) (*SearchResult, *APIError)
func TrimNaisTeamPrefix ¶
Types ¶
type APIError ¶
func DBErrorToAPIError ¶
func NewInternalError ¶
func SearchTeamKatalogen ¶
func SearchTeamKatalogen(ctx context.Context, gcpGroups []string) ([]teamkatalogen.TeamkatalogenResult, *APIError)
type Access ¶
type Access struct { ID uuid.UUID `json:"id"` Subject string `json:"subject"` 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 AccessibleDataset ¶
type AccessibleDatasets ¶
type AccessibleDatasets struct { // owned Owned []*AccessibleDataset `json:"owned"` // granted Granted []*AccessibleDataset `json:"granted"` }
type BQColumns ¶
type BQColumns struct {
BQColumns []*bqclient.BigqueryColumn `json:"bqColumns"`
}
type BQDatasets ¶
type BQDatasets struct {
BQDatasets []string `json:"bqDatasets"`
}
type BQTables ¶
type BQTables struct {
BQTables []*bqclient.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 bqclient.BigQueryType `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 []*bqclient.BigqueryColumn `json:"schema"` }
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 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"` }
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 DatasetMinimal ¶
type DatasourceType ¶
type DatasourceType string
type GCPProject ¶
type HTTPAPI ¶
type HTTPAPI interface { Login(w http.ResponseWriter, r *http.Request) Callback(w http.ResponseWriter, r *http.Request) Logout(w http.ResponseWriter, r *http.Request) }
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 *string `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 KeywordItem ¶
type KeywordsList ¶
type KeywordsList struct {
KeywordItems []KeywordItem `json:"keywordItems"`
}
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 Polly ¶
type Polly struct { ID uuid.UUID `json:"id"` QueryPolly }
type PollyInput ¶
type PollyInput struct { ID *uuid.UUID `json:"id"` QueryPolly }
type ProductArea ¶
type ProductArea struct { teamkatalogen.ProductArea Teams []Team `json:"teams"` DashboardURL string `json:"dashboardURL"` }
type ProductAreaWithAssets ¶
type ProductAreaWithAssets struct { ProductArea Teams []TeamWithAssets `json:"teams"` }
type ProductAreasDto ¶
type ProductAreasDto struct {
ProductAreas []ProductArea `json:"productAreas"`
}
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 []string `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 SearchResultRow ¶
type SearchResultRow struct { Excerpt string `json:"excerpt"` Result ResultItem `json:"result"` Rank float64 `json:"rank"` }
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 *string `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 Team ¶
type Team struct { teamkatalogen.Team DataproductsNumber int `json:"dataproductsNumber"` StoriesNumber int `json:"storiesNumber"` InsightProductsNumber int `json:"insightProductsNumber"` }
type TeamWithAssets ¶
type TeamWithAssets struct { teamkatalogen.Team Dataproducts []Dataproduct `json:"dataproducts"` Stories []Story `json:"stories"` InsightProducts []InsightProduct `json:"insightProducts"` DashboardURL string `json:"dashboardURL"` }
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 auth.Groups `json:"googleGroups"` // allGoogleGroups is the all the known google groups of the user domains. AllGoogleGroups auth.Groups `json:"allGoogleGroups"` // azureGroups is the azure groups the user is member of. AzureGroups auth.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"` }
Click to show internal directories.
Click to hide internal directories.