MCPcopy Create free account
hub / github.com/IQEngine/IQEngine / getContainerClient

Function getContainerClient

client/src/api/utils/AzureBlob.ts:20–41  ·  view source on GitHub ↗
(
  dataSources: Record<string, DataSource>,
  account: string,
  container: string
)

Source from the content-addressed store, hash-verified

18}
19
20export function getContainerClient(
21 dataSources: Record<string, DataSource>,
22 account: string,
23 container: string
24): ContainerClient {
25 const dataSource = getDataSourceFromDatasources(dataSources, account, container);
26 if (!dataSource) {
27 console.debug(`DATASOURCE NOT FOUND: ${account}/${container}`, dataSources);
28 throw new Error('No connection found');
29 }
30 console.debug(`DATASOURCE FOUND: ${dataSource.account}/${dataSource.container} ${dataSource.sasToken}`);
31
32 let blobServiceClient = undefined;
33 if (dataSource.sasToken) {
34 blobServiceClient = new BlobServiceClient(
35 `https://${dataSource.account}.blob.core.windows.net?${dataSource.sasToken}`
36 );
37 } else {
38 blobServiceClient = new BlobServiceClient(`https://${dataSource.account}.blob.core.windows.net`, undefined);
39 }
40 return blobServiceClient.getContainerClient(dataSource.container);
41}
42
43export function getBlobClient(
44 dataSources: Record<string, DataSource>,

Callers 3

getMetaMethod · 0.90
getBlobClientFunction · 0.85

Calls 1

Tested by

no test coverage detected