Documentation
¶
Index ¶
- Constants
- Variables
- func GetAuditLog(userid int32) sql.AuditLog
- func GetIdentifierKey(selector QualifierSelector, ...) int
- func GetMappingsForAppEnv(selection *ResourceMappingSelection, ...) (*QualifierMapping, []*QualifierMapping)
- func GetNumOfChildQualifiers(qualifier Qualifier) int
- func GetQualifierMappingsForCompoundQualifier(selection *ResourceMappingSelection, ...) (*QualifierMapping, []*QualifierMapping)
- func GetValuesFromSelectionIdentifier(selector QualifierSelector, selectionIdentifier *SelectionIdentifier) (int, string)
- type Qualifier
- type QualifierMapping
- type QualifierMappingService
- type QualifierMappingServiceImpl
- func (impl QualifierMappingServiceImpl) CreateMappings(tx *pg.Tx, userId int32, resourceType ResourceType, resourceIds []int, ...) error
- func (impl QualifierMappingServiceImpl) CreateMappingsForSelections(tx *pg.Tx, userId int32, resourceMappingSelections []*ResourceMappingSelection) ([]*ResourceMappingSelection, error)
- func (impl QualifierMappingServiceImpl) CreateQualifierMappings(qualifierMappings []*QualifierMapping, tx *pg.Tx) ([]*QualifierMapping, error)
- func (impl QualifierMappingServiceImpl) DeleteAllByIds(qualifierMappingIds []int, userId int32, tx *pg.Tx) error
- func (impl QualifierMappingServiceImpl) DeleteAllQualifierMappings(resourceType ResourceType, auditLog sql.AuditLog, tx *pg.Tx) error
- func (impl QualifierMappingServiceImpl) DeleteByIdentifierKeyValue(resourceType ResourceType, identifierKey int, identifierValue int, ...) error
- func (impl QualifierMappingServiceImpl) DeleteResourceMappingsForScopes(tx *pg.Tx, userId int32, resourceType ResourceType, ...) error
- func (impl QualifierMappingServiceImpl) GetQualifierMappings(resourceType ResourceType, scope *Scope, resourceIds []int) ([]*QualifierMapping, error)
- func (impl QualifierMappingServiceImpl) GetResourceMappingsForResources(resourceType ResourceType, resourceIds []int, ...) ([]ResourceQualifierMappings, error)
- func (impl QualifierMappingServiceImpl) GetResourceMappingsForSelections(resourceType ResourceType, qualifierSelector QualifierSelector, ...) ([]ResourceQualifierMappings, error)
- type QualifierSelector
- type QualifiersMappingRepository
- type QualifiersMappingRepositoryImpl
- func (repo *QualifiersMappingRepositoryImpl) CreateQualifierMappings(qualifierMappings []*QualifierMapping, tx *pg.Tx) ([]*QualifierMapping, error)
- func (repo *QualifiersMappingRepositoryImpl) DeleteAllByIds(qualifierMappingIds []int, auditLog sql.AuditLog, tx *pg.Tx) error
- func (repo *QualifiersMappingRepositoryImpl) DeleteAllQualifierMappings(resourceType ResourceType, auditLog sql.AuditLog, tx *pg.Tx) error
- func (repo *QualifiersMappingRepositoryImpl) DeleteByResourceTypeIdentifierKeyAndValue(resourceType ResourceType, identifierKey int, identifierValue int, ...) error
- func (repo *QualifiersMappingRepositoryImpl) GetDbConnection() *pg.DB
- func (repo *QualifiersMappingRepositoryImpl) GetMappingsByResourceTypeAndIdsAndQualifierId(resourceType ResourceType, resourceIds []int, qualifier int) ([]*QualifierMapping, error)
- func (repo *QualifiersMappingRepositoryImpl) GetQualifierMappings(resourceType ResourceType, scope *Scope, ...) ([]*QualifierMapping, error)
- func (repo *QualifiersMappingRepositoryImpl) GetQualifierMappingsForListOfQualifierValues(resourceType ResourceType, valuesMap map[Qualifier][][]int, ...) ([]*QualifierMapping, error)
- type ResourceMappingSelection
- type ResourceQualifierMappings
- type ResourceType
- type Scope
- type SelectionIdentifier
- type SelectionIdentifierName
- type SystemMetadata
- type SystemVariableName
Constants ¶
View Source
const ( Variable ResourceType = 0 Filter = 1 ImageDigest = 2 ImageDigestResourceId = -1 // for ImageDigest resource id will is constant unlike filter and variables InfraProfile = 3 ImagePromotionPolicy ResourceType = 4 DeploymentWindow ResourceType = 5 )
Variables ¶
View Source
var CompoundQualifiers []Qualifier
View Source
var SystemVariables = []SystemVariableName{ DevtronNamespace, DevtronClusterName, DevtronEnvName, DevtronImageTag, DevtronAppName, DevtronImage, }
Functions ¶
func GetAuditLog ¶ added in v0.7.1
func GetIdentifierKey ¶ added in v0.7.0
func GetIdentifierKey(selector QualifierSelector, searchableKeyNameIdMap map[bean.DevtronResourceSearchableKeyName]int) int
func GetMappingsForAppEnv ¶ added in v0.7.0
func GetMappingsForAppEnv(selection *ResourceMappingSelection, resourceKeyMap map[bean.DevtronResourceSearchableKeyName]int, userId int32) (*QualifierMapping, []*QualifierMapping)
func GetNumOfChildQualifiers ¶
func GetQualifierMappingsForCompoundQualifier ¶ added in v0.7.0
func GetQualifierMappingsForCompoundQualifier(selection *ResourceMappingSelection, resourceKeyMap map[bean.DevtronResourceSearchableKeyName]int, userId int32) (*QualifierMapping, []*QualifierMapping)
func GetValuesFromSelectionIdentifier ¶ added in v0.7.0
func GetValuesFromSelectionIdentifier(selector QualifierSelector, selectionIdentifier *SelectionIdentifier) (int, string)
Types ¶
type Qualifier ¶
type Qualifier int
func GetQualifierIdForSelector ¶ added in v0.7.0
func GetQualifierIdForSelector(selector QualifierSelector) Qualifier
type QualifierMapping ¶
type QualifierMapping struct {
Id int `sql:"id,pk"`
ResourceId int `sql:"resource_id"`
ResourceType ResourceType `sql:"resource_type"`
QualifierId int `sql:"qualifier_id"`
IdentifierKey int `sql:"identifier_key"`
IdentifierValueInt int `sql:"identifier_value_int"`
Active bool `sql:"active"`
IdentifierValueString string `sql:"identifier_value_string"`
ParentIdentifier int `sql:"parent_identifier"`
CompositeKey string `sql:"-"`
// Data string `sql:"-"`
// VariableData *VariableData
sql.AuditLog
// contains filtered or unexported fields
}
func (*QualifierMapping) GetIdValueAndName ¶ added in v0.7.0
func (mapping *QualifierMapping) GetIdValueAndName() (int, string)
type QualifierMappingService ¶
type QualifierMappingService interface {
CreateQualifierMappings(qualifierMappings []*QualifierMapping, tx *pg.Tx) ([]*QualifierMapping, error)
GetQualifierMappings(resourceType ResourceType, scope *Scope, resourceIds []int) ([]*QualifierMapping, error)
DeleteAllQualifierMappings(resourceType ResourceType, auditLog sql.AuditLog, tx *pg.Tx) error
DeleteByIdentifierKeyValue(resourceType ResourceType, identifierKey int, identifierValue int, auditLog sql.AuditLog, tx *pg.Tx) error
DeleteAllByIds(qualifierMappingIds []int, userId int32, tx *pg.Tx) error
DeleteResourceMappingsForScopes(tx *pg.Tx, userId int32, resourceType ResourceType, qualifierSelector QualifierSelector, scopes []*SelectionIdentifier) error
CreateMappingsForSelections(tx *pg.Tx, userId int32, resourceMappingSelections []*ResourceMappingSelection) ([]*ResourceMappingSelection, error)
CreateMappings(tx *pg.Tx, userId int32, resourceType ResourceType, resourceIds []int, qualifierSelector QualifierSelector, selectionIdentifiers []*SelectionIdentifier) error
GetResourceMappingsForSelections(resourceType ResourceType, qualifierSelector QualifierSelector, selectionIdentifiers []*SelectionIdentifier) ([]ResourceQualifierMappings, error)
GetResourceMappingsForResources(resourceType ResourceType, resourceIds []int, qualifierSelector QualifierSelector) ([]ResourceQualifierMappings, error)
}
type QualifierMappingServiceImpl ¶
type QualifierMappingServiceImpl struct {
// contains filtered or unexported fields
}
func NewQualifierMappingServiceImpl ¶
func NewQualifierMappingServiceImpl(logger *zap.SugaredLogger, qualifierMappingRepository QualifiersMappingRepository, devtronResourceSearchableKeyService read.DevtronResourceSearchableKeyService) (*QualifierMappingServiceImpl, error)
func (QualifierMappingServiceImpl) CreateMappings ¶ added in v0.7.0
func (impl QualifierMappingServiceImpl) CreateMappings(tx *pg.Tx, userId int32, resourceType ResourceType, resourceIds []int, qualifierSelector QualifierSelector, selectionIdentifiers []*SelectionIdentifier) error
func (QualifierMappingServiceImpl) CreateMappingsForSelections ¶ added in v0.7.0
func (impl QualifierMappingServiceImpl) CreateMappingsForSelections(tx *pg.Tx, userId int32, resourceMappingSelections []*ResourceMappingSelection) ([]*ResourceMappingSelection, error)
func (QualifierMappingServiceImpl) CreateQualifierMappings ¶
func (impl QualifierMappingServiceImpl) CreateQualifierMappings(qualifierMappings []*QualifierMapping, tx *pg.Tx) ([]*QualifierMapping, error)
func (QualifierMappingServiceImpl) DeleteAllByIds ¶ added in v0.7.0
func (QualifierMappingServiceImpl) DeleteAllQualifierMappings ¶
func (impl QualifierMappingServiceImpl) DeleteAllQualifierMappings(resourceType ResourceType, auditLog sql.AuditLog, tx *pg.Tx) error
func (QualifierMappingServiceImpl) DeleteByIdentifierKeyValue ¶ added in v0.6.28
func (impl QualifierMappingServiceImpl) DeleteByIdentifierKeyValue(resourceType ResourceType, identifierKey int, identifierValue int, auditLog sql.AuditLog, tx *pg.Tx) error
func (QualifierMappingServiceImpl) DeleteResourceMappingsForScopes ¶ added in v0.7.0
func (impl QualifierMappingServiceImpl) DeleteResourceMappingsForScopes(tx *pg.Tx, userId int32, resourceType ResourceType, qualifierSelector QualifierSelector, scopes []*SelectionIdentifier) error
func (QualifierMappingServiceImpl) GetQualifierMappings ¶
func (impl QualifierMappingServiceImpl) GetQualifierMappings(resourceType ResourceType, scope *Scope, resourceIds []int) ([]*QualifierMapping, error)
func (QualifierMappingServiceImpl) GetResourceMappingsForResources ¶ added in v0.7.0
func (impl QualifierMappingServiceImpl) GetResourceMappingsForResources(resourceType ResourceType, resourceIds []int, qualifierSelector QualifierSelector) ([]ResourceQualifierMappings, error)
func (QualifierMappingServiceImpl) GetResourceMappingsForSelections ¶ added in v0.7.0
func (impl QualifierMappingServiceImpl) GetResourceMappingsForSelections(resourceType ResourceType, qualifierSelector QualifierSelector, selectionIdentifiers []*SelectionIdentifier) ([]ResourceQualifierMappings, error)
type QualifierSelector ¶ added in v0.7.0
type QualifierSelector int
const ( ApplicationSelector QualifierSelector = 0 EnvironmentSelector QualifierSelector = 1 ClusterSelector QualifierSelector = 2 ApplicationEnvironmentSelector QualifierSelector = 3 GlobalSelector QualifierSelector = 4 )
func GetSelectorFromKey ¶ added in v0.7.0
func GetSelectorFromKey(key int, searchableKeyIdNameMap map[int]bean.DevtronResourceSearchableKeyName) QualifierSelector
type QualifiersMappingRepository ¶
type QualifiersMappingRepository interface {
//transaction util funcs
sql.TransactionWrapper
CreateQualifierMappings(qualifierMappings []*QualifierMapping, tx *pg.Tx) ([]*QualifierMapping, error)
GetQualifierMappings(resourceType ResourceType, scope *Scope, searchableIdMap map[bean.DevtronResourceSearchableKeyName]int, resourceIds []int) ([]*QualifierMapping, error)
DeleteAllQualifierMappings(ResourceType, sql.AuditLog, *pg.Tx) error
DeleteByResourceTypeIdentifierKeyAndValue(resourceType ResourceType, identifierKey int, identifierValue int, auditLog sql.AuditLog, tx *pg.Tx) error
DeleteAllByIds(qualifierMappingIds []int, auditLog sql.AuditLog, tx *pg.Tx) error
GetDbConnection() *pg.DB
GetMappingsByResourceTypeAndIdsAndQualifierId(resourceType ResourceType, resourceIds []int, qualifier int) ([]*QualifierMapping, error)
GetQualifierMappingsForListOfQualifierValues(resourceType ResourceType, valuesMap map[Qualifier][][]int, searchableIdMap map[bean.DevtronResourceSearchableKeyName]int, resourceIds []int) ([]*QualifierMapping, error)
}
type QualifiersMappingRepositoryImpl ¶
type QualifiersMappingRepositoryImpl struct {
*sql.TransactionUtilImpl
// contains filtered or unexported fields
}
func NewQualifiersMappingRepositoryImpl ¶
func NewQualifiersMappingRepositoryImpl(dbConnection *pg.DB, logger *zap.SugaredLogger, TransactionUtilImpl *sql.TransactionUtilImpl) (*QualifiersMappingRepositoryImpl, error)
func (*QualifiersMappingRepositoryImpl) CreateQualifierMappings ¶
func (repo *QualifiersMappingRepositoryImpl) CreateQualifierMappings(qualifierMappings []*QualifierMapping, tx *pg.Tx) ([]*QualifierMapping, error)
func (*QualifiersMappingRepositoryImpl) DeleteAllByIds ¶ added in v0.7.0
func (*QualifiersMappingRepositoryImpl) DeleteAllQualifierMappings ¶
func (repo *QualifiersMappingRepositoryImpl) DeleteAllQualifierMappings(resourceType ResourceType, auditLog sql.AuditLog, tx *pg.Tx) error
func (*QualifiersMappingRepositoryImpl) DeleteByResourceTypeIdentifierKeyAndValue ¶ added in v0.6.28
func (repo *QualifiersMappingRepositoryImpl) DeleteByResourceTypeIdentifierKeyAndValue(resourceType ResourceType, identifierKey int, identifierValue int, auditLog sql.AuditLog, tx *pg.Tx) error
func (*QualifiersMappingRepositoryImpl) GetDbConnection ¶ added in v0.6.28
func (repo *QualifiersMappingRepositoryImpl) GetDbConnection() *pg.DB
func (*QualifiersMappingRepositoryImpl) GetMappingsByResourceTypeAndIdsAndQualifierId ¶ added in v0.7.0
func (repo *QualifiersMappingRepositoryImpl) GetMappingsByResourceTypeAndIdsAndQualifierId(resourceType ResourceType, resourceIds []int, qualifier int) ([]*QualifierMapping, error)
func (*QualifiersMappingRepositoryImpl) GetQualifierMappings ¶
func (repo *QualifiersMappingRepositoryImpl) GetQualifierMappings(resourceType ResourceType, scope *Scope, searchableIdMap map[bean.DevtronResourceSearchableKeyName]int, resourceIds []int) ([]*QualifierMapping, error)
func (*QualifiersMappingRepositoryImpl) GetQualifierMappingsForListOfQualifierValues ¶ added in v0.7.0
func (repo *QualifiersMappingRepositoryImpl) GetQualifierMappingsForListOfQualifierValues(resourceType ResourceType, valuesMap map[Qualifier][][]int, searchableIdMap map[bean.DevtronResourceSearchableKeyName]int, resourceIds []int) ([]*QualifierMapping, error)
type ResourceMappingSelection ¶ added in v0.7.0
type ResourceMappingSelection struct {
ResourceType ResourceType
ResourceId int
QualifierSelector QualifierSelector
SelectionIdentifier *SelectionIdentifier
Id int
}
type ResourceQualifierMappings ¶ added in v0.7.0
type ResourceQualifierMappings struct {
ResourceId int
ResourceType ResourceType
SelectionIdentifier *SelectionIdentifier
}
type ResourceType ¶
type ResourceType int
type Scope ¶
type Scope struct {
AppId int `json:"appId"`
EnvId int `json:"envId"`
ClusterId int `json:"clusterId"`
PipelineId int `json:"pipelineId"`
SystemMetadata *SystemMetadata `json:"-"`
}
type SelectionIdentifier ¶ added in v0.7.0
type SelectionIdentifier struct {
AppId int `json:"appId"`
EnvId int `json:"envId"`
ClusterId int `json:"clusterId"`
SelectionIdentifierName *SelectionIdentifierName `json:"-"`
}
type SelectionIdentifierName ¶ added in v0.7.0
type SystemMetadata ¶
type SystemMetadata struct {
EnvironmentName string
ClusterName string
Namespace string
ImageTag string
Image string
AppName string
}
func (*SystemMetadata) GetDataFromSystemVariable ¶
func (metadata *SystemMetadata) GetDataFromSystemVariable(variable SystemVariableName) string
type SystemVariableName ¶
type SystemVariableName string
const ( DevtronNamespace SystemVariableName = "DEVTRON_NAMESPACE" DevtronClusterName SystemVariableName = "DEVTRON_CLUSTER_NAME" DevtronEnvName SystemVariableName = "DEVTRON_ENV_NAME" DevtronImageTag SystemVariableName = "DEVTRON_IMAGE_TAG" DevtronImage SystemVariableName = "DEVTRON_IMAGE" DevtronAppName SystemVariableName = "DEVTRON_APP_NAME" )
Source Files
¶
Click to show internal directories.
Click to hide internal directories.