breezy-apartment-46543
03/09/2021, 6:53 PMgentle-diamond-70147
03/09/2021, 7:18 PMbreezy-apartment-46543
03/09/2021, 7:25 PMconst getStorageFunction = (opts) => new Promise((resolve) => {
const account = storageAccount.name;
const defaultAzureCredential = new DefaultAzureCredential();
const blobServiceClient = new BlobServiceClient(
`https://${account}.<http://blob.core.windows.net|blob.core.windows.net>`,
defaultAzureCredential,
);
const containerClient = blobServiceClient.getContainerClient(container);
const content = 'Hello world!';
const blobName = `${new Date().getTime()}.txt`;
const blockBlobClient = containerClient.getBlockBlobClient(blobName);
blockBlobClient.upload(content, content.length)
.then(() => resolve({
status: 200,
headers: {
'content-type': 'text/plain',
},
body: 'Success',
}))
.catch((e) => resolve({
status: 200,
headers: {
'content-type': 'text/plain',
},
body: `Error: ${e.message}`,
}));
});
gentle-diamond-70147
03/09/2021, 7:27 PMbreezy-apartment-46543
03/09/2021, 7:29 PMconst handler = async (context, req) => {
return getStorageFunction({ container: '' /*TODO*/ });
};
const endpoint = new azure.appservice.HttpEventSubscription('InfraEndpoint', {
resourceGroup,
callback: handler,
appSettings: {
APPINSIGHTS_INSTRUMENTATIONKEY: insights.instrumentationKey,
},
});
tall-needle-56640
03/09/2021, 9:10 PMtall-librarian-49374
03/09/2021, 9:25 PMazure.appservice.HttpEventSubscription
is a Pulumi resourcetall-needle-56640
03/09/2021, 9:36 PMtall-librarian-49374
03/09/2021, 10:03 PMbreezy-apartment-46543
03/10/2021, 3:40 PM