azure-kusto-ingest
Version:
Azure Data Explorer Ingestion SDK
64 lines • 3.45 kB
JavaScript
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { v4 as uuidv4 } from "uuid";
export class IngestionBlobInfo {
constructor(blobDescriptor, ingestionProperties, authContext = null, applicationForTracing = null, clientVersionForTracing = null) {
var _a, _b, _c, _d, _e;
this.IngestionStatusInTable = null;
this.ApplicationForTracing = null;
this.ClientVersionForTracing = null;
this.BlobPath = blobDescriptor.path;
this.RawDataSize = blobDescriptor.size;
this.DatabaseName = (_a = ingestionProperties.database) !== null && _a !== void 0 ? _a : null;
this.TableName = (_b = ingestionProperties.table) !== null && _b !== void 0 ? _b : null;
this.RetainBlobOnSuccess = true;
this.FlushImmediately = (_c = ingestionProperties.flushImmediately) !== null && _c !== void 0 ? _c : false;
this.IgnoreSizeLimit = false;
this.ReportLevel = (_d = ingestionProperties.reportLevel) !== null && _d !== void 0 ? _d : null;
this.ReportMethod = (_e = ingestionProperties.reportMethod) !== null && _e !== void 0 ? _e : null;
this.SourceMessageCreationTime = new Date();
this.Id = blobDescriptor.sourceId || uuidv4();
this.ApplicationForTracing = applicationForTracing;
this.ClientVersionForTracing = clientVersionForTracing;
const additionalProperties = ingestionProperties.additionalProperties || {};
additionalProperties.authorizationContext = authContext;
const tags = [];
if (ingestionProperties.additionalTags) {
tags.push(...ingestionProperties.additionalTags);
}
if (ingestionProperties.dropByTags) {
tags.push(...ingestionProperties.dropByTags.map((t) => "drop-by:" + t));
}
if (ingestionProperties.ingestByTags) {
tags.push(...ingestionProperties.ingestByTags.map((t) => "ingest-by:" + t));
}
if (tags.length > 0) {
additionalProperties.tags = JSON.stringify(tags);
}
if (ingestionProperties.ingestIfNotExists) {
additionalProperties.ingestIfNotExists = ingestionProperties.ingestIfNotExists;
}
if (ingestionProperties.ingestionMappingColumns && ingestionProperties.ingestionMappingColumns.length > 0) {
// server expects a string
additionalProperties.ingestionMapping = JSON.stringify(ingestionProperties.ingestionMappingColumns.map((m) => m.toApiMapping()));
}
if (ingestionProperties.ingestionMappingReference) {
additionalProperties.ingestionMappingReference = ingestionProperties.ingestionMappingReference;
}
if (ingestionProperties.ingestionMappingKind) {
additionalProperties.ingestionMappingType = ingestionProperties.ingestionMappingKind;
}
if (ingestionProperties.validationPolicy) {
additionalProperties.ValidationPolicy = ingestionProperties.validationPolicy;
}
if (ingestionProperties.format) {
additionalProperties.format = ingestionProperties.format;
}
if (ingestionProperties.ignoreFirstRecord) {
additionalProperties.ignoreFirstRecord = ingestionProperties.ignoreFirstRecord;
}
this.AdditionalProperties = additionalProperties;
}
}
export default IngestionBlobInfo;
//# sourceMappingURL=ingestionBlobInfo.js.map