builder/vmware/common: simplify type assertion switch (#9893)
This commit is contained in:
parent
6334fc2da4
commit
03a0beb683
|
@ -954,20 +954,20 @@ func createDeclaration(node pDeclaration) configDeclaration {
|
||||||
|
|
||||||
// update configDeclaration parameters
|
// update configDeclaration parameters
|
||||||
for _, p := range hierarchy[i].parameters {
|
for _, p := range hierarchy[i].parameters {
|
||||||
switch p.(type) {
|
switch p := p.(type) {
|
||||||
case pParameterOption:
|
case pParameterOption:
|
||||||
result.options[p.(pParameterOption).name] = p.(pParameterOption).value
|
result.options[p.name] = p.value
|
||||||
case pParameterGrant:
|
case pParameterGrant:
|
||||||
Grant := map[string]grant{"ignore": IGNORE, "allow": ALLOW, "deny": DENY}
|
Grant := map[string]grant{"ignore": IGNORE, "allow": ALLOW, "deny": DENY}
|
||||||
result.grants[p.(pParameterGrant).attribute] = Grant[p.(pParameterGrant).verb]
|
result.grants[p.attribute] = Grant[p.verb]
|
||||||
case pParameterBoolean:
|
case pParameterBoolean:
|
||||||
result.attributes[p.(pParameterBoolean).parameter] = p.(pParameterBoolean).truancy
|
result.attributes[p.parameter] = p.truancy
|
||||||
case pParameterClientMatch:
|
case pParameterClientMatch:
|
||||||
result.hostid = append(result.hostid, p.(pParameterClientMatch))
|
result.hostid = append(result.hostid, p)
|
||||||
case pParameterExpression:
|
case pParameterExpression:
|
||||||
result.expressions[p.(pParameterExpression).parameter] = p.(pParameterExpression).expression
|
result.expressions[p.parameter] = p.expression
|
||||||
case pParameterOther:
|
case pParameterOther:
|
||||||
result.parameters[p.(pParameterOther).parameter] = p.(pParameterOther).value
|
result.parameters[p.parameter] = p.value
|
||||||
default:
|
default:
|
||||||
result.address = append(result.address, p)
|
result.address = append(result.address, p)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue