Skip to content

Commit

Permalink
feat(Usage Reports): Update Account Summary (#261)
Browse files Browse the repository at this point in the history
Signed-off-by: Jonathan Date-chong <jtdatechong@gmail.com>
  • Loading branch information
Jdatechong authored Jun 1, 2023
1 parent c940e94 commit eff265b
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 8 deletions.
20 changes: 20 additions & 0 deletions usagereportsv4/usage_reports_v4.go
Original file line number Diff line number Diff line change
Expand Up @@ -704,6 +704,9 @@ type AccountSummary struct {
// The ID of the account.
AccountID *string `json:"account_id" validate:"required"`

// The list of account resources for the month.
AccountResources []Resource `json:"account_resources,omitempty"`

// The month in which usages were incurred. Represented in yyyy-mm format.
Month *string `json:"month" validate:"required"`

Expand All @@ -722,6 +725,9 @@ type AccountSummary struct {
// Support-related charges.
Support []SupportSummary `json:"support" validate:"required"`

// The list of support resources for the month.
SupportResources []interface{} `json:"support_resources,omitempty"`

// A summary of charges and credits related to a subscription.
Subscription *SubscriptionSummary `json:"subscription" validate:"required"`
}
Expand All @@ -733,6 +739,10 @@ func UnmarshalAccountSummary(m map[string]json.RawMessage, result interface{}) (
if err != nil {
return
}
err = core.UnmarshalModel(m, "account_resources", &obj.AccountResources, UnmarshalResource)
if err != nil {
return
}
err = core.UnmarshalPrimitive(m, "month", &obj.Month)
if err != nil {
return
Expand All @@ -757,6 +767,10 @@ func UnmarshalAccountSummary(m map[string]json.RawMessage, result interface{}) (
if err != nil {
return
}
err = core.UnmarshalPrimitive(m, "support_resources", &obj.SupportResources)
if err != nil {
return
}
err = core.UnmarshalModel(m, "subscription", &obj.Subscription, UnmarshalSubscriptionSummary)
if err != nil {
return
Expand Down Expand Up @@ -1965,6 +1979,8 @@ type Plan struct {
// The pricing region for the plan.
PricingRegion *string `json:"pricing_region,omitempty"`

PricingPlanID *string `json:"pricing_plan_id,omitempty"`

// Indicates if the plan charges are billed to the customer.
Billable *bool `json:"billable" validate:"required"`

Expand Down Expand Up @@ -1999,6 +2015,10 @@ func UnmarshalPlan(m map[string]json.RawMessage, result interface{}) (err error)
if err != nil {
return
}
err = core.UnmarshalPrimitive(m, "pricing_plan_id", &obj.PricingPlanID)
if err != nil {
return
}
err = core.UnmarshalPrimitive(m, "billable", &obj.Billable)
if err != nil {
return
Expand Down
Loading

0 comments on commit eff265b

Please sign in to comment.