(org params.Organization)
| 425 | } |
| 426 | |
| 427 | func formatOneOrganization(org params.Organization) { |
| 428 | if outputFormat == common.OutputFormatJSON { |
| 429 | printAsJSON(org) |
| 430 | return |
| 431 | } |
| 432 | t := table.NewWriter() |
| 433 | rowConfigAutoMerge := table.RowConfig{AutoMerge: true} |
| 434 | header := table.Row{"Field", "Value"} |
| 435 | t.AppendHeader(header) |
| 436 | t.AppendRow(table.Row{"ID", org.ID}) |
| 437 | t.AppendRow(table.Row{"Created At", org.CreatedAt}) |
| 438 | t.AppendRow(table.Row{"Updated At", org.UpdatedAt}) |
| 439 | t.AppendRow(table.Row{"Name", org.Name}) |
| 440 | t.AppendRow(table.Row{"Endpoint", org.Endpoint.Name}) |
| 441 | t.AppendRow(table.Row{"Pool balancer type", org.GetBalancerType()}) |
| 442 | t.AppendRow(table.Row{"Credentials", org.CredentialsName}) |
| 443 | t.AppendRow(table.Row{"Agent mode", org.AgentMode}) |
| 444 | t.AppendRow(table.Row{"Pool manager running", org.PoolManagerStatus.IsRunning}) |
| 445 | if !org.PoolManagerStatus.IsRunning { |
| 446 | t.AppendRow(table.Row{"Failure reason", org.PoolManagerStatus.FailureReason}) |
| 447 | } |
| 448 | if len(org.Pools) > 0 { |
| 449 | for _, pool := range org.Pools { |
| 450 | t.AppendRow(table.Row{"Pools", pool.ID}, rowConfigAutoMerge) |
| 451 | } |
| 452 | } |
| 453 | if len(org.Events) > 0 { |
| 454 | for _, event := range org.Events { |
| 455 | t.AppendRow(table.Row{"Events", fmt.Sprintf("%s %s: %s", event.CreatedAt.Format("2006-01-02T15:04:05"), strings.ToUpper(string(event.EventLevel)), event.Message)}, rowConfigAutoMerge) |
| 456 | } |
| 457 | } |
| 458 | t.SetColumnConfigs([]table.ColumnConfig{ |
| 459 | {Number: 1, AutoMerge: true}, |
| 460 | {Number: 2, AutoMerge: false, WidthMax: 100}, |
| 461 | }) |
| 462 | |
| 463 | fmt.Println(t.Render()) |
| 464 | } |
no test coverage detected