in src/BundledBindings/EventHubTriggerBinding.cs [17:42]
public override BindingInformation? ExtractBinding(AttributeAst attribute, ParameterAst parameter)
{
BindingInformation bindingInformation = new BindingInformation();
bindingInformation.Type = BindingType;
bindingInformation.Direction = BindingDirection;
bindingInformation.Name = parameter.Name.VariablePath.UserPath;
string eventHubName = WorkerIndexingHelper.GetNamedArgumentStringValue(attribute, Constants.BindingPropertyNames.EventHubName);
string consumerGroup = WorkerIndexingHelper.GetNamedArgumentStringValue(attribute, Constants.BindingPropertyNames.ConsumerGroup);
string cardinality = WorkerIndexingHelper.GetNamedArgumentStringValue(attribute, Constants.BindingPropertyNames.Cardinality);
string connection = WorkerIndexingHelper.GetNamedArgumentStringValue(attribute, Constants.BindingPropertyNames.Connection);
if (!string.IsNullOrWhiteSpace(eventHubName) && !string.IsNullOrWhiteSpace(consumerGroup) && !string.IsNullOrWhiteSpace(cardinality) && !string.IsNullOrWhiteSpace(connection))
{
bindingInformation.otherInformation.Add(Constants.JsonPropertyNames.EventHubName, eventHubName);
bindingInformation.otherInformation.Add(Constants.JsonPropertyNames.ConsumerGroup, consumerGroup);
bindingInformation.otherInformation.Add(Constants.JsonPropertyNames.Cardinality, cardinality);
bindingInformation.otherInformation.Add(Constants.JsonPropertyNames.Connection, connection);
return bindingInformation;
}
else
{
throw new Exception(AzPowerShellSdkStrings.MalformedEventHubAttribute);
}
}