// For describing InvokeStrings. private async Task <BlobBaseClient> ConvertFromInvokeString(DirectInvokeString input, Attribute attr, ValueBindingContext context) { var attrResolved = (BlobTriggerAttribute)attr; var client = _blobServiceClientProvider.Get(attrResolved.Connection); BlobPath path = BlobPath.ParseAndValidate(input.Value); var container = client.GetBlobContainerClient(path.ContainerName); var blob = await container.GetBlobReferenceFromServerAsync(path.BlobName).ConfigureAwait(false); return(blob.Client); }
public Task <ITriggerBinding> TryCreateAsync(TriggerBindingProviderContext context) { ParameterInfo parameter = context.Parameter; var blobTriggerAttribute = TypeUtility.GetResolvedAttribute <BlobTriggerAttribute>(context.Parameter); if (parameter.ParameterType == typeof(PageBlobClient) && blobTriggerAttribute.Source == BlobTriggerSource.EventGrid) { _logger.LogError($"PageBlobClient is not supported with {nameof(BlobTriggerSource.EventGrid)}"); return(Task.FromResult <ITriggerBinding>(null)); } if (blobTriggerAttribute == null) { return(Task.FromResult <ITriggerBinding>(null)); } string resolvedCombinedPath = Resolve(blobTriggerAttribute.BlobPath); IBlobPathSource path = BlobPathSource.Create(resolvedCombinedPath); var hostBlobServiceClient = _blobServiceClientProvider.GetHost(); var dataBlobServiceClient = _blobServiceClientProvider.Get(blobTriggerAttribute.Connection, _nameResolver); var hostQueueServiceClient = _queueServiceClientProvider.GetHost(); var dataQueueServiceClient = _queueServiceClientProvider.Get(blobTriggerAttribute.Connection, _nameResolver); // premium does not support blob logs, so disallow for blob triggers // $$$ // dataAccount.AssertTypeOneOf(StorageAccountType.GeneralPurpose, StorageAccountType.BlobOnly); ITriggerBinding binding = new BlobTriggerBinding(parameter, hostBlobServiceClient, hostQueueServiceClient, dataBlobServiceClient, dataQueueServiceClient, path, blobTriggerAttribute.Source, _hostIdProvider, _blobsOptions, _exceptionHandler, _blobWrittenWatcherSetter, _blobTriggerQueueWriterFactory, _sharedContextProvider, _singletonManager, _loggerFactory); return(Task.FromResult(binding)); }