FrontDoor RuleSet rules using user defined types #13500
ChristopherGLewis
started this conversation in
Authoring Help
Replies: 1 comment
-
Hey @ChristopherGLewis, this is a perfect use case for the In the Bicep below I have implemented the discriminator type AfdUrlSigning = {
name: 'AfdUrlSigning'
parameters: {
algorithm: 'SHA256'
keyGroupReference: {
id: string
}
parameterNameOverride: [
{
paramIndicator: string
paramName: string
}
]
}
}
type CacheExpiration = {
name: 'CacheExpiration'
parameters: {
cacheBehavior: string
cacheDuration: string
cacheType: 'All'
}
}
@discriminator('name')
type actionType = AfdUrlSigning | CacheExpiration
type frontDoorRulsetRulesObject = {
actions: actionType[]
}
param parRulesObject frontDoorRulsetRulesObject = {
actions: [
input here
]
} It even auto-completes to either AfdUrlSigning or CacheExpiration: I hope this helps you 😃 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
The FrontDoor Ruleset rules resource appears simple (name, order, action, conditions) but when you look at the actions or conditions properties, these are arrays of different objects.
For example, the Action array can include objects of the following types:
I'm trying to make a user defined type to allow for passing this information to a module as a validated object.
WHat I have so far is this:
with subtypes as defined
My
actions
parameter should be an array objects of the allowed types:However, this throws an error:
I think what this is saying is that the array of actions all have to be of the same type, I can't have an array of different actions (which is what is allowed by the resource).
How do I code this UDT?
The UDT documentation says you can have a field of objects with different types: https://learn.microsoft.com/en-us/azure/azure-resource-manager/bicep/user-defined-data-types
so the syntax may be:
but that also throws
Any insights would be helpful.
Beta Was this translation helpful? Give feedback.
All reactions