Skip to content

Instantly share code, notes, and snippets.

@MortalFlesh
Last active January 22, 2020 15:31
Show Gist options
  • Select an option

  • Save MortalFlesh/91bec3bba884f5f412fa3c7d9d130165 to your computer and use it in GitHub Desktop.

Select an option

Save MortalFlesh/91bec3bba884f5f412fa3c7d9d130165 to your computer and use it in GitHub Desktop.
ServiceCatalogue - model
//
// Concept Definition
//
type ConceptDefinition = {
Service: Service // domain * context
Instances: ServiceInstance list
Downstream: Downstream
}
and ServiceInstance = {
Purpose: PurposePattern
Version: VersionPattern
Upstream: UpstreamServiceIdentification list
}
[<RequireQualifiedAccess>]
and PurposePattern =
| Exact of Purpose
| Any
[<RequireQualifiedAccess>]
and VersionPattern =
| Exact of Version
| Any
and UpstreamServiceIdentification = UpstreamServiceIdentification of ServiceIdentification // byService | byProcessor | byInstance
[<RequireQualifiedAccess>]
and DomainPattern =
| Exact of Domain
| Any
and Downstream = {
UpstreamPatterns: UpstreamServiceIdentificationPattern list
}
and UpstreamServiceIdentificationPattern = {
ServiceIdentification: ServiceIdentification // byService | byProcessor | byInstance
Pattern: DependencyLocationPattern
Result: UpstreamPatternResult
}
and DependencyLocationPattern = {
Environment: EnvironmentPattern
Domain: DomainPattern
}
and UpstreamPatternResult =
| LinkToEnvironment of LinkToEnvironment
| InstancePackage of InstancePackage
and LinkToEnvironment =
| ByReference of ReferenceToInstanceInEnvironment
| ByProxy of ProxyToInstanceInEnvironment
and ReferenceToInstanceInEnvironment = {
Instance: Instance
Environment: Environment
}
and ProxyToInstanceInEnvironment = {
Instance: Instance
EnvironmentProxy: Proxy
}
and InstancePackage = {
Instance: Instance
DeploymentPackage: DeploymentPackage
}
and DeploymentPackage = DeploymentPackage of string
//
// Artifacts
//
type SoftwareComponent =
| ApplicationComponent of Instance * Environment
| SystemSoftware of Instance * Environment
| Storage of Instance * Environment
type Artifact =
| Binary of SoftwareComponent * DeploymentPackage
[<RequiredQualifiedAccess>]
type SoftwareComponentArtifact =
| ApplicationComponentArtifact of ApplicationComponentArtifact
| SystemSoftwareArtifact of SystemSoftwareArtifact
| StorageArtifact of StorageArtifact
and ApplicationComponentArtifact = ApplicationComponentArtifact of Artifact
and SystemSoftwareArtifact = SystemSoftwareArtifact of Artifact
and StorageArtifact = StorageArtifact of Artifact
//
// Concept
//
type Concept =
| ServiceConcept of ServiceConcept
| DataObject of DataObject
and ServiceConcept =
| ApplicationService of ApplicationService
| TechnologyService of TechnologyService
and ApplicationService = ApplicationService of ConceptDefinition
and TechnologyService = TechnologyService of ConceptDefinition
and DataObject = DataObject of ConceptDefinition
[<RequiredQualifiedAccess>]
type ConceptSoftwareComponents =
| Application of ApplicationService * ApplicationComponent list
| Technology of TechnologyService * SystemSoftware list
| DataObject of DataObject * Storage list
//
// Environment Deployment
//
type RootPackage = RootPackage of Instance * DeploymentPackage
type EnvironmentDeployment = {
Environment: Environment
Packages: RootPackage list
}
//
// Dependencies
//
type SoftwareComponentOrigin =
| Root of SoftwareComponentArtifact
| Derived of SoftwareComponentArtifact * UpstreamPatternResult
type SoftwareComponentDependency = {
Downstream: SoftwareComponent
DependencyRule: DependencyRule
Upstream: SoftwareComponent
}
and DependencyRule = {
DownstreamSoftwareComponent: SoftwareComponentOrigin
Identification: UpstreamServiceIdentification
UpstreamPatternResult: UpstreamPatternResult
}
type DependencyDerivationResult = {
SoftwareComponentOrigins: SoftwareComponentOrigin list
SoftwareComponentDependencies: SoftwareComponentDependency list
}
//
// Eligibility Definition
//
type Machine = Machine // of ???
type Person = Person // of ???
type Identity =
| Machine of Machine
| Person of Person
type IdentityDto = {
Identities: string list
}
type Slice = Slice of Identity list
type Member =
| Identity of Identity
| Slice of Slice
type SliceDto = {
Id: string
Name: string
Members: Member list
}
type SoftwareComponentIdentification =
| ServiceIdentification of ServiceIdentification
| ServiceIdentificationInEnvironment of ServiceIdentification * EnvironmentPattern
| SoftwareComponent of SoftwareComponent
type FindSoftwareComponents = SoftwareComponentIdentification -> SoftwareComponent list
type Capability =
| List
| Read
| Create
| Update
| Delete
| Sudo
type Subject = Subject of string
type SubjectDto = {
Key: string
Value: string // this will be Subject
Context: string
}
type Scope = {
Capability: Capability
Subject: Subject
}
type EligibilityDefinitionName = EligibilityDefinitionName of string
type EligibilitySubjectDefinition = {
SoftwareComponentIdentification: SoftwareComponentIdentification list
Scope: Scope list
}
type EligibilityDefinition = {
Id: Guid
Name: EligibilityDefinitionName
Description: string
EligibilitySubject: EligibilitySubjectDefinition
}
type IdentifiedEligibilityDefinition =
| ForSlices of Slice list * EligibilityDefinition
| ForIdentities of Identity list * EligibilityDefinition
| ForServices of SoftwareComponentIdentification list * EligibilityDefinition
//
// Eligibility
//
type EligibilitySubject = {
SoftwareComponent: SoftwareComponent
Scope: Scope
}
type Eligibility =
| ForSlice of Slice * EligibilitySubject // -> Eligibility v AD
| ForIdentity of Identity * EligibilitySubject // -> Token
| ForService of SoftwareComponentIdentification * EligibilitySubject // -> Token
type SubmitEligibility = EligibilityDefinition -> Eligibility list
// GUI
module GUI =
type ServiceConcept =
| ApplicationService of ApplicationService
| TechnologyService of TechnologyService
and ApplicationService = ApplicationService of Service
and TechnologyService = TechnologyService of Service
/// (from IAM)
type GetSlices = () -> SliceDto list
/// (from IAM)
type GetIdentities = unit -> IdentityDto
/// Get all defined ServiceConcepts (from Neo4j)
type GetServices = unit -> ServiceConcept list
/// Get all defined Software Components, Services, Processors, ... for a given Concept (from Neo4j)
type GetSoftwareComponentIdentifications = ServiceConcept -> SoftwareComponentIdentification list
/// (from Value List aggregate)
type GetServiceSubjects = ServiceConcept -> SubjectDto list
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment