Documentation ¶
Index ¶
- Constants
- Variables
- func NewJwtTokenClient(keyCache credloader.KeysCache, jwtSelfSignCertSecretName string, ...) *jwtTokenClient
- func NewOauthClient(oauthCfg oauth.Config, client *http.Client) *oauthClient
- func NewOauthMtlsClient(oauthCfg oauth.Config, certCache auth.CertificateCache, client *http.Client) *oauthMtlsClient
- func NewSystemFetcherAggregatorHTTPHandler(opMgr OperationsManager, businessTenantMappingSvc BusinessTenantMappingService, ...) *handler
- type APIClient
- type APIConfig
- type AggregationResource
- type Authenticator
- type BusinessTenantMappingService
- type Client
- type Config
- type DataLoader
- type DirectorGraphClient
- type Expression
- type Filter
- type FilterBuilder
- type HeaderTransport
- type OperationMaintainer
- type OperationService
- type OperationsManager
- type OperationsProcessor
- type PlaceholderMapping
- type ProductIDFilterMapping
- type Renderer
- type SlisFilter
- type SlisFilterOperationType
- type System
- type SystemFetcher
- type SystemFetcherOperationData
- type SystemFetcherOperationMaintainer
- type SystemFetcherService
- type SystemSynchronizationTimestamp
- type SystemsSyncService
- type TemplateMapping
- type TemplateRenderer
Constants ¶
const ( // SlisFilterLabelKey is the name of the slis filter label for app template SlisFilterLabelKey = "slisFilter" // ProductIDKey is the name of the property relating to system roles in system payload ProductIDKey = "productId" // TrimPrefix is the prefix which should be trimmed from the jsonpath input when building select criteria for system fetcher TrimPrefix = "$." )
const ( // LifecycleAttributeName is the lifecycle status attribute of the application in the external source response for applications retrieval. LifecycleAttributeName string = "lifecycleStatus" // LifecycleDeleted is the string matching the deleted lifecycle state of the application in the external source. LifecycleDeleted string = "DELETED" // ConcurrentDeleteOperationErrMsg is the error message returned by the Compass Director, when we try to delete an application, which is already undergoing a delete operation. ConcurrentDeleteOperationErrMsg = "Concurrent operation [reason=delete operation is in progress]" )
Variables ¶
var ( // ApplicationTemplates contains available Application Templates, should only be used for the unmarshalling of system data // It represents a model.ApplicationTemplate with its labels in the form of map[string]*model.Label ApplicationTemplates []TemplateMapping // ApplicationTemplateLabelFilter represent a label for the Application Templates which has a value that // should match to the SystemSourceKey's value of the fetched systems ApplicationTemplateLabelFilter string // SelectFilter represents the select filter that determines which properties of a system will be fetched SelectFilter []string // SystemSourceKey represents a key for filtering systems SystemSourceKey string )
Functions ¶
func NewJwtTokenClient ¶
func NewJwtTokenClient(keyCache credloader.KeysCache, jwtSelfSignCertSecretName string, client *http.Client) *jwtTokenClient
NewJwtTokenClient creates a jwt token client
func NewOauthClient ¶
NewOauthClient missing docs
func NewOauthMtlsClient ¶
func NewOauthMtlsClient(oauthCfg oauth.Config, certCache auth.CertificateCache, client *http.Client) *oauthMtlsClient
NewOauthMtlsClient missing docs
func NewSystemFetcherAggregatorHTTPHandler ¶
func NewSystemFetcherAggregatorHTTPHandler(opMgr OperationsManager, businessTenantMappingSvc BusinessTenantMappingService, transact persistence.Transactioner, onDemandChannel chan string, workers chan struct{}) *handler
NewSystemFetcherAggregatorHTTPHandler returns a new HTTP handler, responsible for handling HTTP requests
Types ¶
type APIConfig ¶
type APIConfig struct { Endpoint string `envconfig:"APP_SYSTEM_INFORMATION_ENDPOINT"` FilterCriteria string `envconfig:"APP_SYSTEM_INFORMATION_FILTER_CRITERIA"` Timeout time.Duration `envconfig:"APP_SYSTEM_INFORMATION_FETCH_TIMEOUT"` PageSize uint64 `envconfig:"APP_SYSTEM_INFORMATION_PAGE_SIZE"` PagingSkipParam string `envconfig:"APP_SYSTEM_INFORMATION_PAGE_SKIP_PARAM"` PagingSizeParam string `envconfig:"APP_SYSTEM_INFORMATION_PAGE_SIZE_PARAM"` SystemSourceKey string `envconfig:"APP_SYSTEM_INFORMATION_SOURCE_KEY"` SystemRPSLimit uint64 `envconfig:"default=15,APP_SYSTEM_INFORMATION_RPS_LIMIT"` }
APIConfig missing godoc
type AggregationResource ¶
type AggregationResource struct { TenantIDs []string `json:"tenantIDs"` SkipReschedule bool `json:"skipReschedule"` }
AggregationResource holds id of tenant for systems fetching
type Authenticator ¶
Authenticator missing godoc
type BusinessTenantMappingService ¶
type BusinessTenantMappingService interface { List(ctx context.Context) ([]*model.BusinessTenantMapping, error) GetTenantByID(ctx context.Context, id string) (*model.BusinessTenantMapping, error) GetTenantByExternalID(ctx context.Context, id string) (*model.BusinessTenantMapping, error) }
BusinessTenantMappingService responsible for the service-layer tenant operations
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client missing godoc
func (*Client) FetchSystemsForTenant ¶
func (c *Client) FetchSystemsForTenant(ctx context.Context, tenant *model.BusinessTenantMapping, systemSynchronizationTimestamps map[string]SystemSynchronizationTimestamp) ([]System, error)
FetchSystemsForTenant fetches systems from the service
type Config ¶
type Config struct { DirectorGraphqlURL string `envconfig:"APP_DIRECTOR_GRAPHQL_URL"` DirectorRequestTimeout time.Duration `envconfig:"default=30s,APP_DIRECTOR_REQUEST_TIMEOUT"` DirectorSkipSSLValidation bool `envconfig:"default=false,APP_DIRECTOR_SKIP_SSL_VALIDATION"` EnableSystemDeletion bool `envconfig:"default=true,APP_ENABLE_SYSTEM_DELETION"` OperationalMode string `envconfig:"APP_OPERATIONAL_MODE"` AsyncRequestProcessors int `envconfig:"default=100,APP_ASYNC_REQUEST_PROCESSORS"` TemplatesFileLocation string `envconfig:"optional,APP_TEMPLATES_FILE_LOCATION"` VerifyTenant string `envconfig:"optional,APP_VERIFY_TENANT"` }
Config holds the configuration available for the SystemFetcher.
type DataLoader ¶
type DataLoader struct {
// contains filtered or unexported fields
}
DataLoader loads and creates all the necessary data needed by system-fetcher
func NewDataLoader ¶
func NewDataLoader(tx persistence.Transactioner, cfg Config, appTmplSvc appTmplService, intSysSvc intSysSvc, webhookSvc webhookService) *DataLoader
NewDataLoader creates new DataLoader
type DirectorGraphClient ¶
type DirectorGraphClient struct { *gcli.Client Authenticator Authenticator }
DirectorGraphClient missing godoc
func (*DirectorGraphClient) DeleteSystemAsync ¶
func (d *DirectorGraphClient) DeleteSystemAsync(ctx context.Context, id, tenantID string) error
DeleteSystemAsync missing godoc
type Expression ¶
Expression represents the single check expression
type Filter ¶
type Filter struct {
Expressions []Expression
}
Filter is the set of single expressions which will be concatenated when building the query
type FilterBuilder ¶
type FilterBuilder struct {
Filters []Filter
}
FilterBuilder builds the filter query from given expressions
func (*FilterBuilder) NewExpression ¶
func (b *FilterBuilder) NewExpression(key, operation, value string) Expression
NewExpression returns new filter expression based on the given arguments
type HeaderTransport ¶
type HeaderTransport struct {
// contains filtered or unexported fields
}
HeaderTransport missing godoc
type OperationMaintainer ¶
OperationMaintainer is responsible for maintaining of different types of operations.
func NewOperationMaintainer ¶
func NewOperationMaintainer(kind model.OperationType, transact persistence.Transactioner, opSvc OperationService, businessTenantMappingSvc BusinessTenantMappingService) OperationMaintainer
NewOperationMaintainer creates OperationMaintainer based on kind
type OperationService ¶
type OperationService interface { CreateMultiple(ctx context.Context, in []*model.OperationInput) error DeleteMultiple(ctx context.Context, ids []string) error ListAllByType(ctx context.Context, opType model.OperationType) ([]*model.Operation, error) }
OperationService is responsible for the service-layer Operation operations.
type OperationsManager ¶
type OperationsManager interface { FindOperationByData(ctx context.Context, data interface{}) (*model.Operation, error) CreateOperation(ctx context.Context, in *model.OperationInput) (string, error) RescheduleOperation(ctx context.Context, operationID string) error }
OperationsManager provides methods for operations management
type OperationsProcessor ¶
type OperationsProcessor struct {
SystemFetcherSvc SystemFetcherService
}
OperationsProcessor defines Open Resource Discovery operation processor
type PlaceholderMapping ¶
type PlaceholderMapping struct { PlaceholderName string `json:"placeholder_name"` SystemKey string `json:"system_key"` Optional bool `json:"optional"` }
PlaceholderMapping is the mapping we have between a placeholder key we use in templates, and input field from the external system provider.
type ProductIDFilterMapping ¶
type ProductIDFilterMapping struct { ProductID string `json:"productID"` Filter []SlisFilter `json:"filter,omitempty"` }
ProductIDFilterMapping represents the structure of the slis filter per product id
type Renderer ¶
type Renderer struct {
// contains filtered or unexported fields
}
Renderer ts the applicaiotn template renderer helper
func NewTemplateRenderer ¶
func NewTemplateRenderer(appTemplateService applicationTemplateService, appConverter applicationConverter, appInputOverride string, mapping []PlaceholderMapping) (*Renderer, error)
NewTemplateRenderer returns a new application input renderer by a given application template.
func (*Renderer) ApplicationRegisterInputFromTemplate ¶
func (r *Renderer) ApplicationRegisterInputFromTemplate(ctx context.Context, sc System) (*model.ApplicationRegisterInput, error)
ApplicationRegisterInputFromTemplate creates ApplicationRegisterInput from System
func (*Renderer) GenerateAppRegisterInput ¶
func (r *Renderer) GenerateAppRegisterInput(ctx context.Context, sc System, appTemplate *model.ApplicationTemplate, overridePlaceholders bool) (*model.ApplicationRegisterInput, error)
GenerateAppRegisterInput creates a ApplicationRegisterInput based on an ApplicationTemplate
type SlisFilter ¶
type SlisFilter struct { Key string `json:"key"` Value []string `json:"value"` Operation SlisFilterOperationType `json:"operation"` }
SlisFilter represents the additional properties by which fetched systems are matched to an application template
type SlisFilterOperationType ¶
type SlisFilterOperationType string
SlisFilterOperationType represents the type of operation which considers whether to match the values in the slis filter with values for systems from system payload
const ( // IncludeOperationType is the type of slis filter operation which requires the values from slis filter to be present in the values from system payload IncludeOperationType SlisFilterOperationType = "include" // ExcludeOperationType is the type of slis filter operation which requires the values from slis filter to not be present in the values from system payload ExcludeOperationType SlisFilterOperationType = "exclude" )
type System ¶
type System struct { SystemPayload map[string]interface{} TemplateID string `json:"-"` StatusCondition model.ApplicationStatusCondition `json:"-"` }
System missing godoc
func (*System) EnhanceWithTemplateID ¶
EnhanceWithTemplateID tries to find an Application Template ID for the system and attach it to the object.
func (*System) UnmarshalJSON ¶
UnmarshalJSON missing godoc
type SystemFetcher ¶
type SystemFetcher struct {
// contains filtered or unexported fields
}
SystemFetcher is responsible for synchronizing the existing applications in Compass and a pre-defined external source.
func NewSystemFetcher ¶
func NewSystemFetcher(tx persistence.Transactioner, ts tenantService, ss systemsService, sSync SystemsSyncService, tr TemplateRenderer, sac systemsAPIClient, directorClient directorClient, config Config) *SystemFetcher
NewSystemFetcher returns a new SystemFetcher.
func (*SystemFetcher) ProcessTenant ¶
func (s *SystemFetcher) ProcessTenant(ctx context.Context, tenantID string) error
ProcessTenant performs resync of systems for provided tenant
func (*SystemFetcher) SetTemplateRenderer ¶
func (s *SystemFetcher) SetTemplateRenderer(templateRenderer TemplateRenderer)
SetTemplateRenderer replaces the current template renderer
func (*SystemFetcher) UpsertSystemsSyncTimestampsForTenant ¶
func (s *SystemFetcher) UpsertSystemsSyncTimestampsForTenant(ctx context.Context, tenant string, timestamps map[string]SystemSynchronizationTimestamp) error
UpsertSystemsSyncTimestampsForTenant updates the synchronization timestamps of the systems for each tenant or creates new ones if they don't exist in the database
type SystemFetcherOperationData ¶
type SystemFetcherOperationData struct {
TenantID string `json:"tenantID"`
}
SystemFetcherOperationData represents system fetcher operation data.
func NewSystemFetcherOperationData ¶
func NewSystemFetcherOperationData(tenantID string) *SystemFetcherOperationData
NewSystemFetcherOperationData creates new SystemFetcherOperationData.
func ParseSystemFetcherOperationData ¶
func ParseSystemFetcherOperationData(data []byte) (*SystemFetcherOperationData, error)
ParseSystemFetcherOperationData creates new SystemFetcherOperationData from byte array.
func (*SystemFetcherOperationData) Equal ¶
func (b *SystemFetcherOperationData) Equal(other *SystemFetcherOperationData) bool
Equal returns true if current data content is the same as other's data content
func (*SystemFetcherOperationData) GetData ¶
func (b *SystemFetcherOperationData) GetData() (string, error)
GetData builds system fetcher operation data
type SystemFetcherOperationMaintainer ¶
type SystemFetcherOperationMaintainer struct {
// contains filtered or unexported fields
}
SystemFetcherOperationMaintainer consists of various resource services responsible for operations creation.
type SystemFetcherService ¶
type SystemFetcherService interface { ProcessTenant(ctx context.Context, tenantID string) error SetTemplateRenderer(templateRenderer TemplateRenderer) }
SystemFetcherService responsible for the service-layer operations of system fetcher
type SystemSynchronizationTimestamp ¶
SystemSynchronizationTimestamp represents the last synchronization time of a system
type SystemsSyncService ¶
type SystemsSyncService interface { ListByTenant(ctx context.Context, tenant string) ([]*model.SystemSynchronizationTimestamp, error) Upsert(ctx context.Context, in *model.SystemSynchronizationTimestamp) error }
SystemsSyncService is the service for managing systems synchronization timestamps
type TemplateMapping ¶
type TemplateMapping struct { AppTemplate *model.ApplicationTemplate Labels map[string]*model.Label Renderer TemplateRenderer }
TemplateMapping holds data for Application Templates and their Labels
type TemplateRenderer ¶
type TemplateRenderer interface { GenerateAppRegisterInput(ctx context.Context, sc System, appTemplate *model.ApplicationTemplate, overridePlaceholders bool) (*model.ApplicationRegisterInput, error) ApplicationRegisterInputFromTemplate(ctx context.Context, sc System) (*model.ApplicationRegisterInput, error) }
TemplateRenderer is a service for go templating on Application Input JSON