IBlueprintService
Namespace: Meshmakers.Octo.Runtime.Contracts.Blueprints
Service for applying blueprints to tenants
public interface IBlueprintService
Methods
ApplyBlueprintAsync(String, BlueprintId, Boolean, CancellationToken)
Applies a blueprint to initialize a tenant with CK models and seed data.
Task<BlueprintApplicationResult> ApplyBlueprintAsync(string tenantId, BlueprintId blueprintId, bool force, CancellationToken cancellationToken)
Parameters
tenantId String
Target tenant identifier
blueprintId BlueprintId
Blueprint to apply
force Boolean
If true, re-apply seed data via upsert even if the same version is
already recorded for the tenant (recovery after storage corruption or
manual cleanup). The recorded application mode is then
BlueprintApplicationMode.ReApply instead of
BlueprintApplicationMode.Initial.
cancellationToken CancellationToken
Cancellation token
Returns
Task<BlueprintApplicationResult>
Result of the blueprint application
ApplyBlueprintAsync(String, BlueprintId, BlueprintApplyOptions, CancellationToken)
Applies a blueprint like IBlueprintService.ApplyBlueprintAsync(String, BlueprintId, Boolean, CancellationToken), with the tenant upgrade guard of the CK models the blueprint installs or raises (CK v2 F2.5).
Task<BlueprintApplicationResult> ApplyBlueprintAsync(string tenantId, BlueprintId blueprintId, BlueprintApplyOptions options, CancellationToken cancellationToken)
Parameters
tenantId String
Target tenant identifier
blueprintId BlueprintId
Blueprint to apply
options BlueprintApplyOptions
Re-apply and guard options
cancellationToken CancellationToken
Cancellation token
Returns
Task<BlueprintApplicationResult>
Result of the blueprint application
Remarks:
With BlueprintApplyOptions.CkUpgradeGuard = BlueprintCkUpgradeGuardMode.Enforce the
apply stops before the first change when the CK update set would break an installed model: the result is not
successful, BlueprintApplicationResult.IsCkUpgradeBlocked is true and
BlueprintApplicationResult.CkUpgradeBlockers names what would break. The tenant and the
installation records are unchanged. A host without an IBlueprintCkUpgradeGuard applies unguarded.
ValidateBlueprintAsync(BlueprintId, CancellationToken)
Validates that a blueprint can be applied (checks CK dependencies exist, seed data is valid, etc.)
Task<BlueprintValidationResult> ValidateBlueprintAsync(BlueprintId blueprintId, CancellationToken cancellationToken)
Parameters
blueprintId BlueprintId
Blueprint to validate
cancellationToken CancellationToken
Cancellation token
Returns
Task<BlueprintValidationResult>
Result of the validation
ListBlueprintsAsync(Int32, Int32, CancellationToken)
Lists all available blueprints
Task<BlueprintListResult> ListBlueprintsAsync(int skip, int take, CancellationToken cancellationToken)
Parameters
skip Int32
Number of blueprints to skip
take Int32
Number of blueprints to take
cancellationToken CancellationToken
Cancellation token
Returns
Task<BlueprintListResult>
List of available blueprints
SearchBlueprintsAsync(String, Int32, Int32, CancellationToken)
Searches for blueprints by name or description
Task<BlueprintSearchResult> SearchBlueprintsAsync(string searchTerm, int skip, int take, CancellationToken cancellationToken)
Parameters
searchTerm String
Search term
skip Int32
Number of blueprints to skip
take Int32
Number of blueprints to take
cancellationToken CancellationToken
Cancellation token
Returns
Task<BlueprintSearchResult>
Search results
GetUpdateInfoAsync(String, CancellationToken)
Gets update information for the blueprint that was applied to the tenant last.
Task<BlueprintUpdateInfo> GetUpdateInfoAsync(string tenantId, CancellationToken cancellationToken)
Parameters
tenantId String
Tenant identifier
cancellationToken CancellationToken
Cancellation token
Returns
Task<BlueprintUpdateInfo>
Information about available updates, or null if no blueprint is applied
Remarks:
On a multi-blueprint tenant "the blueprint applied last" is arbitrary from the caller's point of view - prefer the overload taking a blueprint name.
GetUpdateInfoAsync(String, String, CancellationToken)
Gets update information for one specific blueprint on the tenant.
Task<BlueprintUpdateInfo> GetUpdateInfoAsync(string tenantId, string blueprintName, CancellationToken cancellationToken)
Parameters
tenantId String
Tenant identifier
blueprintName String
Blueprint name to describe, without the version suffix. When null, empty or
whitespace the blueprint that was applied to the tenant last is used (legacy
behaviour).
cancellationToken CancellationToken
Cancellation token
Returns
Task<BlueprintUpdateInfo>
Information about available updates, or null when that blueprint is not installed
on the tenant
PreviewUpdateAsync(String, BlueprintId, BlueprintUpdateMode, CancellationToken)
Previews the changes that would be made by updating to a specific blueprint version
Task<BlueprintUpdatePreview> PreviewUpdateAsync(string tenantId, BlueprintId targetVersion, BlueprintUpdateMode updateMode, CancellationToken cancellationToken)
Parameters
tenantId String
Tenant identifier
targetVersion BlueprintId
Target blueprint version
updateMode BlueprintUpdateMode
How to apply the update
cancellationToken CancellationToken
Cancellation token
Returns
Task<BlueprintUpdatePreview>
Preview of changes including conflicts
ApplyUpdateAsync(String, BlueprintId, BlueprintUpdateMode, BlueprintUpdateOptions, CancellationToken)
Applies an update to a tenant's blueprint
Task<BlueprintUpdateResult> ApplyUpdateAsync(string tenantId, BlueprintId targetVersion, BlueprintUpdateMode updateMode, BlueprintUpdateOptions options, CancellationToken cancellationToken)
Parameters
tenantId String
Tenant identifier
targetVersion BlueprintId
Target blueprint version
updateMode BlueprintUpdateMode
How to apply the update
options BlueprintUpdateOptions
Update options including conflict resolutions
cancellationToken CancellationToken
Cancellation token
Returns
Task<BlueprintUpdateResult>
Result of the update operation
GetHistoryAsync(String, CancellationToken)
Gets the blueprint application history for a tenant
Task<IReadOnlyList<TenantBlueprintInfo>> GetHistoryAsync(string tenantId, CancellationToken cancellationToken)
Parameters
tenantId String
Tenant identifier
cancellationToken CancellationToken
Cancellation token
Returns
Task<IReadOnlyList<TenantBlueprintInfo>>
List of blueprint applications in chronological order
UninstallAsync(String, String, Boolean, CancellationToken)
Removes a blueprint from a tenant. Locked entities owned by the
blueprint are erased. Tenant-owned seed entities (the seed sets
rtBlueprintLocked: false) are erased when the tenant
never edited them (their content still equals the seed of the
installed version) and nothing outside the uninstall references them;
the others are kept and listed in
BlueprintUninstallResult.TenantOwnedKept with the reason.
Other unlocked entities are left as user data.
Task<BlueprintUninstallResult> UninstallAsync(string tenantId, string blueprintName, bool cascade, CancellationToken cancellationToken)
Parameters
tenantId String
Target tenant identifier.
blueprintName String
Name of the blueprint to uninstall.
cascade Boolean
When true, transitive dependencies of the uninstalled blueprint
that were originally installed as dependencies (IsDependency = true)
and that no other installed blueprint still references are uninstalled
in the same pass. When false, dependencies are left in place.
cancellationToken CancellationToken
Cancellation token.
Returns
Task<BlueprintUninstallResult>
BlueprintUninstallResult describing how many entities were
removed, which dependencies were cascaded, and any conflicts that
prevented the uninstall (e.g. other installed blueprints still
depend on the requested target).
PreviewUninstallAsync(String, String, Boolean, CancellationToken)
The dry run of IBlueprintService.UninstallAsync(String, String, Boolean, CancellationToken). Runs the same checks and the same
classification but changes nothing: no entity is erased, no installation row removed and no
notification sent. BlueprintUninstallResult.DryRun is true,
BlueprintUninstallResult.EntitiesDeleted and
BlueprintUninstallResult.DeletedEntities name what the uninstall would erase,
BlueprintUninstallResult.TenantOwnedKept what it would keep.
Task<BlueprintUninstallResult> PreviewUninstallAsync(string tenantId, string blueprintName, bool cascade, CancellationToken cancellationToken)
Parameters
tenantId String
Target tenant identifier.
blueprintName String
Name of the blueprint to uninstall.
cascade Boolean
As for IBlueprintService.UninstallAsync(String, String, Boolean, CancellationToken).
cancellationToken CancellationToken
Cancellation token.