Hey folks! I think I've run into another type issu...
# dotnet
f
Hey folks! I think I've run into another type issue inside the Azure Native provider's .Net package. I'm trying to create a Service Bus Queue Authorization Rule, and the
Rights
property's types are misbehaving. Its requirements are pretty nested:
Pulumi.InputList<Pulumi.Union<string,Pulumi.AzureNative.ServiceBus.AccessRights>>
. If I provide the input shown in the docs, I get this issue in response:
Copy code
var serviceBusAuthorizationRule = new QueueAuthorizationRule("p4-ado-sync-queue-auth", new ()
    {
        ResourceGroupName = resourceGroup.Name,
        NamespaceName = serviceBusNamespace.Name,
        QueueName = serviceBusQueue.Name,
        # Using strings
        Rights = new[] # => Cannot convert source type 'string[]' to target type 'Pulumi.InputList<Pulumi.Union<string,Pulumi.AzureNative.ServiceBus.AccessRights>>'
        {
            "Listen",
            "Send"
        }
        # Using the struct
        Rights = new[] # => Cannot convert source type 'Pulumi.AzureNative.ServiceBus.AccessRights[]' to target type 'Pulumi.InputList<Pulumi.Union<string,Pulumi.AzureNative.ServiceBus.AccessRights>>'
        {
            AccessRights.Listen,
            AccessRights.Send
        }
    }
);
I ran into a similar situation in the past, where the type inheritance was a little too deep for .Net to figure out on its own (Slack thread and Github issue). While that was able to be fixed with a cast, I'm struggling to figure out how I might coerce or cast this one. As-is, I fear this resource type is unusable. Does anyone know how I might resolve this, or should I be filing an issue on Github?
Of course, as soon as I post about a problem I've been grappling with, I figure out a solution (of sorts):
Copy code
Rights = new InputList<Union<string, AccessRights>>
{
    AccessRights.Listen
}
This works correctly. However, it's rather unintuitive, and at the least, shows the docs are in need of a correction