in source/code/plugins/npmd_config_lib.rb [347:432]
def self.createERElements(erHash)
return if erHash.nil?
_er = Hash.new
erHash.each do |key, rules|
if key == "PrivatePeeringRules"
_ruleList = Array.new
for i in 0..rules.length-1
_pvtRule = Hash.new
_iRule = rules[i]
_pvtRule["Name"] = _iRule["Name"]
_pvtRule["ConnectionResourceId"] = _iRule["ConnectionResourceId"]
_pvtRule["CircuitResourceId"] = _iRule["CircuitResourceId"]
_pvtRule["CircuitName"] = _iRule["CircuitName"]
_pvtRule["VirtualNetworkName"] = _iRule["vNetName"]
_pvtRule["Protocol"] = _iRule["Protocol"].to_s
_thresholdMap = Hash.new
_thresholdMap["ChecksFailedPercent"] = _iRule["LossThreshold"].to_s
_thresholdMap["RoundTripTimeMs"] = _iRule["LatencyThreshold"].to_s
_pvtRule["AlertConfiguration"] = _thresholdMap
_onPremAgents = Array.new
_onPremAgentList = _iRule["OnPremAgents"]
for j in 0.._onPremAgentList.length-1
_onPremAgents.push(_onPremAgentList[j])
end
_pvtRule["OnPremAgents"] = _onPremAgents
_azureAgents = Array.new
_azureAgentsList = _iRule["AzureAgents"]
for k in 0.._azureAgentsList.length-1
_azureAgents.push(_azureAgentsList[k])
end
_pvtRule["AzureAgents"] = _azureAgents
_ruleList.push(_pvtRule)
end
_er[:"PrivateRules"] = _ruleList if !_ruleList.empty?
end
if key == "MSPeeringRules"
_ruleList = Array.new
for i in 0..rules.length-1
_msRule = Hash.new
_iRule = rules[i]
_msRule["Name"] = _iRule["Name"]
_msRule["CircuitName"] = _iRule["CircuitName"]
_msRule["Protocol"] = _iRule["Protocol"].to_s
_msRule["CircuitResourceId"] = _iRule["CircuitResourceId"]
_thresholdMap = Hash.new
_thresholdMap["ChecksFailedPercent"] = _iRule["LossThreshold"].to_s
_thresholdMap["RoundTripTimeMs"] = _iRule["LatencyThreshold"].to_s
_msRule["AlertConfiguration"] = _thresholdMap
_onPremAgents = Array.new
_onPremAgentList = _iRule["OnPremAgents"]
for j in 0.._onPremAgentList.length-1
_onPremAgents.push(_onPremAgentList[j])
end
_msRule["OnPremAgents"] = _onPremAgents
_urls = Array.new
_urlList = _iRule["UrlList"]
for k in 0.._urlList.length-1
_urlHash = Hash.new
_urlHash["Target"] = _urlList[k]["url"]
_urlHash["Port"] = _urlList[k]["port"].to_s
_urls.push(_urlHash)
end
_msRule["URLs"] = _urls
_ruleList.push(_msRule)
end
_er[:"MSPeeringRules"] = _ruleList if !_ruleList.empty?
end
end
_er
end