Skip to content

Commit

Permalink
2.3, display PAS version, support for RabbitMQ tile replicator accoun…
Browse files Browse the repository at this point in the history
…ting
  • Loading branch information
avasseur-pivotal committed Mar 24, 2019
1 parent 94fa4bc commit 2fa0fb7
Showing 1 changed file with 23 additions and 4 deletions.
27 changes: 23 additions & 4 deletions cf_bcr.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@ type Metadata struct {
GUID string `json:"guid"`
}

// /v2/info response json
type CCInfo struct {
Name string `json:"name"`
Build string `json:"build"`
}

// Inputs represent the parsed input args
type Inputs struct {
fromDate time.Time
Expand Down Expand Up @@ -78,7 +84,7 @@ func (c *Events) GetMetadata() plugin.PluginMetadata {
Name: "bcr",
Version: plugin.VersionType{
Major: 2,
Minor: 2,
Minor: 3,
Build: 0,
},
Commands: []plugin.Command{
Expand Down Expand Up @@ -112,9 +118,16 @@ func (c Events) Run(cli plugin.CliConnection, args []string) {
Usage(0)
}

// cf api endpoint
api, _ := cli.ApiEndpoint()
fmt.Printf("%s\n", api)

// PAS version
var tRes CCInfo
output, _ := cli.CliCommandWithoutTerminalOutput("curl", "/v2/info")
json.Unmarshal([]byte(strings.Join(output, "")), &tRes)
fmt.Printf("%s (%s)\n", tRes.Build, tRes.Name)

if ins.monthly {
month := c.GetMonthlyUsage(cli)
table := tablewriter.NewWriter(os.Stdout)
Expand Down Expand Up @@ -225,9 +238,15 @@ func (c Events) Run(cli plugin.CliConnection, args []string) {
siRedis += c
total.siRedis += c
default:
siOther += c
total.siOther += c
flat = append(flat, n+":"+strconv.Itoa(c))
// special case for RabbitMQ tile replicator and naming convention
if strings.HasPrefix(n, "p-rabbitmq-") {
siRabbitMQ += c
total.siRabbitMQ += c
} else {
siOther += c
total.siOther += c
flat = append(flat, n+":"+strconv.Itoa(c))
}
}
//flat = append(flat, n+":"+strconv.Itoa(c))
}
Expand Down

0 comments on commit 2fa0fb7

Please sign in to comment.