upbound / up

The @upbound CLI
Apache License 2.0
52 stars 41 forks source link

Rename `up space billing get` to `export` and fix event tags #367

Closed branden closed 1 year ago

branden commented 1 year ago

Description of your changes

This renames up space billing get to up space billing export and adjusts output accordingly. It also updates the name of the event tag identifying the control plane from mcp_id to mxp_id.

I have:

How has this code been tested

branden@crateria up % make build
<snip>
branden@crateria up % ./_output/bin/darwin_arm64/up space billing export --provider gcp --bucket mcp-usage-localdev --account branden --billing-custom 2023-08-24/2023-08-24
Exporting billing report for Upbound account branden from 2023-08-24T00:00:00Z to 2023-08-25T00:00:00Z.

Reading usage data from storage...
Provider: gcp
Bucket: mcp-usage-localdev

Billing report saved to /Users/branden/Projects/up/upbound_billing_report.tgz
branden@crateria up % tar -xzf upbound_billing_report.tgz
branden@crateria up % cat report/meta.json
{
  "account": "branden",
  "time_range": {
    "start": "2023-08-24T00:00:00Z",
    "end": "2023-08-25T00:00:00Z"
  },
  "collected_at": "2023-08-25T12:55:53.174021-07:00"
}%
branden@crateria up % jq '. | length' < report/usage.json
23
branden@crateria up % jq '.[0]' < report/usage.json
{
  "name": "max_resource_count_per_gvk_per_mxp",
  "tags": {
    "customresource_group": "kubernetes.crossplane.io",
    "customresource_version": "v1alpha1",
    "customresource_kind": "Object",
    "upbound_account": "branden",
    "mxp_id": "7333a38e-4577-4c0b-99da-4962fb66de6d"
  },
  "timestamp": "2023-08-24T01:00:00Z",
  "timestamp_end": "2023-08-24T02:00:00Z",
  "value": 2
}
branden@crateria up %