Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -236,13 +236,13 @@ If you want to try it out, install it directly from [the github releases tab as

```sh
# osx 64bit
cf install-plugin -f https://github.com/aegershman/cf-report-usage-plugin/releases/download/3.1.0/cf-report-usage-plugin-darwin
cf install-plugin -f https://github.com/aegershman/cf-report-usage-plugin/releases/download/3.1.1/cf-report-usage-plugin-darwin

# linux 64bit (32bit and ARM6 also available)
cf install-plugin -f https://github.com/aegershman/cf-report-usage-plugin/releases/download/3.1.0/cf-report-usage-plugin-linux-amd64
cf install-plugin -f https://github.com/aegershman/cf-report-usage-plugin/releases/download/3.1.1/cf-report-usage-plugin-linux-amd64

# windows 64bit (32bit also available)
cf install-plugin -f https://github.com/aegershman/cf-report-usage-plugin/releases/download/3.1.0/cf-report-usage-plugin-windows-amd64.exe
cf install-plugin -f https://github.com/aegershman/cf-report-usage-plugin/releases/download/3.1.1/cf-report-usage-plugin-windows-amd64.exe
```

## backwards compatibility
Expand Down
3 changes: 3 additions & 0 deletions Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,7 @@ tasks:
- cf report-usage -o voyager -o tenzing --format json
# TODO will remove this last line, shouldn't be displayed in README
- cf report-usage -o voyager -o tenzing --format table-org-quota
# TODO long running / test failures
- cf report-usage --format table-org-quota
- cf report-usage -o not-real-org
- task: uninstall
4 changes: 2 additions & 2 deletions cmd/reportusage/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func (cmd *reportUsageCmd) reportUsageCommand(cli plugin.CliConnection, args []s
log.SetLevel(logLevel)

reporter := report.NewClient(cli)
summaryReport, err := reporter.GetSummaryReportByOrgNames(orgNamesFlag.names)
summaryReport, err := reporter.GetSummaryReportByOrgNames(orgNamesFlag.names...)
if err != nil {
log.Fatalln(err)
}
Expand All @@ -76,7 +76,7 @@ func (cmd *reportUsageCmd) GetMetadata() plugin.PluginMetadata {
Version: plugin.VersionType{
Major: 3,
Minor: 1,
Build: 0,
Build: 1,
},
Commands: []plugin.Command{
{
Expand Down
10 changes: 5 additions & 5 deletions internal/report/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ func NewClient(cli plugin.CliConnection) *Client {
}

// GetSummaryReportByOrgNames -
func (r *Client) GetSummaryReportByOrgNames(orgNames []string) (*SummaryReport, error) {
populatedOrgs, err := r.getOrgs(orgNames)
func (r *Client) GetSummaryReportByOrgNames(orgNames ...string) (*SummaryReport, error) {
populatedOrgs, err := r.getOrgs(orgNames...)
if err != nil {
return &SummaryReport{}, nil
}
Expand All @@ -28,11 +28,11 @@ func (r *Client) GetSummaryReportByOrgNames(orgNames []string) (*SummaryReport,
for _, org := range populatedOrgs {
spaceReports := r.getSpaceReportsByOrg(org)
orgQuota, _ := r.client.OrgQuotas.GetOrgQuota(org.QuotaURL)
orgReport := *NewOrgReport(orgQuota, org, spaceReports)
orgReport := *NewOrgReport(orgQuota, org, spaceReports...)
orgReports = append(orgReports, orgReport)
}

return NewSummaryReport(orgReports), nil
return NewSummaryReport(orgReports...), nil
}

func (r *Client) getSpaceReportsByOrg(org v2client.Org) []SpaceReport {
Expand All @@ -44,7 +44,7 @@ func (r *Client) getSpaceReportsByOrg(org v2client.Org) []SpaceReport {
return spaceReports
}

func (r *Client) getOrgs(orgNames []string) ([]v2client.Org, error) {
func (r *Client) getOrgs(orgNames ...string) ([]v2client.Org, error) {
var rawOrgs []v2client.Org

if len(orgNames) > 0 {
Expand Down
2 changes: 1 addition & 1 deletion internal/report/org_report.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ type OrgReport struct {
}

// NewOrgReport -
func NewOrgReport(orgQuota v2client.OrgQuota, org v2client.Org, spaceReports []SpaceReport) *OrgReport {
func NewOrgReport(orgQuota v2client.OrgQuota, org v2client.Org, spaceReports ...SpaceReport) *OrgReport {
self := &OrgReport{
OrgQuota: orgQuota,
orgRef: org,
Expand Down
2 changes: 1 addition & 1 deletion internal/report/summary_report.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ type SummaryReport struct {
}

// NewSummaryReport -
func NewSummaryReport(orgReports []OrgReport) *SummaryReport {
func NewSummaryReport(orgReports ...OrgReport) *SummaryReport {
self := &SummaryReport{
OrgReports: orgReports,
}
Expand Down