Skip to content

Commit

Permalink
update hourly usage API docs for partner program (#2577)
Browse files Browse the repository at this point in the history
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
Co-authored-by: api-clients-generation-pipeline[bot] <54105614+api-clients-generation-pipeline[bot]@users.noreply.github.com>
  • Loading branch information
api-clients-generation-pipeline[bot] and ci.datadog-api-spec committed Jul 18, 2024
1 parent 05d36c0 commit e88e260
Show file tree
Hide file tree
Showing 4 changed files with 112 additions and 17 deletions.
8 changes: 4 additions & 4 deletions .apigentools-info
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
"spec_versions": {
"v1": {
"apigentools_version": "1.6.6",
"regenerated": "2024-07-18 17:22:34.134353",
"spec_repo_commit": "9ab8be35"
"regenerated": "2024-07-18 19:17:56.082385",
"spec_repo_commit": "8f19ff48"
},
"v2": {
"apigentools_version": "1.6.6",
"regenerated": "2024-07-18 17:22:34.158239",
"spec_repo_commit": "9ab8be35"
"regenerated": "2024-07-18 19:17:56.107292",
"spec_repo_commit": "8f19ff48"
}
}
}
15 changes: 15 additions & 0 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8741,6 +8741,12 @@ components:
description: Attributes of hourly usage for a product family for an org for
a time period.
properties:
account_name:
description: The account name.
type: string
account_public_id:
description: The account public ID.
type: string
measurements:
description: List of the measured usage values for the product family for
the org for the time period.
Expand Down Expand Up @@ -36772,6 +36778,15 @@ paths:
schema:
default: false
type: boolean
- description: Boolean to specify whether to include accounts connected to the
current account as partner customers in the Datadog partner network program.
Defaults to false.
in: query
name: filter[include_connected_accounts]
required: false
schema:
default: false
type: boolean
- description: Include breakdown of usage by subcategories where applicable
(for product family logs only). Defaults to false.
in: query
Expand Down
22 changes: 16 additions & 6 deletions api/datadogV2/api_usage_metering.go
Original file line number Diff line number Diff line change
Expand Up @@ -469,12 +469,13 @@ func (a *UsageMeteringApi) GetHistoricalCostByOrg(ctx _context.Context, startMon

// GetHourlyUsageOptionalParameters holds optional parameters for GetHourlyUsage.
type GetHourlyUsageOptionalParameters struct {
FilterTimestampEnd *time.Time
FilterIncludeDescendants *bool
FilterIncludeBreakdown *bool
FilterVersions *string
PageLimit *int32
PageNextRecordId *string
FilterTimestampEnd *time.Time
FilterIncludeDescendants *bool
FilterIncludeConnectedAccounts *bool
FilterIncludeBreakdown *bool
FilterVersions *string
PageLimit *int32
PageNextRecordId *string
}

// NewGetHourlyUsageOptionalParameters creates an empty struct for parameters.
Expand All @@ -495,6 +496,12 @@ func (r *GetHourlyUsageOptionalParameters) WithFilterIncludeDescendants(filterIn
return r
}

// WithFilterIncludeConnectedAccounts sets the corresponding parameter name and returns the struct.
func (r *GetHourlyUsageOptionalParameters) WithFilterIncludeConnectedAccounts(filterIncludeConnectedAccounts bool) *GetHourlyUsageOptionalParameters {
r.FilterIncludeConnectedAccounts = &filterIncludeConnectedAccounts
return r
}

// WithFilterIncludeBreakdown sets the corresponding parameter name and returns the struct.
func (r *GetHourlyUsageOptionalParameters) WithFilterIncludeBreakdown(filterIncludeBreakdown bool) *GetHourlyUsageOptionalParameters {
r.FilterIncludeBreakdown = &filterIncludeBreakdown
Expand Down Expand Up @@ -554,6 +561,9 @@ func (a *UsageMeteringApi) GetHourlyUsage(ctx _context.Context, filterTimestampS
if optionalParams.FilterIncludeDescendants != nil {
localVarQueryParams.Add("filter[include_descendants]", datadog.ParameterToString(*optionalParams.FilterIncludeDescendants, ""))
}
if optionalParams.FilterIncludeConnectedAccounts != nil {
localVarQueryParams.Add("filter[include_connected_accounts]", datadog.ParameterToString(*optionalParams.FilterIncludeConnectedAccounts, ""))
}
if optionalParams.FilterIncludeBreakdown != nil {
localVarQueryParams.Add("filter[include_breakdown]", datadog.ParameterToString(*optionalParams.FilterIncludeBreakdown, ""))
}
Expand Down
84 changes: 77 additions & 7 deletions api/datadogV2/model_hourly_usage_attributes.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ import (

// HourlyUsageAttributes Attributes of hourly usage for a product family for an org for a time period.
type HourlyUsageAttributes struct {
// The account name.
AccountName *string `json:"account_name,omitempty"`
// The account public ID.
AccountPublicId *string `json:"account_public_id,omitempty"`
// List of the measured usage values for the product family for the org for the time period.
Measurements []HourlyUsageMeasurement `json:"measurements,omitempty"`
// The organization name.
Expand Down Expand Up @@ -46,6 +50,62 @@ func NewHourlyUsageAttributesWithDefaults() *HourlyUsageAttributes {
return &this
}

// GetAccountName returns the AccountName field value if set, zero value otherwise.
func (o *HourlyUsageAttributes) GetAccountName() string {
if o == nil || o.AccountName == nil {
var ret string
return ret
}
return *o.AccountName
}

// GetAccountNameOk returns a tuple with the AccountName field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *HourlyUsageAttributes) GetAccountNameOk() (*string, bool) {
if o == nil || o.AccountName == nil {
return nil, false
}
return o.AccountName, true
}

// HasAccountName returns a boolean if a field has been set.
func (o *HourlyUsageAttributes) HasAccountName() bool {
return o != nil && o.AccountName != nil
}

// SetAccountName gets a reference to the given string and assigns it to the AccountName field.
func (o *HourlyUsageAttributes) SetAccountName(v string) {
o.AccountName = &v
}

// GetAccountPublicId returns the AccountPublicId field value if set, zero value otherwise.
func (o *HourlyUsageAttributes) GetAccountPublicId() string {
if o == nil || o.AccountPublicId == nil {
var ret string
return ret
}
return *o.AccountPublicId
}

// GetAccountPublicIdOk returns a tuple with the AccountPublicId field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *HourlyUsageAttributes) GetAccountPublicIdOk() (*string, bool) {
if o == nil || o.AccountPublicId == nil {
return nil, false
}
return o.AccountPublicId, true
}

// HasAccountPublicId returns a boolean if a field has been set.
func (o *HourlyUsageAttributes) HasAccountPublicId() bool {
return o != nil && o.AccountPublicId != nil
}

// SetAccountPublicId gets a reference to the given string and assigns it to the AccountPublicId field.
func (o *HourlyUsageAttributes) SetAccountPublicId(v string) {
o.AccountPublicId = &v
}

// GetMeasurements returns the Measurements field value if set, zero value otherwise.
func (o *HourlyUsageAttributes) GetMeasurements() []HourlyUsageMeasurement {
if o == nil || o.Measurements == nil {
Expand Down Expand Up @@ -220,6 +280,12 @@ func (o HourlyUsageAttributes) MarshalJSON() ([]byte, error) {
if o.UnparsedObject != nil {
return datadog.Marshal(o.UnparsedObject)
}
if o.AccountName != nil {
toSerialize["account_name"] = o.AccountName
}
if o.AccountPublicId != nil {
toSerialize["account_public_id"] = o.AccountPublicId
}
if o.Measurements != nil {
toSerialize["measurements"] = o.Measurements
}
Expand Down Expand Up @@ -252,22 +318,26 @@ func (o HourlyUsageAttributes) MarshalJSON() ([]byte, error) {
// UnmarshalJSON deserializes the given payload.
func (o *HourlyUsageAttributes) UnmarshalJSON(bytes []byte) (err error) {
all := struct {
Measurements []HourlyUsageMeasurement `json:"measurements,omitempty"`
OrgName *string `json:"org_name,omitempty"`
ProductFamily *string `json:"product_family,omitempty"`
PublicId *string `json:"public_id,omitempty"`
Region *string `json:"region,omitempty"`
Timestamp *time.Time `json:"timestamp,omitempty"`
AccountName *string `json:"account_name,omitempty"`
AccountPublicId *string `json:"account_public_id,omitempty"`
Measurements []HourlyUsageMeasurement `json:"measurements,omitempty"`
OrgName *string `json:"org_name,omitempty"`
ProductFamily *string `json:"product_family,omitempty"`
PublicId *string `json:"public_id,omitempty"`
Region *string `json:"region,omitempty"`
Timestamp *time.Time `json:"timestamp,omitempty"`
}{}
if err = datadog.Unmarshal(bytes, &all); err != nil {
return datadog.Unmarshal(bytes, &o.UnparsedObject)
}
additionalProperties := make(map[string]interface{})
if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil {
datadog.DeleteKeys(additionalProperties, &[]string{"measurements", "org_name", "product_family", "public_id", "region", "timestamp"})
datadog.DeleteKeys(additionalProperties, &[]string{"account_name", "account_public_id", "measurements", "org_name", "product_family", "public_id", "region", "timestamp"})
} else {
return err
}
o.AccountName = all.AccountName
o.AccountPublicId = all.AccountPublicId
o.Measurements = all.Measurements
o.OrgName = all.OrgName
o.ProductFamily = all.ProductFamily
Expand Down

0 comments on commit e88e260

Please sign in to comment.