Create Pricing Metric
client.PricingMetrics.New(ctx, body) (*PricingMetricResource, error)
/pricing-metrics
Create Pricing Metric
Parameters
Returns
Create Pricing Metric
package main
import (
"context"
"fmt"
"github.com/stainless-sdks/-go"
"github.com/stainless-sdks/-go/option"
)
func main() {
client := lark.NewClient(
option.WithAPIKey("My API Key"),
)
pricingMetricResource, err := client.PricingMetrics.New(context.TODO(), lark.PricingMetricNewParams{
Aggregation: lark.PricingMetricNewParamsAggregationUnion{
OfSum: &lark.PricingMetricNewParamsAggregationSum{
ValueField: "compute_hours",
},
},
EventName: "job_completed",
Name: "Compute Hours",
Unit: "hours",
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", pricingMetricResource.ID)
}
{
"id": "pmtr_GlX5Tcm2HOn00CoRTFxw2Amw",
"aggregation": {
"aggregation_type": "sum",
"value_field": "compute_hours"
},
"event_name": "job_completed",
"name": "Compute Hours",
"unit": "hours",
"dimensions": [
"string"
]
}Returns Examples
{
"id": "pmtr_GlX5Tcm2HOn00CoRTFxw2Amw",
"aggregation": {
"aggregation_type": "sum",
"value_field": "compute_hours"
},
"event_name": "job_completed",
"name": "Compute Hours",
"unit": "hours",
"dimensions": [
"string"
]
}