botbuilder-azure
Version:
Azure extensions for Microsoft BotBuilder.
109 lines • 3.4 kB
TypeScript
import { Storage, StoreItems } from 'botbuilder';
export interface Host {
/**
* Primary host address.
*/
primaryHost: string;
/**
* Secondary host address.
*/
secondaryHost: string;
}
/**
* Settings for configuring an instance of `BlobStorage`.
*/
export interface BlobStorageSettings {
/**
* Root container name to use.
*/
containerName: string;
/**
* The storage account or the connection string. If this is the storage account, the storage access key must be provided.
*/
storageAccountOrConnectionString: string;
/**
* The storage access key.
*/
storageAccessKey?: string;
/**
* (Optional) azure storage host.
*/
host?: string | Host;
}
/**
* Middleware that implements a BlobStorage based storage provider for a bot.
*
* @remarks
* The BlobStorage implements its storage using a single Azure Storage Blob Container. Each entity
* is serialized into a JSON string and stored in an individual text blob. Each blob
* is named after the key which is encoded and ensure it conforms a valid blob name.
*
* @deprecated This class is deprecated in favor of [BlobsStorage](xref:botbuilder-azure-blobs.BlobsStorage)
*/
export declare class BlobStorage implements Storage {
private settings;
private client;
private useEmulator;
/**
* Creates a new BlobStorage instance.
*
* @param settings Settings for configuring an instance of BlobStorage.
*/
constructor(settings: BlobStorageSettings);
/**
* Retrieve entities from the configured blob container.
*
* @param keys An array of entity keys.
* @returns The read items.
*/
read(keys: string[]): Promise<StoreItems>;
/**
* Store a new entity in the configured blob container.
*
* @param changes The changes to write to storage.
* @returns A promise representing the asynchronous operation.
*/
write(changes: StoreItems): Promise<void>;
/**
* Delete entity blobs from the configured container.
*
* @param keys An array of entity keys.
* @returns A promise representing the asynchronous operation.
*/
delete(keys: string[]): Promise<void>;
/**
* Get a blob name validated representation of an entity to be used as a key.
*
* @param key The key used to identify the entity.
* @returns An appropriately escaped version of the key.
*/
private sanitizeKey;
/**
* Check if a container name is valid.
*
* @param container String representing the container name to validate.
* @returns A boolean value that indicates whether or not the name is valid.
*/
private checkContainerName;
/**
* Delay Container creation if it does not exist.
*
* @returns A promise representing the asynchronous operation.
*/
private ensureContainerExists;
/**
* Create a Blob Service.
*
* @param storageAccountOrConnectionString Azure CloudStorageAccount instance or Connection String.
* @param storageAccessKey Blob Service Access Key.
* @param host Blob Service Host.
* @returns The blob services created.
*/
private createBlobService;
/**
* @private
* Turn a cb based azure method into a Promisified one.
*/
private denodeify;
}
//# sourceMappingURL=blobStorage.d.ts.map