This message was deleted.
# dotnet
s
This message was deleted.
t
It looks like our example is wrong - you should pass an enum value instead of a plain string
SkuName.Standard
m
Ah thanks @tall-librarian-49374. How does this work with storing values in config files? Do the config class methods (e.g. RequireObject) support deserializing to an Enum or do I have to wrap things in an Enum.Parse?
I am a bit stuck here. Looking at the definition I see
Copy code
[EnumType]
public readonly struct SkuName : IEquatable<SkuName>
    {
        public static SkuName Basic { get; }
        public static SkuName Standard { get; }
        public static SkuName Premium { get; }
If I try to use Enum.Parse on this I get back an error saying "Type provided must be an Enum.". Do you know how I can convert the string "Standard" stored in a config file into something that SBSkuArgs will accept as a value for Name or Tier? I was trying
(SkuName)Enum.Parse(typeof(SkuName), "Standard")
This seems to work.. (configTier is a string variable read from the config file)
Tier = (SkuTier)(typeof(SkuTier).GetProperty(configTier )?.GetValue(null))!,
but is is a lot uglier than the AzureNextGen version which was simply
Tier = configTier
t
That’s an interesting use case that we missed I’m afraid. I’m glad you found a workaround. Could you open an issue in https://github.com/pulumi/pulumi/issues describing this?
m
🙏 1