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
1 change: 1 addition & 0 deletions docs/tables/scaleway_billing_consumption.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Scaleway Billing Consumption tracks the costs of various scaleway products such

**Important Notes**
- This table requires an Organization ID to be configured in the `scaleway.spc` file.
- You can optionally filter by `billing_period` (format: YYYY-MM) to query specific months.

## Table Usage Guide

Expand Down
14 changes: 14 additions & 0 deletions scaleway/table_scaleway_billing_consumption.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,19 @@ func tableScalewayBillingConsumption(_ context.Context) *plugin.Table {
Name: "category_name",
Require: plugin.Optional,
},
{
Name: "billing_period",
Require: plugin.Optional,
},
},
},
Columns: []*plugin.Column{
{
Name: "billing_period",
Description: "The billing period filter used in the query (YYYY-MM format). Note: This reflects the filter value, not API data.",
Type: proto.ColumnType_STRING,
Transform: transform.FromQual("billing_period"),
},
{
Name: "category_name",
Description: "The CategoryName: name of consumption category.",
Expand Down Expand Up @@ -106,6 +116,10 @@ func listBillingConsumption(ctx context.Context, d *plugin.QueryData, _ *plugin.
req.CategoryName = scw.StringPtr(quals["category_name"].GetStringValue())
}

if quals["billing_period"] != nil {
req.BillingPeriod = scw.StringPtr(quals["billing_period"].GetStringValue())
}

// Retrieve the list of consumptions
maxResult := int64(100)

Expand Down
Loading