ord

package
v0.0.0-...-6d13c91 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 30, 2024 License: Apache-2.0 Imports: 36 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ErrorSeverity is one of the severity levels of a validation error
	ErrorSeverity = "error"
	// WarningSeverity is one of the severity levels of a validation error
	WarningSeverity = "warning"
)
View Source
const (
	// TenantMappingCustomTypeIdentifier represents an identifier for tenant mapping webhooks in Credential exchange strategies
	TenantMappingCustomTypeIdentifier = "sap.ucl:tenant-mapping"

	// ValidationErrorMsg is the error message for validation error in ORD Documents
	ValidationErrorMsg = "error validating ORD documents"
	// ProcessingErrorMsg is the error message for processing error in ORD Documents
	ProcessingErrorMsg = "error processing ORD documents"
)
View Source
const SpecVersion = "1.8.5"

SpecVersion is used to track the currently adopted ORD spec version This constant must be updated every time a newer version of the spec is adopted

View Source
const WellKnownEndpoint = "/.well-known/open-resource-discovery"

WellKnownEndpoint is the single entry point for the discovery.

Variables

This section is empty.

Functions

func HashObject

func HashObject(obj interface{}) (uint64, error)

HashObject hashes the given object

func NewGlobalRegistryService

func NewGlobalRegistryService(transact persistence.Transactioner, config GlobalRegistryConfig, vendorService GlobalVendorService, productService GlobalProductService, ordClient Client, credentialExchangeStrategyTenantMappings map[string]CredentialExchangeStrategyTenantMapping, documentValidator Validator) *globalRegistryService

NewGlobalRegistryService creates new instance of GlobalRegistryService.

func NewORDAggregatorHTTPHandler

func NewORDAggregatorHTTPHandler(opMgr OperationsManager, appSvc ApplicationService, webhookSvc WebhookService, transact persistence.Transactioner, onDemandChannel chan string) *handler

NewORDAggregatorHTTPHandler returns a new HTTP handler, responsible for handling HTTP requests

Types

type APIProcessor

type APIProcessor interface {
	Process(ctx context.Context, resourceType resource.Type, resourceID string, bundlesFromDB []*model.Bundle, packagesFromDB []*model.Package, apis []*model.APIDefinitionInput, resourceHashes map[string]uint64) ([]*model.APIDefinition, []*processor.OrdFetchRequest, error)
}

APIProcessor is responsible for processing of api entities.

type APIService

type APIService interface {
	Create(ctx context.Context, resourceType resource.Type, resourceID string, bundleID, packageID *string, in model.APIDefinitionInput, spec []*model.SpecInput, targetURLsPerBundle map[string]string, apiHash uint64, defaultBundleID string) (string, error)
	UpdateInManyBundles(ctx context.Context, resourceType resource.Type, id string, packageID *string, in model.APIDefinitionInput, specIn *model.SpecInput, defaultTargetURLPerBundle map[string]string, defaultTargetURLPerBundleToBeCreated map[string]string, bundleIDsToBeDeleted []string, apiHash uint64, defaultBundleID string) error
	Delete(ctx context.Context, resourceType resource.Type, id string) error
	ListByApplicationID(ctx context.Context, appID string) ([]*model.APIDefinition, error)
	ListByApplicationTemplateVersionID(ctx context.Context, appTemplateVersionID string) ([]*model.APIDefinition, error)
}

APIService is responsible for the service-layer API operations.

type AggregationResources

type AggregationResources struct {
	ApplicationID         string `json:"applicationID"`
	ApplicationTemplateID string `json:"applicationTemplateID"`
}

AggregationResources holds ids of resources for ord data aggregation

type ApplicationService

type ApplicationService interface {
	Get(ctx context.Context, id string) (*model.Application, error)
	GetGlobalByID(ctx context.Context, id string) (*model.Application, error)
	ListAllByApplicationTemplateID(ctx context.Context, applicationTemplateID string) ([]*model.Application, error)
	Update(ctx context.Context, id string, in model.ApplicationUpdateInput) error
}

ApplicationService is responsible for the service-layer Application operations.

type ApplicationTemplateService

type ApplicationTemplateService interface {
	Get(ctx context.Context, id string) (*model.ApplicationTemplate, error)
}

ApplicationTemplateService is responsible for the service-layer Application Template operations

type ApplicationTemplateVersionService

type ApplicationTemplateVersionService interface {
	GetByAppTemplateIDAndVersion(ctx context.Context, id, version string) (*model.ApplicationTemplateVersion, error)
	ListByAppTemplateID(ctx context.Context, appTemplateID string) ([]*model.ApplicationTemplateVersion, error)
	Create(ctx context.Context, appTemplateID string, item *model.ApplicationTemplateVersionInput) (string, error)
	Update(ctx context.Context, id, appTemplateID string, in model.ApplicationTemplateVersionInput) error
}

ApplicationTemplateVersionService is responsible for the service-layer Application Template Version operations

type BundleReferenceService

type BundleReferenceService interface {
	GetBundleIDsForObject(ctx context.Context, objectType model.BundleReferenceObjectType, objectID *string) ([]string, error)
}

BundleReferenceService is responsible for the service-layer BundleReference operations.

type BundleService

type BundleService interface {
	CreateBundle(ctx context.Context, resourceType resource.Type, resourceID string, in model.BundleCreateInput, bndlHash uint64) (string, error)
	UpdateBundle(ctx context.Context, resourceType resource.Type, id string, in model.BundleUpdateInput, bndlHash uint64) error
	Delete(ctx context.Context, resourceType resource.Type, id string) error
	ListByApplicationIDNoPaging(ctx context.Context, appID string) ([]*model.Bundle, error)
	ListByApplicationTemplateVersionIDNoPaging(ctx context.Context, appTemplateVersionID string) ([]*model.Bundle, error)
}

BundleService is responsible for the service-layer Bundle operations.

type CapabilityProcessor

type CapabilityProcessor interface {
	Process(ctx context.Context, resourceType resource.Type, resourceID string, packagesFromDB []*model.Package, capabilities []*model.CapabilityInput, resourceHashes map[string]uint64) ([]*model.Capability, []*processor.OrdFetchRequest, error)
}

CapabilityProcessor is responsible for processing of capability entities.

type CapabilityService

type CapabilityService interface {
	ListByApplicationID(ctx context.Context, appID string) ([]*model.Capability, error)
	ListByApplicationTemplateVersionID(ctx context.Context, appTemplateVersionID string) ([]*model.Capability, error)
}

CapabilityService is responsible for the service-layer Capability operations.

type Client

type Client interface {
	FetchOpenResourceDiscoveryDocuments(ctx context.Context, resource Resource, webhook *model.Webhook, ordWebhookMapping application.ORDWebhookMapping, appBaseURL directorwh.OpenResourceDiscoveryWebhookRequestObject) (Documents, []string, string, error)
}

Client represents ORD documents client

type ClientConfig

type ClientConfig struct {
	// contains filtered or unexported fields
}

ClientConfig contains configuration for the ORD aggregator client

func NewClientConfig

func NewClientConfig(maxParallelDocumentsPerApplication int, retryDelay time.Duration, retryAttempts uint) ClientConfig

NewClientConfig creates new ClientConfig from the supplied parameters

type CredentialExchangeStrategyTenantMapping

type CredentialExchangeStrategyTenantMapping struct {
	Mode    model.WebhookMode
	Version string
}

CredentialExchangeStrategyTenantMapping contains tenant mappings configuration

type DataProductProcessor

type DataProductProcessor interface {
	Process(ctx context.Context, resourceType resource.Type, resourceID string, packagesFromDB []*model.Package, dataProducts []*model.DataProductInput, resourceHashes map[string]uint64) ([]*model.DataProduct, error)
}

DataProductProcessor is responsible for processing of data product entities.

type DataProductService

type DataProductService interface {
	ListByApplicationID(ctx context.Context, appID string) ([]*model.DataProduct, error)
	ListByApplicationTemplateVersionID(ctx context.Context, appTemplateVersionID string) ([]*model.DataProduct, error)
}

DataProductService is responsible for the service-layer DataProduct operations.

type Document

type Document struct {
	Schema                string `json:"$schema"`
	OpenResourceDiscovery string `json:"openResourceDiscovery"`
	Description           string `json:"description"`

	// TODO: In the current state of ORD and it's implementation we are missing system landscape discovery and an id correlation in the system instances. Because of that in the first phase we will rely on:
	//  - DescribedSystemInstance is the application in our DB and it's baseURL should match with the one in the webhook.
	DescribedSystemInstance *model.Application `json:"describedSystemInstance"`

	DescribedSystemVersion *model.ApplicationTemplateVersionInput `json:"describedSystemVersion"`

	Perspective DocumentPerspective `json:"-"`

	PolicyLevel       *string `json:"policyLevel"`
	CustomPolicyLevel *string `json:"customPolicyLevel"`

	Packages                []*model.PackageInput               `json:"packages"`
	ConsumptionBundles      []*model.BundleCreateInput          `json:"consumptionBundles"`
	Products                []*model.ProductInput               `json:"products"`
	APIResources            []*model.APIDefinitionInput         `json:"apiResources"`
	EventResources          []*model.EventDefinitionInput       `json:"eventResources"`
	EntityTypes             []*model.EntityTypeInput            `json:"entityTypes"`
	Tombstones              []*model.TombstoneInput             `json:"tombstones"`
	Vendors                 []*model.VendorInput                `json:"vendors"`
	Capabilities            []*model.CapabilityInput            `json:"capabilities"`
	IntegrationDependencies []*model.IntegrationDependencyInput `json:"integrationDependencies"`
	DataProducts            []*model.DataProductInput           `json:"dataProducts"`
}

Document represents an ORD Document

type DocumentDetails

type DocumentDetails struct {
	URL string `json:"url"`
	// TODO: Currently we cannot differentiate between system instance types reliably, therefore we cannot make use of the systemInstanceAware optimization (store it once per system type and reuse it for each system instance of that type).
	//  Once we have system landscape discovery and stable system types we can make use of this optimization. Until then we store all the information for a system instance as it is provided in the documents.
	//  Therefore we treat every resource as SystemInstanceAware = true
	SystemInstanceAware bool                            `json:"systemInstanceAware"`
	AccessStrategies    accessstrategy.AccessStrategies `json:"accessStrategies"`
	Perspective         DocumentPerspective             `json:"perspective"`
}

DocumentDetails contains fields related to the fetching of each Document

type DocumentPerspective

type DocumentPerspective string

DocumentPerspective represents the perspective of the document

const (
	// SystemVersionPerspective represents a dynamic document
	SystemVersionPerspective DocumentPerspective = "system-version"
	// SystemInstancePerspective represents a static document
	SystemInstancePerspective DocumentPerspective = "system-instance"
	// ConfigBaseURLRegex represents the valid structure of the field
	ConfigBaseURLRegex = "^http[s]?:\\/\\/[^:\\/\\s]+\\.[^:\\/\\s\\.]+(:\\d+)?(\\/[a-zA-Z0-9-\\._~]+)*$"
)

type DocumentSanitizer

type DocumentSanitizer struct {
}

DocumentSanitizer represents the sanitizer of ORD documents

func NewDocumentSanitizer

func NewDocumentSanitizer() DocumentSanitizer

NewDocumentSanitizer returns new instance of a document sanitizer

func (*DocumentSanitizer) Sanitize

func (v *DocumentSanitizer) Sanitize(docs []*Document, webhookBaseURL, webhookBaseProxyURL string) ([]*ValidationError, error)

Sanitize performs all the merging and rewriting rules defined in ORD. This method should be invoked after Documents are validated with the Validate method.

  • Rewrite all relative URIs using the baseURL from the Described System Instance. If the Described System Instance baseURL is missing the provider baseURL (from the webhook) is used.
  • Package's partOfProducts, tags, countries, industry, lineOfBusiness, labels are inherited by the resources in the package.
  • Ensure to assign `defaultEntryPoint` if missing and there are available `entryPoints` to API's `PartOfConsumptionBundles`
  • If some resource(Package, API, Event or Data Product) doesn't have provided `policyLevel` and `customPolicyLevel`, these are inherited from the document

type DocumentValidator

type DocumentValidator struct {
	// contains filtered or unexported fields
}

DocumentValidator validates the ORD documents

func (*DocumentValidator) Validate

func (v *DocumentValidator) Validate(ctx context.Context, documents []*Document, baseURL string, globalResourcesOrdIDs map[string]bool, documentsAsString []string, ruleset string) ([]*ValidationError, error)

Validate validates all ORD documents with the API Metadata Validator and checks resource duplications and entity relations

type Documents

type Documents []*Document

Documents is a slice of Document objects

type EntityTypeProcessor

type EntityTypeProcessor interface {
	Process(ctx context.Context, resourceType resource.Type, resourceID string, entityTypes []*model.EntityTypeInput, packagesFromDB []*model.Package, resourceHashes map[string]uint64) ([]*model.EntityType, error)
}

EntityTypeProcessor is responsible for processing of entity type entities.

type EntityTypeService

type EntityTypeService interface {
	ListByApplicationID(ctx context.Context, appID string) ([]*model.EntityType, error)
	ListByApplicationTemplateVersionID(ctx context.Context, appTemplateVersionID string) ([]*model.EntityType, error)
}

EntityTypeService is responsible for the service-layer Entity Type operations.

type EventProcessor

type EventProcessor interface {
	Process(ctx context.Context, resourceType resource.Type, resourceID string, bundlesFromDB []*model.Bundle, packagesFromDB []*model.Package, events []*model.EventDefinitionInput, resourceHashes map[string]uint64) ([]*model.EventDefinition, []*processor.OrdFetchRequest, error)
}

EventProcessor is responsible for processing of event entities.

type EventService

type EventService interface {
	Create(ctx context.Context, resourceType resource.Type, resourceID string, bundleID, packageID *string, in model.EventDefinitionInput, specs []*model.SpecInput, bundleIDs []string, eventHash uint64, defaultBundleID string) (string, error)
	UpdateInManyBundles(ctx context.Context, resourceType resource.Type, id string, packageID *string, in model.EventDefinitionInput, specIn *model.SpecInput, bundleIDsFromBundleReference, bundleIDsForCreation, bundleIDsForDeletion []string, eventHash uint64, defaultBundleID string) error
	Delete(ctx context.Context, resourceType resource.Type, id string) error
	ListByApplicationID(ctx context.Context, appID string) ([]*model.EventDefinition, error)
	ListByApplicationTemplateVersionID(ctx context.Context, appTemplateVersionID string) ([]*model.EventDefinition, error)
}

EventService is responsible for the service-layer Event operations.

type FetchRequestService

type FetchRequestService interface {
	FetchSpec(ctx context.Context, fr *model.FetchRequest, headers *sync.Map) (*string, *model.FetchRequestStatus)
	Update(ctx context.Context, fr *model.FetchRequest) error
	UpdateGlobal(ctx context.Context, fr *model.FetchRequest) error
}

FetchRequestService is responsible for executing specification fetch requests.

type GlobalProductService

type GlobalProductService interface {
	CreateGlobal(ctx context.Context, in model.ProductInput) (string, error)
	UpdateGlobal(ctx context.Context, id string, in model.ProductInput) error
	DeleteGlobal(ctx context.Context, id string) error
	ListGlobal(ctx context.Context) ([]*model.Product, error)
}

GlobalProductService is responsible for the service-layer operations for Global Product (with NULL app_id) without tenant isolation.

type GlobalRegistryConfig

type GlobalRegistryConfig struct {
	URL string `envconfig:"APP_GLOBAL_REGISTRY_URL"`
}

GlobalRegistryConfig contains configuration for GlobalRegistryService.

type GlobalRegistryService

type GlobalRegistryService interface {
	SyncGlobalResources(ctx context.Context) (map[string]bool, error)
	ListGlobalResources(ctx context.Context) (map[string]bool, error)
}

GlobalRegistryService processes global resources (products and vendors) provided via global registry.

type GlobalVendorService

type GlobalVendorService interface {
	CreateGlobal(ctx context.Context, in model.VendorInput) (string, error)
	UpdateGlobal(ctx context.Context, id string, in model.VendorInput) error
	DeleteGlobal(ctx context.Context, id string) error
	ListGlobal(ctx context.Context) ([]*model.Vendor, error)
}

GlobalVendorService is responsible for the service-layer operations for Global Vendors (with NULL app_id) without tenant isolation.

type IntegrationDependencyProcessor

type IntegrationDependencyProcessor interface {
	Process(ctx context.Context, resourceType resource.Type, resourceID string, packagesFromDB []*model.Package, integrationDependencies []*model.IntegrationDependencyInput, resourceHashes map[string]uint64) ([]*model.IntegrationDependency, error)
}

IntegrationDependencyProcessor is responsible for processing of integration dependency entities.

type IntegrationDependencyService

type IntegrationDependencyService interface {
	ListByApplicationID(ctx context.Context, appID string) ([]*model.IntegrationDependency, error)
	ListByApplicationTemplateVersionID(ctx context.Context, appTemplateVersionID string) ([]*model.IntegrationDependency, error)
}

IntegrationDependencyService is responsible for the service-layer IntegrationDependency operations.

type LabelService

type LabelService interface {
	GetByKey(ctx context.Context, tenant string, objectType model.LabelableObject, objectID, key string) (*model.Label, error)
}

LabelService is responsible for the service-layer Label operations

type MetricsConfig

type MetricsConfig struct {
	PushEndpoint  string        `envconfig:"optional,APP_METRICS_PUSH_ENDPOINT"`
	ClientTimeout time.Duration `envconfig:"default=60s"`
	JobName       string        `envconfig:"default=compass-ord-aggregator"`
}

MetricsConfig is the ord aggregator configuration for pushing metrics to Prometheus

type ORDDocumentsClient

type ORDDocumentsClient struct {
	*http.Client
	// contains filtered or unexported fields
}

ORDDocumentsClient defines ORD documents client

func NewClient

func NewClient(config ClientConfig, httpClient *http.Client, accessStrategyExecutorProvider accessstrategy.ExecutorProvider) *ORDDocumentsClient

NewClient creates new ORD Client via a provided http.Client

func (*ORDDocumentsClient) FetchOpenResourceDiscoveryDocuments

func (c *ORDDocumentsClient) FetchOpenResourceDiscoveryDocuments(ctx context.Context, resource Resource, webhook *model.Webhook, ordWebhookMapping application.ORDWebhookMapping, requestObject directorwh.OpenResourceDiscoveryWebhookRequestObject) (Documents, []string, string, error)

FetchOpenResourceDiscoveryDocuments fetches all the documents for a single ORD .well-known endpoint

type ORDOperationMaintainer

type ORDOperationMaintainer struct {
	// contains filtered or unexported fields
}

ORDOperationMaintainer consists of various resource services responsible for operations creation.

func (*ORDOperationMaintainer) Maintain

func (oc *ORDOperationMaintainer) Maintain(ctx context.Context) error

Maintain is responsible to create all missing and remove all obsolete operations

type ORDService

type ORDService interface {
	ProcessApplication(ctx context.Context, appID string) error
	ProcessApplicationTemplate(ctx context.Context, appTemplateID string) error
	ProcessAppInAppTemplateContext(ctx context.Context, appTemplateID, appID string) error
}

ORDService missing godoc

type OpenResourceDiscoveryV1

type OpenResourceDiscoveryV1 struct {
	Documents []DocumentDetails `json:"documents"`
}

OpenResourceDiscoveryV1 contains all Documents' details

type OperationMaintainer

type OperationMaintainer interface {
	Maintain(ctx context.Context) error
}

OperationMaintainer is responsible for maintaining of different types of operations.

func NewOperationMaintainer

func NewOperationMaintainer(kind model.OperationType, transact persistence.Transactioner, opSvc OperationService, webhookSvc WebhookService, appSvc ApplicationService) 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 {
	OrdSvc ORDService
}

OperationsProcessor defines Open Resource Discovery operation processor

func (*OperationsProcessor) Process

func (p *OperationsProcessor) Process(ctx context.Context, operation *model.Operation) error

Process processes the given operation

type PackageProcessor

type PackageProcessor interface {
	Process(ctx context.Context, resourceType resource.Type, resourceID string, packages []*model.PackageInput, resourceHashes map[string]uint64) ([]*model.Package, error)
}

PackageProcessor is responsible for processing of package entities.

type PackageService

type PackageService interface {
	ListByApplicationID(ctx context.Context, appID string) ([]*model.Package, error)
	ListByApplicationTemplateVersionID(ctx context.Context, appTemplateVersionID string) ([]*model.Package, error)
}

PackageService is responsible for the service-layer Package operations.

type ProcessingError

type ProcessingError struct {
	ValidationErrors []*ValidationError `json:"validation_errors"`
	RuntimeError     *RuntimeError      `json:"runtime_error"`
}

ProcessingError represents the error containing the validation and runtime errors from processing an operation

func (*ProcessingError) Error

func (p *ProcessingError) Error() string

type ProductProcessor

type ProductProcessor interface {
	Process(ctx context.Context, resourceType resource.Type, resourceID string, products []*model.ProductInput) ([]*model.Product, error)
}

ProductProcessor is responsible for processing of product entities.

type Resource

type Resource struct {
	Type          directorresource.Type
	ID            string
	ParentID      *string
	Name          string
	LocalTenantID *string
}

Resource represents a resource that is being aggregated. This would be an Application or Application Template

type ResourceIDs

type ResourceIDs struct {
	PackageIDs               map[string]bool
	PackagePolicyLevels      map[string]string
	BundleIDs                map[string]bool
	ProductIDs               map[string]bool
	APIIDs                   map[string]bool
	EventIDs                 map[string]bool
	EntityTypeIDs            map[string]bool
	VendorIDs                map[string]bool
	CapabilityIDs            map[string]bool
	IntegrationDependencyIDs map[string]bool
	DataProductIDs           map[string]bool
}

ResourceIDs holds some of the ORD entities' IDs

type RuntimeError

type RuntimeError struct {
	Message string `json:"message"`
}

RuntimeError represents the message of the runtime errors

type Service

type Service struct {
	// contains filtered or unexported fields
}

Service consists of various resource services responsible for service-layer ORD operations.

func NewAggregatorService

func NewAggregatorService(config ServiceConfig, metricsCfg MetricsConfig, transact persistence.Transactioner, appSvc ApplicationService, webhookSvc WebhookService, bundleSvc BundleService, bundleReferenceSvc BundleReferenceService, apiProcessor APIProcessor, eventProcessor EventProcessor, entityTypeProcessor EntityTypeProcessor, capabilityProcessor CapabilityProcessor, integrationDependencyProcessor IntegrationDependencyProcessor, dataProductProcessor DataProductProcessor, specSvc SpecService, fetchReqSvc FetchRequestService, packageProcessor PackageProcessor, productProcessor ProductProcessor, vendorProcessor VendorProcessor, tombstoneProcessor TombstoneProcessor, tenantSvc TenantService, globalRegistrySvc GlobalRegistryService, client Client, webhookConverter WebhookConverter, appTemplateVersionSvc ApplicationTemplateVersionService, appTemplateSvc ApplicationTemplateService, tombstonedResourcesDeleter TombstonedResourcesDeleter, labelService LabelService, ordWebhookMapping []application.ORDWebhookMapping, opSvc operationsmanager.OperationService, documentValidator Validator, documentSanitizer DocumentSanitizer) *Service

NewAggregatorService returns a new object responsible for service-layer ORD operations.

func (*Service) ProcessAppInAppTemplateContext

func (s *Service) ProcessAppInAppTemplateContext(ctx context.Context, appTemplateID, appID string) error

ProcessAppInAppTemplateContext performs resync of ORD information provided via ORD documents for an applications in context of application template

func (*Service) ProcessApplication

func (s *Service) ProcessApplication(ctx context.Context, appID string) error

ProcessApplication performs resync of ORD information provided via ORD documents for an applications

func (*Service) ProcessApplicationTemplate

func (s *Service) ProcessApplicationTemplate(ctx context.Context, appTemplateID string) error

ProcessApplicationTemplate performs resync of static ORD information for an application template

type ServiceConfig

type ServiceConfig struct {
	// contains filtered or unexported fields
}

ServiceConfig contains configuration for the ORD aggregator service

func NewServiceConfig

func NewServiceConfig(maxParallelSpecificationProcessors int, credentialExchangeStrategyTenantMappings map[string]CredentialExchangeStrategyTenantMapping) ServiceConfig

NewServiceConfig creates new ServiceConfig from the supplied parameters

type SpecService

type SpecService interface {
	CreateByReferenceObjectID(ctx context.Context, in model.SpecInput, resourceType resource.Type, objectType model.SpecReferenceObjectType, objectID string) (string, error)
	CreateByReferenceObjectIDWithDelayedFetchRequest(ctx context.Context, in model.SpecInput, resourceType resource.Type, objectType model.SpecReferenceObjectType, objectID string) (string, *model.FetchRequest, error)
	DeleteByReferenceObjectID(ctx context.Context, resourceType resource.Type, objectType model.SpecReferenceObjectType, objectID string) error
	GetByID(ctx context.Context, id string, objectType model.SpecReferenceObjectType) (*model.Spec, error)
	ListFetchRequestsByReferenceObjectIDs(ctx context.Context, tenant string, objectIDs []string, objectType model.SpecReferenceObjectType) ([]*model.FetchRequest, error)
	ListFetchRequestsByReferenceObjectIDsGlobal(ctx context.Context, objectIDs []string, objectType model.SpecReferenceObjectType) ([]*model.FetchRequest, error)
	UpdateSpecOnly(ctx context.Context, spec model.Spec) error
	UpdateSpecOnlyGlobal(ctx context.Context, spec model.Spec) error
	ListIDByReferenceObjectID(ctx context.Context, resourceType resource.Type, objectType model.SpecReferenceObjectType, objectID string) ([]string, error)
	GetByIDGlobal(ctx context.Context, id string) (*model.Spec, error)
}

SpecService is responsible for the service-layer Specification operations.

type TenantService

type TenantService interface {
	GetLowestOwnerForResource(ctx context.Context, resourceType resource.Type, objectID string) (string, error)
	GetTenantByID(ctx context.Context, id string) (*model.BusinessTenantMapping, error)
}

TenantService missing godoc

type TombstoneProcessor

type TombstoneProcessor interface {
	Process(ctx context.Context, resourceType resource.Type, resourceID string, tombstones []*model.TombstoneInput) ([]*model.Tombstone, error)
}

TombstoneProcessor is responsible for processing of tombstone entities.

type TombstonedResourcesDeleter

type TombstonedResourcesDeleter interface {
	Delete(ctx context.Context, resourceType resource.Type, vendorsFromDB []*model.Vendor, productsFromDB []*model.Product, packagesFromDB []*model.Package, bundlesFromDB []*model.Bundle, apisFromDB []*model.APIDefinition, eventsFromDB []*model.EventDefinition, entityTypesFromDB []*model.EntityType, capabilitiesFromDB []*model.Capability, integrationDependenciesFromDB []*model.IntegrationDependency, dataProductsFromDB []*model.DataProduct, tombstonesFromDB []*model.Tombstone, fetchRequests []*processor.OrdFetchRequest) ([]*processor.OrdFetchRequest, error)
}

TombstonedResourcesDeleter is responsible for deleting all tombstoned resources.

type ValidationClient

type ValidationClient struct {
	// contains filtered or unexported fields
}

ValidationClient represents the client for the API Metadata Validator

func NewValidationClient

func NewValidationClient(url string, client *http.Client, enabled bool) *ValidationClient

NewValidationClient returns new validation client

func (*ValidationClient) Validate

func (vc *ValidationClient) Validate(ctx context.Context, ruleset string, requestBody string) ([]ValidationResult, error)

Validate sends request to API Metadata Validator to validate one ORD document

type ValidationError

type ValidationError struct {
	OrdID       string `json:"ordId"`
	Severity    string `json:"severity"`
	Type        string `json:"type"`
	Description string `json:"description"`
}

ValidationError represents a validation error when aggregating and validating ORD documents

type ValidationResult

type ValidationResult struct {
	Code             string   `json:"code"`
	Path             []string `json:"path"`
	Message          string   `json:"message"`
	Severity         string   `json:"severity"`
	ProductStandards []string `json:"productStandards"`
}

ValidationResult represents the structure of the response from the successful requests to API Metadata Validator

type Validator

type Validator interface {
	Validate(ctx context.Context, documents []*Document, baseURL string, globalResourcesOrdIDs map[string]bool, docsString []string, ruleset string) ([]*ValidationError, error)
}

Validator validates list of ORD documents

func NewDocumentValidator

func NewDocumentValidator(client ValidatorClient) Validator

NewDocumentValidator returns new document validator for validating ORD documents

type ValidatorClient

type ValidatorClient interface {
	Validate(ctx context.Context, ruleset, requestBody string) ([]ValidationResult, error)
}

ValidatorClient validates list of ORD documents with API Metadata Validator

type VendorProcessor

type VendorProcessor interface {
	Process(ctx context.Context, resourceType resource.Type, resourceID string, vendors []*model.VendorInput) ([]*model.Vendor, error)
}

VendorProcessor is responsible for processing of vendor entities.

type WebhookConverter

type WebhookConverter interface {
	InputFromGraphQL(in *graphql.WebhookInput) (*model.WebhookInput, error)
}

WebhookConverter is responsible for converting webhook structs

type WebhookService

type WebhookService interface {
	GetByIDAndWebhookTypeGlobal(ctx context.Context, objectID string, objectType model.WebhookReferenceObjectType, webhookType model.WebhookType) (*model.Webhook, error)
	ListByWebhookType(ctx context.Context, webhookType model.WebhookType) ([]*model.Webhook, error)
	ListForApplication(ctx context.Context, applicationID string) ([]*model.Webhook, error)
	ListForApplicationGlobal(ctx context.Context, applicationID string) ([]*model.Webhook, error)
	ListForApplicationTemplate(ctx context.Context, applicationTemplateID string) ([]*model.Webhook, error)
	EnrichWebhooksWithTenantMappingWebhooks(in []*graphql.WebhookInput) ([]*graphql.WebhookInput, error)
	Create(ctx context.Context, owningResourceID string, in model.WebhookInput, objectType model.WebhookReferenceObjectType) (string, error)
	Delete(ctx context.Context, id string, objectType model.WebhookReferenceObjectType) error
}

WebhookService is responsible for the service-layer Webhook operations.

type WellKnownConfig

type WellKnownConfig struct {
	Schema                  string                  `json:"$schema"`
	BaseURL                 string                  `json:"baseUrl"`
	OpenResourceDiscoveryV1 OpenResourceDiscoveryV1 `json:"openResourceDiscoveryV1"`
}

WellKnownConfig represents the whole config object

func (WellKnownConfig) Validate

func (c WellKnownConfig) Validate(baseURL string) error

Validate validates if the Config object complies with the spec requirements

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL