public async Task <ITriggerBinding> TryCreateAsync(TriggerBindingProviderContext context) { ParameterInfo parameter = context.Parameter; BlobTriggerAttribute blobTriggerAttribute = parameter.GetCustomAttribute <BlobTriggerAttribute>(inherit: false); if (blobTriggerAttribute == null) { return(null); } string resolvedCombinedPath = Resolve(blobTriggerAttribute.BlobPath); IBlobPathSource path = BlobPathSource.Create(resolvedCombinedPath); IArgumentBinding <IStorageBlob> argumentBinding = _provider.TryCreate(parameter, access: null); if (argumentBinding == null) { throw new InvalidOperationException("Can't bind BlobTrigger to type '" + parameter.ParameterType + "'."); } IStorageAccount hostAccount = await _accountProvider.GetStorageAccountAsync(context.CancellationToken); IStorageAccount dataAccount = await _accountProvider.GetStorageAccountAsync(context.Parameter, context.CancellationToken, _nameResolver); // premium does not support blob logs, so disallow for blob triggers dataAccount.AssertTypeOneOf(StorageAccountType.GeneralPurpose, StorageAccountType.BlobOnly); ITriggerBinding binding = new BlobTriggerBinding(parameter, argumentBinding, hostAccount, dataAccount, path, _hostIdProvider, _queueConfiguration, _exceptionHandler, _blobWrittenWatcherSetter, _messageEnqueuedWatcherSetter, _sharedContextProvider, _singletonManager, _trace); return(binding); }
public async Task <ITriggerBinding> TryCreateAsync(TriggerBindingProviderContext context) { ParameterInfo parameter = context.Parameter; BlobTriggerAttribute blobTriggerAttribute = parameter.GetCustomAttribute <BlobTriggerAttribute>(inherit: false); if (blobTriggerAttribute == null) { return(null); } string resolvedCombinedPath = Resolve(blobTriggerAttribute.BlobPath); IBlobPathSource path = BlobPathSource.Create(resolvedCombinedPath); IArgumentBinding <IStorageBlob> argumentBinding = _provider.TryCreate(parameter, access: null); if (argumentBinding == null) { throw new InvalidOperationException("Can't bind BlobTrigger to type '" + parameter.ParameterType + "'."); } IStorageAccount hostAccount = await _accountProvider.GetStorageAccountAsync(context.CancellationToken); IStorageAccount dataAccount = await _accountProvider.GetStorageAccountAsync(context.Parameter, context.CancellationToken, _nameResolver); ITriggerBinding binding = new BlobTriggerBinding(parameter, argumentBinding, hostAccount, dataAccount, path, _hostIdProvider, _queueConfiguration, _backgroundExceptionDispatcher, _blobWrittenWatcherSetter, _messageEnqueuedWatcherSetter, _sharedContextProvider, _trace); return(binding); }
public async Task <ITriggerBinding> TryCreateAsync(TriggerBindingProviderContext context) { ParameterInfo parameter = context.Parameter; var blobTriggerAttribute = TypeUtility.GetResolvedAttribute <BlobTriggerAttribute>(context.Parameter); if (blobTriggerAttribute == null) { return(null); } string resolvedCombinedPath = Resolve(blobTriggerAttribute.BlobPath); IBlobPathSource path = BlobPathSource.Create(resolvedCombinedPath); IStorageAccount hostAccount = await _accountProvider.GetStorageAccountAsync(context.CancellationToken); IStorageAccount dataAccount = await _accountProvider.GetStorageAccountAsync(blobTriggerAttribute, context.CancellationToken, _nameResolver); // premium does not support blob logs, so disallow for blob triggers dataAccount.AssertTypeOneOf(StorageAccountType.GeneralPurpose, StorageAccountType.BlobOnly); ITriggerBinding binding = new BlobTriggerBinding(parameter, hostAccount, dataAccount, path, _hostIdProvider, _queueConfiguration, _blobsConfiguration, _exceptionHandler, _blobWrittenWatcherSetter, _messageEnqueuedWatcherSetter, _sharedContextProvider, _singletonManager, _loggerFactory); return(binding); }