Documentation ¶
Index ¶
- Constants
- Variables
- func Flags() []cli.Flag
- type AccessDataFilters
- type AnalyzerConfigMap
- type AuthInfo
- type Contact
- type Info
- type ModelObject
- type OrgAccessFilter
- type OrgServiceAccessDataFilter
- func (f OrgServiceAccessDataFilter) CanCreateOrg(orgID string) (bool, error)
- func (f OrgServiceAccessDataFilter) CanCreateService(orgID string) (bool, error)
- func (f OrgServiceAccessDataFilter) CanListOrgs() (authorized bool, orgIDs []string, err error)
- func (f OrgServiceAccessDataFilter) CanListServices() (authorized bool, orgIDs []string, err error)
- type Organization
- func (m *Organization) BeforeCreate(tx *gorm.DB) (err error)
- func (m *Organization) BeforeSave(tx *gorm.DB) (err error)
- func (m *Organization) GetID() string
- func (m *Organization) GetIndex(field string) string
- func (m *Organization) GetIndexValue(field string) string
- func (m *Organization) GetIndexValues() map[string]string
- func (m *Organization) GetIndexes() map[string]string
- func (m *Organization) GetTags() []string
- func (m *Organization) Sortable(field string) bool
- func (m *Organization) SortableFields() map[string]struct{}
- func (m *Organization) String() string
- func (m *Organization) TableName() string
- type OrganizationPatch
- type Pagination
- type Resource
- func (r Resource) IsCreateOrganization() bool
- func (r Resource) IsCreateService() bool
- func (r Resource) IsDeleteOrganization() bool
- func (r Resource) IsDeleteService() bool
- func (r Resource) IsGetOrganization() bool
- func (r Resource) IsGetService() bool
- func (r Resource) IsListOrganizations() bool
- func (r Resource) IsListServices() bool
- func (r Resource) IsReadOnlyAction() bool
- func (r Resource) IsSpec() bool
- func (r Resource) IsSpecs() bool
- func (r Resource) IsUpdateOrganization() bool
- func (r Resource) IsUpdateService() bool
- type ResourceAction
- type ResourceKind
- type RoleType
- type Roles
- type Service
- func (m *Service) BeforeCreate(tx *gorm.DB) (err error)
- func (m *Service) BeforeSave(tx *gorm.DB) (err error)
- func (m *Service) GetID() string
- func (m *Service) GetIndex(field string) string
- func (m *Service) GetIndexValue(field string) string
- func (m *Service) GetIndexValues() map[string]string
- func (m *Service) GetIndexes() map[string]string
- func (m *Service) GetNameID(name analyzer.SpecAnalyzer, analyzerCfg analyzer.Config) string
- func (m *Service) GetTags() []string
- func (m *Service) SetSummary(score int, version string, revision string, updatedAt time.Time)
- func (m *Service) Sortable(field string) bool
- func (m *Service) SortableFields() map[string]struct{}
- func (m *Service) String() string
- func (m *Service) TableName() string
- type ServiceAccessFilter
- type ServicePatch
- type ServiceResponse
- type ServiceSummary
- type Spec
- func (m *Spec) AfterFind(tx *gorm.DB) (err error)
- func (m *Spec) AfterSave(tx *gorm.DB) (err error)
- func (m *Spec) BeforeCreate(tx *gorm.DB) (err error)
- func (m *Spec) BeforeSave(tx *gorm.DB) (err error)
- func (m *Spec) GetDocAsMap() (docMap map[string]interface{}, isJSON bool, err error)
- func (m *Spec) GetID() string
- func (m *Spec) GetIndex(field string) string
- func (m *Spec) GetIndexValue(field string) string
- func (m *Spec) GetIndexValues() map[string]string
- func (m *Spec) GetIndexes() map[string]string
- func (m *Spec) GetTags() []string
- func (m *Spec) LoadDocAsOAS(ctx context.Context, validate, setDocType, setVersion bool) (*openapi3.T, error)
- func (m *Spec) Sortable(field string) bool
- func (m *Spec) SortableFields() map[string]struct{}
- func (m *Spec) String() string
- func (m *Spec) TableName() string
- type SpecAnalysis
- func (m *SpecAnalysis) AfterFind(tx *gorm.DB) (err error)
- func (m *SpecAnalysis) AfterSave(tx *gorm.DB) (err error)
- func (m *SpecAnalysis) BeforeCreate(tx *gorm.DB) (err error)
- func (m *SpecAnalysis) BeforeSave(tx *gorm.DB) (err error)
- func (m *SpecAnalysis) GetID() string
- func (m *SpecAnalysis) GetIndex(field string) string
- func (m *SpecAnalysis) GetIndexValue(field string) string
- func (m *SpecAnalysis) GetIndexValues() map[string]string
- func (m *SpecAnalysis) GetIndexes() map[string]string
- func (m *SpecAnalysis) GetTags() []string
- func (m *SpecAnalysis) OmitResultFindings()
- func (m *SpecAnalysis) SetResult(result *analyzer.Result, status string) error
- func (m *SpecAnalysis) SetScore(score int) error
- func (m *SpecAnalysis) Sortable(field string) bool
- func (m *SpecAnalysis) SortableFields() map[string]struct{}
- func (m *SpecAnalysis) String() string
- func (m *SpecAnalysis) TableName() string
- type SpecAnalysisConfig
- type SpecAnalysisRequest
- type SpecAnalysisResponse
- type SpecAnalysisResponseWrapper
- type SpecAnalysisResult
- type SpecDiff
- func (m *SpecDiff) AfterFind(tx *gorm.DB) (err error)
- func (m *SpecDiff) AfterSave(tx *gorm.DB) (err error)
- func (m *SpecDiff) BeforeCreate(tx *gorm.DB) (err error)
- func (m *SpecDiff) BeforeSave(tx *gorm.DB) (err error)
- func (m *SpecDiff) GetID() string
- func (m *SpecDiff) GetIndex(field string) string
- func (m *SpecDiff) GetIndexValue(field string) string
- func (m *SpecDiff) GetIndexValues() map[string]string
- func (m *SpecDiff) GetIndexes() map[string]string
- func (m *SpecDiff) GetTags() []string
- func (m *SpecDiff) SetResult(result *diff.Result, status string) error
- func (m *SpecDiff) Sortable(field string) bool
- func (m *SpecDiff) SortableFields() map[string]struct{}
- func (m *SpecDiff) String() string
- func (m *SpecDiff) TableName() string
- type SpecDiffConfig
- type SpecDiffRequest
- type SpecDiffResponse
- type SpecDiffResult
- type SpecDoc
- type SpecDocAnalyzer
- type SpecResponse
- type UnauthorizedResourceAccessError
Constants ¶
const ( SuperAdminRole = "api-insights-admin" SuperAdminServiceRole = "api-insights-admin-service" // RoleTypeOrgAdmin role type represents roles that can manage other users and services of an org. RoleTypeOrgAdmin RoleType = "org-admin" // RoleTypeOrgDeveloper role type represents roles that can upload specs and view services of an org. RoleTypeOrgDeveloper RoleType = "org-developer" )
const ( ResourceActionCreate ResourceAction = "create" ResourceActionUpdate ResourceAction = "update" ResourceActionDelete ResourceAction = "delete" ResourceActionGet ResourceAction = "get" ResourceActionList ResourceAction = "list" ResourceKindOrganizations ResourceKind = "organizations" ResourceKindOrganization ResourceKind = "organization" ResourceKindServices ResourceKind = "services" ResourceKindService ResourceKind = "service" ResourceKindSpecs ResourceKind = "specs" ResourceKindSpec ResourceKind = "spec" )
const ( ServiceTableName = "services" ServiceVisibilityPublic = "public" ServiceVisibilityPrivate = "private" )
const (
OrganizationTableName = "organizations"
)
const (
SpecAnalysisTableName = "spec_analyses"
)
const (
SpecDiffTableName = "spec_diffs"
)
const (
SpecTableName = "specs"
)
Variables ¶
var ( MatchRoleTypeOrgAdmin = func(s string) bool { return roleTypeOrgAdminRegexp.MatchString(s) } MatchRoleTypeOrgDeveloper = func(s string) bool { return roleTypeOrgDeveloperRegexp.MatchString(s) } MatchRoleTypeOrgAdminService = func(s string) bool { return roleTypeOrgAdminServiceRegexp.MatchString(s) } MatchRoleTypeOrgDeveloperService = func(s string) bool { return roleTypeOrgDeveloperServiceRegexp.MatchString(s) } )
var (
ErrResourceIDExpected = errors.New("access: resource ID expected")
)
Functions ¶
Types ¶
type AccessDataFilters ¶
type AccessDataFilters []interface{}
type AnalyzerConfigMap ¶
type AnalyzerConfigMap map[analyzer.SpecAnalyzer]analyzer.Config
func (*AnalyzerConfigMap) Merge ¶
func (m *AnalyzerConfigMap) Merge(with AnalyzerConfigMap)
func (*AnalyzerConfigMap) Scan ¶
func (m *AnalyzerConfigMap) Scan(value interface{}) error
Scan implements sql.Scanner interface. See https://gorm.io/docs/data_types.html#Implements-Customized-Data-Type.
func (AnalyzerConfigMap) Value ¶
func (m AnalyzerConfigMap) Value() (driver.Value, error)
Value implements driver.Valuer interface. See https://gorm.io/docs/data_types.html#Implements-Customized-Data-Type.
type Contact ¶
func (*Contact) Scan ¶
Scan implements sql.Scanner interface. See https://gorm.io/docs/data_types.html#Implements-Customized-Data-Type.
type Info ¶
type Info struct {
Auth AuthInfo `json:"auth"`
}
Info contains various runtime server info
type ModelObject ¶
type ModelObject interface { GetID() string String() string GetIndex(field string) string GetIndexes() map[string]string GetIndexValue(field string) string GetIndexValues() map[string]string Sortable(field string) bool SortableFields() map[string]struct{} }
ModelObject defines the interface of a model
type OrgAccessFilter ¶
type OrgAccessFilter struct { // AccessibleOrganizationIDs contains a list of OrganizationIDs that are authorized to the user for all operations. AccessibleOrganizationIDs []string }
type OrgServiceAccessDataFilter ¶
type OrgServiceAccessDataFilter struct { OrgAccessFilter *OrgAccessFilter ServiceAccessFilter *ServiceAccessFilter }
func NewOrgServiceAccessFilter ¶
func NewOrgServiceAccessFilter() *OrgServiceAccessDataFilter
func (OrgServiceAccessDataFilter) CanCreateOrg ¶
func (f OrgServiceAccessDataFilter) CanCreateOrg(orgID string) (bool, error)
func (OrgServiceAccessDataFilter) CanCreateService ¶
func (f OrgServiceAccessDataFilter) CanCreateService(orgID string) (bool, error)
func (OrgServiceAccessDataFilter) CanListOrgs ¶
func (f OrgServiceAccessDataFilter) CanListOrgs() (authorized bool, orgIDs []string, err error)
func (OrgServiceAccessDataFilter) CanListServices ¶
func (f OrgServiceAccessDataFilter) CanListServices() (authorized bool, orgIDs []string, err error)
type Organization ¶
type Organization struct { ID string `json:"id,omitempty" gorm:"column:id;primaryKey"` NameID string `json:"name_id" gorm:"column:name_id;unique;index"` Title string `json:"title" gorm:"column:title"` Description string `json:"description" gorm:"column:description"` Meta datatypes.JSONMap `json:"meta" gorm:"column:meta"` Contact *Contact `json:"contact" gorm:"column:contact"` CreatedAt time.Time `json:"created_at" gorm:"column:created_at"` UpdatedAt time.Time `json:"updated_at" gorm:"column:updated_at"` Roles }
Organization represents an organization
func (*Organization) BeforeCreate ¶
func (m *Organization) BeforeCreate(tx *gorm.DB) (err error)
func (*Organization) BeforeSave ¶
func (m *Organization) BeforeSave(tx *gorm.DB) (err error)
func (*Organization) GetID ¶
func (m *Organization) GetID() string
GetID returns the ID of analyzer object
func (*Organization) GetIndex ¶
func (m *Organization) GetIndex(field string) string
GetIndex returns an index for specific field
func (*Organization) GetIndexValue ¶
func (m *Organization) GetIndexValue(field string) string
GetIndexValue return index value for specified field
func (*Organization) GetIndexValues ¶
func (m *Organization) GetIndexValues() map[string]string
GetIndexValues return all field index values
func (*Organization) GetIndexes ¶
func (m *Organization) GetIndexes() map[string]string
GetIndexes returns all the field indexes
func (*Organization) GetTags ¶
func (m *Organization) GetTags() []string
GetTags returns all the tags
func (*Organization) Sortable ¶
func (m *Organization) Sortable(field string) bool
Sortable checks if field is sortable.
func (*Organization) SortableFields ¶
func (m *Organization) SortableFields() map[string]struct{}
SortableFields returns all sortable fields
func (*Organization) String ¶
func (m *Organization) String() string
String returns the text representation of analyzer object
func (*Organization) TableName ¶
func (m *Organization) TableName() string
TableName implements gorm Tabler interface
type OrganizationPatch ¶
type OrganizationPatch struct { NameID *string `json:"name_id"` Title *string `json:"title"` Description *string `json:"description"` Meta *datatypes.JSONMap `json:"meta"` Contact *Contact `json:"contact"` *Roles }
OrganizationPatch represents a service with patchable fields.
type Pagination ¶
type Pagination struct { Total int `json:"total"` TotalPages int `json:"total_pages"` PageSize int `json:"page_size"` PageNum int `json:"current_page"` }
Pagination represents pagination arguments
type Resource ¶
type Resource struct { Kind ResourceKind Action ResourceAction ID *string Subresource *Resource IsRootResource bool IsSubresource bool }
func NewResourceFromReq ¶
func NewResourceFromReq(req *restful.Request) *Resource
func (Resource) IsCreateOrganization ¶
func (Resource) IsCreateService ¶
func (Resource) IsDeleteOrganization ¶
func (Resource) IsDeleteService ¶
func (Resource) IsGetOrganization ¶
func (Resource) IsGetService ¶
func (Resource) IsListOrganizations ¶
func (Resource) IsListServices ¶
func (Resource) IsReadOnlyAction ¶
func (Resource) IsUpdateOrganization ¶
func (Resource) IsUpdateService ¶
type ResourceAction ¶
type ResourceAction string
ResourceAction specifies a performable action on a ResourceKind, e.g. create, update, delete, get, list.
type ResourceKind ¶
type ResourceKind string
ResourceKind specifies a resource object, e.g. organization, service.
type Roles ¶
type Roles struct { Roles datatypes.JSONMap `json:"roles" gorm:"column:roles"` // contains filtered or unexported fields }
Roles represents organization roles
func NewOrganizationRoles ¶
func NewOrganizationRoles() Roles
func (*Roles) AddOrgAdminRole ¶
func (*Roles) AddOrgDeveloperRole ¶
func (*Roles) OrgAdminRoleSet ¶
func (*Roles) OrgDeveloperRoleSet ¶
func (*Roles) RoleTypeSetMap ¶
type Service ¶
type Service struct { ID string `json:"id,omitempty" gorm:"column:id;primaryKey"` AdditionalInfo datatypes.JSONMap `json:"additional_info" gorm:"column:additional_info"` Contact *Contact `json:"contact" gorm:"column:contact"` Description string `json:"description" gorm:"column:description"` NameID string `json:"name_id" gorm:"column:name_id;unique;index"` OrganizationID string `json:"organization_id" gorm:"column:organization_id;index"` ProductTag string `json:"product_tag" gorm:"column:product_tag;index"` Title string `json:"title" gorm:"column:title"` Visibility string `json:"visibility" gorm:"column:visibility;index"` CreatedAt time.Time `json:"created_at" gorm:"column:created_at"` UpdatedAt time.Time `json:"updated_at" gorm:"column:updated_at"` AnalyzersConfigs AnalyzerConfigMap `json:"analyzers_configs,omitempty" gorm:"column:analyzers_configs"` Summary *ServiceSummary `json:"summary" gorm:"column:summary"` }
Service represents a service
func (*Service) GetIndexValue ¶
GetIndexValue return index value for specified field
func (*Service) GetIndexValues ¶
GetIndexValues return all field index values
func (*Service) GetIndexes ¶
GetIndexes returns all the field indexes
func (*Service) GetNameID ¶
GetNameID retrieves the service name ID, using the following precedence, from:
- Service.AnalyzersConfigs[name]analyzer.ConfigServiceNameID, or
- analyzerCfg[analyzer.ConfigServiceNameID], or
- Service.NameID.
func (*Service) SetSummary ¶
func (*Service) SortableFields ¶
SortableFields returns all sortable fields
type ServiceAccessFilter ¶
type ServiceAccessFilter struct { // AccessibleOrganizationIDs contains a list of OrganizationIDs that are authorized to the user for creating & listing. AccessibleOrganizationIDs []string }
type ServicePatch ¶
type ServicePatch struct { AdditionalInfo *datatypes.JSONMap `json:"additional_info"` Contact *Contact `json:"contact"` Description *string `json:"description"` NameID *string `json:"name_id"` OrganizationID *string `json:"organization_id"` ProductTag *string `json:"product_tag"` Title *string `json:"title"` AnalyzersConfigs *AnalyzerConfigMap `json:"analyzers_configs"` Visibility *string `json:"visibility"` }
ServicePatch represents a service with patchable fields.
type ServiceResponse ¶
type ServiceResponse struct { Pagination Data []Service `json:"data"` }
ServiceResponse wrappers service response
type ServiceSummary ¶
type ServiceSummary struct { Score *int `json:"score" gorm:"column:score"` Version string `json:"version" gorm:"column:version"` Revision string `json:"revision" gorm:"column:revision"` UpdatedAt time.Time `json:"updated_at" gorm:"column:updated_at"` }
func (*ServiceSummary) Scan ¶
func (m *ServiceSummary) Scan(value interface{}) error
Scan implements sql.Scanner interface. See https://gorm.io/docs/data_types.html#Implements-Customized-Data-Type.
func (ServiceSummary) Value ¶
func (m ServiceSummary) Value() (driver.Value, error)
Value implements driver.Valuer interface. See https://gorm.io/docs/data_types.html#Implements-Customized-Data-Type.
type Spec ¶
type Spec struct { ID string `json:"id,omitempty" gorm:"primaryKey"` Doc SpecDoc `json:"doc" gorm:"column:doc"` DocCompressed []byte `json:"-" gorm:"column:doc_compressed"` DocType string `json:"doc_type" gorm:"column:doc_type"` Revision string `json:"revision" gorm:"column:revision;index"` Score *int `json:"score" gorm:"column:score"` ServiceID string `json:"service_id" gorm:"column:service_id;index"` State string `json:"state" gorm:"column:state;index"` // Archive, Release, Development, Latest Valid string `json:"valid" gorm:"column:valid"` Version string `json:"version" gorm:"column:version;index"` CreatedAt time.Time `json:"created_at" gorm:"column:created_at"` UpdatedAt time.Time `json:"updated_at" gorm:"column:updated_at"` DocOAS *openapi3.T `json:"-" gorm:"-"` // contains filtered or unexported fields }
Spec represents a spec
func (*Spec) AfterFind ¶
AfterFind is a hook called after querying by GORM (https://gorm.io/docs/hooks.html). For handling large Spec.Doc(s), if Spec.DocCompressed contains the compression, decompresses it back into Spec.Doc.
func (*Spec) AfterSave ¶
AfterSave is a hook called after creation by GORM (https://gorm.io/docs/hooks.html). For handling large Spec.Doc(s), resets the temporary staging of Spec.Doc.
func (*Spec) BeforeSave ¶
BeforeSave is a hook called before creation by GORM (https://gorm.io/docs/hooks.html). For handling large Spec.Doc(s), compressData conditionally compresses Spec.Doc into Spec.DocCompressed.
func (*Spec) GetDocAsMap ¶
GetDocAsMap unmarshals Spec.Doc into a map by first parsing as a JSON & if that fails, as a YAML.
func (*Spec) GetIndexValue ¶
GetIndexValue return index value for specified field
func (*Spec) GetIndexValues ¶
GetIndexValues return all field index values
func (*Spec) GetIndexes ¶
GetIndexes returns all the field indexes
func (*Spec) LoadDocAsOAS ¶
func (m *Spec) LoadDocAsOAS(ctx context.Context, validate, setDocType, setVersion bool) (*openapi3.T, error)
LoadDocAsOAS loads Spec.Doc as an OpenAPI spec & stores it as Spec.DocOAS. Set validate to validate Spec.DocOAS. Set setDocType to derive Spec.DocType from Spec.DocOAS.Version. Set setVersion to derive Spec.Version from Spec.DocOAS.Info.Version.
func (*Spec) SortableFields ¶
SortableFields returns all sortable fields
type SpecAnalysis ¶
type SpecAnalysis struct { ID string `json:"id,omitempty" gorm:"column:id;primaryKey"` Analyzer analyzer.SpecAnalyzer `json:"analyzer" gorm:"column:analyzer;index"` SpecAnalysisConfig SpecAnalysisResult Score *int `json:"score" gorm:"column:score"` ServiceID string `json:"service_id" gorm:"column:service_id;index:svc_spec_created_idx;index:svc_created_idx"` SpecID string `json:"spec_id" gorm:"column:spec_id;index;index:svc_spec_created_idx"` Status string `json:"status" gorm:"column:status;index"` // Submitted, Invalid, Analyzed CreatedAt time.Time `json:"created_at" gorm:"column:created_at;index:svc_spec_created_idx;index:svc_created_idx"` UpdatedAt time.Time `json:"updated_at" gorm:"column:updated_at"` }
SpecAnalysis represents a specAnalysis
func DistinctSpecAnalyses ¶
func DistinctSpecAnalyses(from []*SpecAnalysis) (to []*SpecAnalysis)
DistinctSpecAnalyses filters out duplicate (uniqueness based on SpecAnalysis.SpecID & SpecAnalysis.Analyzer) spec analyses.
func (*SpecAnalysis) AfterFind ¶
func (m *SpecAnalysis) AfterFind(tx *gorm.DB) (err error)
AfterFind is a hook called after querying by GORM (https://gorm.io/docs/hooks.html). For handling large SpecAnalysis.SpecAnalysisResult(s), if SpecAnalysisResult.RawResultCompressed contains the compression, decompresses it back into SpecAnalysisResult.RawResult.
func (*SpecAnalysis) AfterSave ¶
func (m *SpecAnalysis) AfterSave(tx *gorm.DB) (err error)
AfterSave is a hook called after creation by GORM (https://gorm.io/docs/hooks.html). For handling large SpecAnalysis.SpecAnalysisResult(s), resets the temporary staging of SpecAnalysis.SpecAnalysisResult.
func (*SpecAnalysis) BeforeCreate ¶
func (m *SpecAnalysis) BeforeCreate(tx *gorm.DB) (err error)
func (*SpecAnalysis) BeforeSave ¶
func (m *SpecAnalysis) BeforeSave(tx *gorm.DB) (err error)
BeforeSave is a hook called before creation by GORM (https://gorm.io/docs/hooks.html). For handling large SpecAnalysisResult.RawResult(s), compressData conditionally compresses SpecAnalysisResult.RawResult into SpecAnalysisResult.RawResultCompressed.
func (*SpecAnalysis) GetID ¶
func (m *SpecAnalysis) GetID() string
GetID returns the ID of specAnalysis object
func (*SpecAnalysis) GetIndex ¶
func (m *SpecAnalysis) GetIndex(field string) string
GetIndex returns an index for specific field
func (*SpecAnalysis) GetIndexValue ¶
func (m *SpecAnalysis) GetIndexValue(field string) string
GetIndexValue return index value for specified field
func (*SpecAnalysis) GetIndexValues ¶
func (m *SpecAnalysis) GetIndexValues() map[string]string
GetIndexValues return all field index values
func (*SpecAnalysis) GetIndexes ¶
func (m *SpecAnalysis) GetIndexes() map[string]string
GetIndexes returns all the field indexes
func (*SpecAnalysis) GetTags ¶
func (m *SpecAnalysis) GetTags() []string
GetTags returns all the tags
func (*SpecAnalysis) OmitResultFindings ¶
func (m *SpecAnalysis) OmitResultFindings()
func (*SpecAnalysis) SetResult ¶
func (m *SpecAnalysis) SetResult(result *analyzer.Result, status string) error
func (*SpecAnalysis) SetScore ¶
func (m *SpecAnalysis) SetScore(score int) error
func (*SpecAnalysis) Sortable ¶
func (m *SpecAnalysis) Sortable(field string) bool
Sortable checks if field is sortable.
func (*SpecAnalysis) SortableFields ¶
func (m *SpecAnalysis) SortableFields() map[string]struct{}
SortableFields returns all sortable fields
func (*SpecAnalysis) String ¶
func (m *SpecAnalysis) String() string
String returns the text representation of specAnalysis object
func (*SpecAnalysis) TableName ¶
func (m *SpecAnalysis) TableName() string
TableName implements gorm Tabler interface
type SpecAnalysisConfig ¶
type SpecAnalysisRequest ¶
type SpecAnalysisRequest struct { Analyzers []analyzer.SpecAnalyzer `json:"analyzers"` AnalyzersConfigs AnalyzerConfigMap `json:"analyzers_configs,omitempty"` Spec *Spec `json:"spec,omitempty"` Service *Service `json:"service,omitempty"` ActiveAnalyzers map[analyzer.SpecAnalyzer]*analyzer.Analyzer `json:"-"` }
SpecAnalysisRequest represents a request for a SpecAnalysis
func (*SpecAnalysisRequest) HasSpec ¶
func (m *SpecAnalysisRequest) HasSpec() bool
type SpecAnalysisResponse ¶
type SpecAnalysisResponse struct { Results map[analyzer.SpecAnalyzer]*SpecAnalysis `json:"results,omitempty"` SpecScore int `json:"spec_score"` }
type SpecAnalysisResponseWrapper ¶
type SpecAnalysisResponseWrapper struct { Pagination Data []SpecAnalysis `json:"data"` }
SpecAnalysisResponseWrapper wrappers specAnalysis response
type SpecAnalysisResult ¶
type SpecDiff ¶
type SpecDiff struct { ID string `json:"id,omitempty" gorm:"column:id;primaryKey"` *SpecDiffRequest SpecDiffResult ServiceID string `json:"service_id,omitempty" gorm:"column:service_id;index"` Status string `json:"status,omitempty" gorm:"column:status;index"` // Submitted, Invalid, Diffed CreatedAt time.Time `json:"created_at" gorm:"column:created_at"` UpdatedAt time.Time `json:"updated_at" gorm:"column:updated_at"` }
SpecDiff represents a specDiff
func (*SpecDiff) AfterFind ¶
AfterFind is a hook called after querying by GORM (https://gorm.io/docs/hooks.html). For handling large SpecDiff.SpecDiffResult(s), if SpecDiffResult.RawResultCompressed contains the compression, decompresses it back into SpecDiffResult.RawResult.
func (*SpecDiff) AfterSave ¶
AfterSave is a hook called after creation by GORM (https://gorm.io/docs/hooks.html). For handling large SpecDiff.SpecDiffResult(s), resets the temporary staging of SpecDiff.SpecDiffResult.
func (*SpecDiff) BeforeSave ¶
BeforeSave is a hook called before creation by GORM (https://gorm.io/docs/hooks.html). For handling large SpecDiffResult.RawResult(s), compressData conditionally compresses SpecDiffResult.RawResult into SpecDiffResult.RawResultCompressed.
func (*SpecDiff) GetIndexValue ¶
GetIndexValue return index value for specified field
func (*SpecDiff) GetIndexValues ¶
GetIndexValues return all field index values
func (*SpecDiff) GetIndexes ¶
GetIndexes returns all the field indexes
func (*SpecDiff) SortableFields ¶
SortableFields returns all sortable fields
type SpecDiffConfig ¶
type SpecDiffRequest ¶
type SpecDiffRequest struct { NewSpecID string `json:"new_spec_id,omitempty" gorm:"column:new_spec_id;index"` OldSpecID string `json:"old_spec_id,omitempty" gorm:"column:old_spec_id;index"` OldSpecDoc SpecDoc `json:"old_spec_doc,omitempty" gorm:"-"` NewSpecDoc SpecDoc `json:"new_spec_doc,omitempty" gorm:"-"` SpecDiffConfig }
func (*SpecDiffRequest) Compare ¶
func (r *SpecDiffRequest) Compare(with *SpecDiffRequest) bool
func (*SpecDiffRequest) HasSpecDocs ¶
func (r *SpecDiffRequest) HasSpecDocs() (hasOldSpecDoc, hasNewSpecDoc bool)
type SpecDiffResponse ¶
type SpecDiffResponse struct { Pagination Data []SpecDiff `json:"data"` }
SpecDiffResponse wrappers specDiff response
type SpecDiffResult ¶
type SpecDocAnalyzer ¶
type SpecDocAnalyzer interface {
Analyze(doc SpecDoc, cfgMap analyzer.Config, serviceNameID *string) (*analyzer.Result, error)
}
SpecDocAnalyzer represents the interface for analyzing a SpecDoc using (optional) analyzer.Config.
type SpecResponse ¶
type SpecResponse struct { Pagination Data []Spec `json:"data"` }
SpecResponse wrappers spec response
type UnauthorizedResourceAccessError ¶
type UnauthorizedResourceAccessError struct {}
func (UnauthorizedResourceAccessError) Error ¶
func (e UnauthorizedResourceAccessError) Error() string