IBotServicesClient
Namespace: Meshmakers.Octo.Sdk.ServiceClient.BotServices
Implementation of the client proxy for bot services.
public interface IBotServicesClient : IServiceClient
Implements IServiceClient
Methods
GetImportJobStatus(String)
Gets the status of an import job
Task<JobDto> GetImportJobStatus(string id)
Parameters
id String
ID of the job
Returns
DownloadExportRtResultAsync(String, String)
Caution
Use DownloadDumpToFileAsync for streaming downloads instead.
Downloads the job result as a binary file.
Task<Byte[]> DownloadExportRtResultAsync(string tenantId, string id)
Parameters
tenantId String
Tenant ID of the job
id String
ID of the job
Returns
DownloadDumpToFileAsync(String, String, String, Action<Int64>, CancellationToken)
Downloads the dump result directly to a file using streaming (no full byte[] in RAM).
Task DownloadDumpToFileAsync(string tenantId, string jobId, string outputFilePath, Action<long> progressCallback, CancellationToken cancellationToken)
Parameters
tenantId String
Tenant ID of the job.
jobId String
ID of the completed dump job.
outputFilePath String
The local file path to write the dump to.
progressCallback Action<Int64>
Optional callback for download progress (bytes downloaded).
cancellationToken CancellationToken
A cancellation token.
Returns
StartRunFixupScriptAsync(String)
Start a job to run a fixup script for the given tenant.
Task<JobResponseDto> StartRunFixupScriptAsync(string tenantId)
Parameters
tenantId String
Tenant ID of the job
Returns
Task<JobResponseDto>
The job response containing the job ID.
RestoreRepositoryWithTusAsync(String, String, String, String, Boolean, Action<Double>, CancellationToken)
Restores the repository using tus resumable upload protocol. The file is uploaded in chunks with resume support, then a restore job is started.
Task<JobResponseDto> RestoreRepositoryWithTusAsync(string tenantId, string databaseName, string filePath, string oldDatabaseName, bool restoreArchiveData, Action<double> progressCallback, CancellationToken cancellationToken)
Parameters
tenantId String
The tenant ID for which the repository should be restored.
databaseName String
The name of the database to restore.
filePath String
The backup artifact: a mongodump .tar.gz, or an .octobak.zip container produced by a dump with archive data (AB#4231).
oldDatabaseName String
The (optional) name of the old db. This is required when restoring under a different name.
restoreArchiveData Boolean
When true, CrateDB archive data contained in the backup artifact is restored alongside the Mongo data (AB#4231). Default false restores Mongo only (today's behaviour).
progressCallback Action<Double>
Optional callback reporting upload progress (0.0 to 1.0).
cancellationToken CancellationToken
A cancellation token.
Returns
Task<JobResponseDto>
The job response containing the job ID.
StartDumpRepositoryAsync(String, Boolean)
Dumps the repository for the given tenant.
Task<JobResponseDto> StartDumpRepositoryAsync(string tenantId, bool includeArchiveData)
Parameters
tenantId String
The tenant ID for which the repository should be restored.
includeArchiveData Boolean
When true, CrateDB archive data is included in the dump artifact (AB#4231). Default false dumps Mongo only (today's behaviour).
Returns
Task<JobResponseDto>
The job response containing the job ID.
ReconfigureLogLevelAsync(String, LogLevelDto, LogLevelDto)
Reconfigure the log level of the service.
Task ReconfigureLogLevelAsync(string loggerName, LogLevelDto minLogLevel, LogLevelDto maxLogLevel)
Parameters
loggerName String
Logger pattern name, e. g. Microsoft.*
minLogLevel LogLevelDto
Minimal log level to be logged.
maxLogLevel LogLevelDto
Maximum log level to be logged.
Returns
StartExportArchiveDataAsync(String, String, Nullable<DateTime>, Nullable<DateTime>)
Starts an async Hangfire job in bot-services that exports the row data of an archive to a
downloadable ZIP (delegating the CrateDB read to asset-repo over the SDK). When both
fromUtc and toUtc are null the whole archive is
exported; when supplied, the slice [fromUtc, toUtc) is exported. Poll the job and
download the result via the existing job plumbing. Archive data export/import concept §5.
Task<JobResponseDto> StartExportArchiveDataAsync(string tenantId, string archiveRtId, Nullable<DateTime> fromUtc, Nullable<DateTime> toUtc)
Parameters
tenantId String
The tenant that owns the archive.
archiveRtId String
Runtime id of the CkArchive entity.
fromUtc Nullable<DateTime>
Inclusive lower bound of the exported window (UTC); null for whole archive.
toUtc Nullable<DateTime>
Exclusive upper bound of the exported window (UTC); null for whole archive.
Returns
Task<JobResponseDto>
The job response containing the job id.
StartImportArchiveDataWithTusAsync(String, String, String, ArchiveImportMode, Action<Double>, CancellationToken)
Uploads an export ZIP via the tus resumable-upload protocol (same as repository restore) and then starts an async import job in bot-services that validates the schema match and streams the rows into the target archive. Archive data export/import concept §5.
Task<JobResponseDto> StartImportArchiveDataWithTusAsync(string tenantId, string archiveRtId, string filePath, ArchiveImportMode mode, Action<double> progressCallback, CancellationToken cancellationToken)
Parameters
tenantId String
The tenant that owns the archive.
archiveRtId String
Runtime id of the target CkArchive entity.
filePath String
Local path to the export ZIP to import.
mode ArchiveImportMode
Insert-only or upsert; serialized as a string query parameter.
progressCallback Action<Double>
Optional callback reporting upload progress (0.0 to 1.0).
cancellationToken CancellationToken
A cancellation token.
Returns
Task<JobResponseDto>
The job response containing the job id.
StartSecretSweepAsync(String, SecretSweepModeDto, Boolean)
Starts a secret sweep job for tenantId
(POST {tenantId}/v1/jobs/secret-sweep?mode=[&confirm=true], role SecretManagement).
Writing modes take a pre-sweep dump first and are followed by a verify step. Poll the job via the
existing job plumbing and read the result with IBotServicesClient.GetSecretSweepReportAsync(String).
Task<JobResponseDto> StartSecretSweepAsync(string tenantId, SecretSweepModeDto mode, bool confirm)
Parameters
tenantId String
The tenant to sweep.
mode SecretSweepModeDto
(default), ,
or .
is not offered and throws ArgumentOutOfRangeException.
confirm Boolean
Sends confirm=true. The service answers 400 ConfirmationRequired for
and
without it.
Returns
Task<JobResponseDto>
The job response containing the job id.
GetSecretEnvironmentStatusAsync(String)
Returns the encryption status of the environment as seen from tenantId
(GET {tenantId}/v1/secrets/status; any user with tenant access).
Task<SecretEnvironmentStatusDto> GetSecretEnvironmentStatusAsync(string tenantId)
Parameters
tenantId String
The tenant.
Returns
Task<SecretEnvironmentStatusDto>
GetSecretSweepRunsAsync(String, Int32)
Returns the secret sweep runs of tenantId, newest first
(GET {tenantId}/v1/secrets/sweep-runs?limit=, role AdminPanelManagement).
Task<IReadOnlyList<SecretSweepRunDto>> GetSecretSweepRunsAsync(string tenantId, int limit)
Parameters
tenantId String
The tenant.
limit Int32
Maximum number of runs (at least 1; the service keeps the last 50).
Returns
Task<IReadOnlyList<SecretSweepRunDto>>
DeleteSecretSweepDumpAsync(String, String)
Deletes the pre-sweep dump of a run early
(DELETE {tenantId}/v1/secrets/sweep-runs/{runId}/dump, role SecretManagement).
Task<SecretSweepDumpDeleteResultDto> DeleteSecretSweepDumpAsync(string tenantId, string runId)
Parameters
tenantId String
The tenant.
runId String
The run id ().
Returns
Task<SecretSweepDumpDeleteResultDto>
(204),
(404: unknown run or no dump) or
(409). Other errors (e.g.
403) throw ServiceClientResultException.
RestoreSecretSweepDumpAsync(String, String, Boolean)
Restores the pre-sweep dump of a run into the same tenant and runs a Verify afterwards
(POST {tenantId}/v1/secrets/sweep-runs/{runId}/restore-dump?confirm=true, role
SecretManagement, AB#5559). The tenant's database is dropped and replaced by the dump. 🔴 A dump
taken before the first Encrypt holds plaintext secrets: restoring it brings the plaintext back -
run an Encrypt sweep afterwards.
Task<JobResponseDto> RestoreSecretSweepDumpAsync(string tenantId, string runId, bool confirm)
Parameters
tenantId String
The tenant the dump was taken from (a dump can only be restored into it).
runId String
The run id ().
confirm Boolean
Sends confirm=true; without it the service answers 400 ConfirmationRequired.
Returns
Task<JobResponseDto>
The job response containing the id of the restore job; follow it with IBotServicesClient.GetImportJobStatus(String).
Exceptions
SecretSweepDumpRestoreException
400 ConfirmationRequired, 404 (unknown run / no dump / dump no longer stored),
409 DumpDeleted or 409 DumpKeyMissing; see SecretSweepDumpRestoreException.Reason.
Other errors (e.g. 403) throw ServiceClientResultException.
GetSecretSweepReportAsync(String)
Returns the last secret sweep report of tenantId
(GET {tenantId}/v1/jobs/secret-sweep/report), or null when the service answers
404 (no sweep has run for the tenant yet). Never contains a value.
Task<SecretSweepReportDto> GetSecretSweepReportAsync(string tenantId)
Parameters
tenantId String
The tenant.
Returns
StartSecretSweepAllTenantsAsync(SecretSweepModeDto, Boolean)
Starts a secret sweep over all tenants of the instance (POST system/v1/secrets/sweep?mode=).
Requires access to the system tenant. Per-tenant results: IBotServicesClient.GetSecretSweepReportsAsync().
Task<JobResponseDto> StartSecretSweepAllTenantsAsync(SecretSweepModeDto mode, bool confirm)
Parameters
mode SecretSweepModeDto
Same modes as IBotServicesClient.StartSecretSweepAsync(String, SecretSweepModeDto, Boolean); Decrypt throws.
confirm Boolean
Sends confirm=true. The service answers 400 ConfirmationRequired for
without it.
Returns
Task<JobResponseDto>
The job response containing the job id.
GetSecretSweepReportsAsync()
Returns the last secret sweep report of every tenant that has one, ordered by tenant id
(GET system/v1/secrets/reports). Requires access to the system tenant.
Task<IReadOnlyList<SecretSweepReportDto>> GetSecretSweepReportsAsync()