(rows []policyTableRow, p *policy.Policy, def *policy.Definition)
| 281 | } |
| 282 | |
| 283 | func appendSchedulingPolicyRows(rows []policyTableRow, p *policy.Policy, def *policy.Definition) []policyTableRow { |
| 284 | rows = append(rows, policyTableRow{"Scheduling policy:", "", ""}) |
| 285 | |
| 286 | hasAny := false |
| 287 | |
| 288 | rows = append(rows, policyTableRow{" Scheduled snapshots:", "", ""}) |
| 289 | |
| 290 | if p.SchedulingPolicy.Interval() != 0 { |
| 291 | rows = append(rows, policyTableRow{ |
| 292 | " Snapshot interval:", |
| 293 | p.SchedulingPolicy.Interval().String(), |
| 294 | definitionPointToString(p.Target(), def.SchedulingPolicy.IntervalSeconds), |
| 295 | }) |
| 296 | |
| 297 | hasAny = true |
| 298 | } |
| 299 | |
| 300 | if len(p.SchedulingPolicy.TimesOfDay) > 0 { |
| 301 | rows = append(rows, |
| 302 | policyTableRow{ |
| 303 | " Run missed snapshots:", |
| 304 | boolToString(p.SchedulingPolicy.RunMissed.OrDefault(false)), |
| 305 | definitionPointToString(p.Target(), def.SchedulingPolicy.RunMissed), |
| 306 | }, |
| 307 | policyTableRow{ |
| 308 | " Snapshot times:", |
| 309 | "", |
| 310 | definitionPointToString(p.Target(), def.SchedulingPolicy.TimesOfDay), |
| 311 | }) |
| 312 | |
| 313 | for _, tod := range p.SchedulingPolicy.TimesOfDay { |
| 314 | rows = append(rows, policyTableRow{" " + tod.String(), "", ""}) |
| 315 | } |
| 316 | |
| 317 | hasAny = true |
| 318 | } |
| 319 | |
| 320 | if len(p.SchedulingPolicy.Cron) > 0 { |
| 321 | rows = append(rows, policyTableRow{" Crontab expressions:", "", definitionPointToString(p.Target(), def.SchedulingPolicy.Cron)}) |
| 322 | |
| 323 | for _, cron := range p.SchedulingPolicy.Cron { |
| 324 | rows = append(rows, policyTableRow{" " + cron, "", ""}) |
| 325 | } |
| 326 | |
| 327 | hasAny = true |
| 328 | } |
| 329 | |
| 330 | if !hasAny { |
| 331 | rows = append(rows, policyTableRow{" None.", "", ""}) |
| 332 | } |
| 333 | |
| 334 | rows = append(rows, policyTableRow{" Manual snapshot:", boolToString(p.SchedulingPolicy.Manual), definitionPointToString(p.Target(), def.SchedulingPolicy.Manual)}) |
| 335 | |
| 336 | return rows |
| 337 | } |
| 338 | |
| 339 | func appendCompressionPolicyRows(rows []policyTableRow, p *policy.Policy, def *policy.Definition) []policyTableRow { |
| 340 | if p.CompressionPolicy.CompressorName == "" || p.CompressionPolicy.CompressorName == "none" { |
no test coverage detected