( dataSources: Record<string, DataSource>, account: string, container: string )
| 18 | } |
| 19 | |
| 20 | export 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 | |
| 43 | export function getBlobClient( |
| 44 | dataSources: Record<string, DataSource>, |
no test coverage detected