Skip to content

Commit

Permalink
Regenerate client from commit c4a891f3 of spec repo
Browse files Browse the repository at this point in the history
  • Loading branch information
ci.datadog-api-spec committed Oct 17, 2024
1 parent 3942488 commit 9a87fd7
Show file tree
Hide file tree
Showing 7 changed files with 106 additions and 37 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-10-16 20:07:12.155834",
"spec_repo_commit": "86072741"
"regenerated": "2024-10-17 13:57:32.678494",
"spec_repo_commit": "c4a891f3"
},
"v2": {
"apigentools_version": "1.6.6",
"regenerated": "2024-10-16 20:07:12.175711",
"spec_repo_commit": "86072741"
"regenerated": "2024-10-17 13:57:32.696958",
"spec_repo_commit": "c4a891f3"
}
}
}
5 changes: 5 additions & 0 deletions .generator/schemas/v1/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16166,6 +16166,9 @@ components:
SyntheticsStepDetail:
description: Object describing a step for a Synthetic test.
properties:
allowFailure:
description: Whether or not the step was allowed to fail.
type: boolean
browserErrors:
description: Array of errors collected for a browser test.
items:
Expand All @@ -16183,6 +16186,8 @@ components:
error:
description: Error returned by the test.
type: string
failure:
$ref: '#/components/schemas/SyntheticsBrowserTestResultFailure'
playingTab:
$ref: '#/components/schemas/SyntheticsPlayingTab'
screenshotBucketKey:
Expand Down
2 changes: 1 addition & 1 deletion .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28730,7 +28730,7 @@ paths:
for cost ending this month.'
in: query
name: end_month
required: false
required: true
schema:
format: date-time
type: string
Expand Down
109 changes: 91 additions & 18 deletions api/datadogV1/model_synthetics_step_detail.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import (

// SyntheticsStepDetail Object describing a step for a Synthetic test.
type SyntheticsStepDetail struct {
// Whether or not the step was allowed to fail.
AllowFailure *bool `json:"allowFailure,omitempty"`
// Array of errors collected for a browser test.
BrowserErrors []SyntheticsBrowserError `json:"browserErrors,omitempty"`
// Type of assertion to apply in an API test.
Expand All @@ -20,6 +22,8 @@ type SyntheticsStepDetail struct {
Duration *float64 `json:"duration,omitempty"`
// Error returned by the test.
Error *string `json:"error,omitempty"`
// The browser test failure details.
Failure *SyntheticsBrowserTestResultFailure `json:"failure,omitempty"`
// Navigate between different tabs for your browser test.
PlayingTab *SyntheticsPlayingTab `json:"playingTab,omitempty"`
// Whether or not screenshots where collected by the test.
Expand Down Expand Up @@ -67,6 +71,34 @@ func NewSyntheticsStepDetailWithDefaults() *SyntheticsStepDetail {
return &this
}

// GetAllowFailure returns the AllowFailure field value if set, zero value otherwise.
func (o *SyntheticsStepDetail) GetAllowFailure() bool {
if o == nil || o.AllowFailure == nil {
var ret bool
return ret
}
return *o.AllowFailure
}

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

// HasAllowFailure returns a boolean if a field has been set.
func (o *SyntheticsStepDetail) HasAllowFailure() bool {
return o != nil && o.AllowFailure != nil
}

// SetAllowFailure gets a reference to the given bool and assigns it to the AllowFailure field.
func (o *SyntheticsStepDetail) SetAllowFailure(v bool) {
o.AllowFailure = &v
}

// GetBrowserErrors returns the BrowserErrors field value if set, zero value otherwise.
func (o *SyntheticsStepDetail) GetBrowserErrors() []SyntheticsBrowserError {
if o == nil || o.BrowserErrors == nil {
Expand Down Expand Up @@ -207,6 +239,34 @@ func (o *SyntheticsStepDetail) SetError(v string) {
o.Error = &v
}

// GetFailure returns the Failure field value if set, zero value otherwise.
func (o *SyntheticsStepDetail) GetFailure() SyntheticsBrowserTestResultFailure {
if o == nil || o.Failure == nil {
var ret SyntheticsBrowserTestResultFailure
return ret
}
return *o.Failure
}

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

// HasFailure returns a boolean if a field has been set.
func (o *SyntheticsStepDetail) HasFailure() bool {
return o != nil && o.Failure != nil
}

// SetFailure gets a reference to the given SyntheticsBrowserTestResultFailure and assigns it to the Failure field.
func (o *SyntheticsStepDetail) SetFailure(v SyntheticsBrowserTestResultFailure) {
o.Failure = &v
}

// GetPlayingTab returns the PlayingTab field value if set, zero value otherwise.
func (o *SyntheticsStepDetail) GetPlayingTab() SyntheticsPlayingTab {
if o == nil || o.PlayingTab == nil {
Expand Down Expand Up @@ -549,6 +609,9 @@ func (o SyntheticsStepDetail) MarshalJSON() ([]byte, error) {
if o.UnparsedObject != nil {
return datadog.Marshal(o.UnparsedObject)
}
if o.AllowFailure != nil {
toSerialize["allowFailure"] = o.AllowFailure
}
if o.BrowserErrors != nil {
toSerialize["browserErrors"] = o.BrowserErrors
}
Expand All @@ -564,6 +627,9 @@ func (o SyntheticsStepDetail) MarshalJSON() ([]byte, error) {
if o.Error != nil {
toSerialize["error"] = o.Error
}
if o.Failure != nil {
toSerialize["failure"] = o.Failure
}
if o.PlayingTab != nil {
toSerialize["playingTab"] = o.PlayingTab
}
Expand Down Expand Up @@ -610,35 +676,38 @@ func (o SyntheticsStepDetail) MarshalJSON() ([]byte, error) {
// UnmarshalJSON deserializes the given payload.
func (o *SyntheticsStepDetail) UnmarshalJSON(bytes []byte) (err error) {
all := struct {
BrowserErrors []SyntheticsBrowserError `json:"browserErrors,omitempty"`
CheckType *SyntheticsCheckType `json:"checkType,omitempty"`
Description *string `json:"description,omitempty"`
Duration *float64 `json:"duration,omitempty"`
Error *string `json:"error,omitempty"`
PlayingTab *SyntheticsPlayingTab `json:"playingTab,omitempty"`
ScreenshotBucketKey *bool `json:"screenshotBucketKey,omitempty"`
Skipped *bool `json:"skipped,omitempty"`
SnapshotBucketKey *bool `json:"snapshotBucketKey,omitempty"`
StepId *int64 `json:"stepId,omitempty"`
SubTestStepDetails []SyntheticsStepDetail `json:"subTestStepDetails,omitempty"`
TimeToInteractive *float64 `json:"timeToInteractive,omitempty"`
Type *SyntheticsStepType `json:"type,omitempty"`
Url *string `json:"url,omitempty"`
Value interface{} `json:"value,omitempty"`
VitalsMetrics []SyntheticsCoreWebVitals `json:"vitalsMetrics,omitempty"`
Warnings []SyntheticsStepDetailWarning `json:"warnings,omitempty"`
AllowFailure *bool `json:"allowFailure,omitempty"`
BrowserErrors []SyntheticsBrowserError `json:"browserErrors,omitempty"`
CheckType *SyntheticsCheckType `json:"checkType,omitempty"`
Description *string `json:"description,omitempty"`
Duration *float64 `json:"duration,omitempty"`
Error *string `json:"error,omitempty"`
Failure *SyntheticsBrowserTestResultFailure `json:"failure,omitempty"`
PlayingTab *SyntheticsPlayingTab `json:"playingTab,omitempty"`
ScreenshotBucketKey *bool `json:"screenshotBucketKey,omitempty"`
Skipped *bool `json:"skipped,omitempty"`
SnapshotBucketKey *bool `json:"snapshotBucketKey,omitempty"`
StepId *int64 `json:"stepId,omitempty"`
SubTestStepDetails []SyntheticsStepDetail `json:"subTestStepDetails,omitempty"`
TimeToInteractive *float64 `json:"timeToInteractive,omitempty"`
Type *SyntheticsStepType `json:"type,omitempty"`
Url *string `json:"url,omitempty"`
Value interface{} `json:"value,omitempty"`
VitalsMetrics []SyntheticsCoreWebVitals `json:"vitalsMetrics,omitempty"`
Warnings []SyntheticsStepDetailWarning `json:"warnings,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{"browserErrors", "checkType", "description", "duration", "error", "playingTab", "screenshotBucketKey", "skipped", "snapshotBucketKey", "stepId", "subTestStepDetails", "timeToInteractive", "type", "url", "value", "vitalsMetrics", "warnings"})
datadog.DeleteKeys(additionalProperties, &[]string{"allowFailure", "browserErrors", "checkType", "description", "duration", "error", "failure", "playingTab", "screenshotBucketKey", "skipped", "snapshotBucketKey", "stepId", "subTestStepDetails", "timeToInteractive", "type", "url", "value", "vitalsMetrics", "warnings"})
} else {
return err
}

hasInvalidField := false
o.AllowFailure = all.AllowFailure
o.BrowserErrors = all.BrowserErrors
if all.CheckType != nil && !all.CheckType.IsValid() {
hasInvalidField = true
Expand All @@ -648,6 +717,10 @@ func (o *SyntheticsStepDetail) UnmarshalJSON(bytes []byte) (err error) {
o.Description = all.Description
o.Duration = all.Duration
o.Error = all.Error
if all.Failure != nil && all.Failure.UnparsedObject != nil && o.UnparsedObject == nil {
hasInvalidField = true
}
o.Failure = all.Failure
if all.PlayingTab != nil && !all.PlayingTab.IsValid() {
hasInvalidField = true
} else {
Expand Down
13 changes: 2 additions & 11 deletions api/datadogV2/api_usage_metering.go
Original file line number Diff line number Diff line change
Expand Up @@ -639,7 +639,6 @@ func (a *UsageMeteringApi) GetHourlyUsage(ctx _context.Context, filterTimestampS

// GetMonthlyCostAttributionOptionalParameters holds optional parameters for GetMonthlyCostAttribution.
type GetMonthlyCostAttributionOptionalParameters struct {
EndMonth *time.Time
SortDirection *SortDirection
SortName *string
TagBreakdownKeys *string
Expand All @@ -653,12 +652,6 @@ func NewGetMonthlyCostAttributionOptionalParameters() *GetMonthlyCostAttribution
return &this
}

// WithEndMonth sets the corresponding parameter name and returns the struct.
func (r *GetMonthlyCostAttributionOptionalParameters) WithEndMonth(endMonth time.Time) *GetMonthlyCostAttributionOptionalParameters {
r.EndMonth = &endMonth
return r
}

// WithSortDirection sets the corresponding parameter name and returns the struct.
func (r *GetMonthlyCostAttributionOptionalParameters) WithSortDirection(sortDirection SortDirection) *GetMonthlyCostAttributionOptionalParameters {
r.SortDirection = &sortDirection
Expand Down Expand Up @@ -708,7 +701,7 @@ func (r *GetMonthlyCostAttributionOptionalParameters) WithIncludeDescendants(inc
// ```
//
// This endpoint is only accessible for [parent-level organizations](https://docs.datadoghq.com/account_management/multi_organization/).
func (a *UsageMeteringApi) GetMonthlyCostAttribution(ctx _context.Context, startMonth time.Time, fields string, o ...GetMonthlyCostAttributionOptionalParameters) (MonthlyCostAttributionResponse, *_nethttp.Response, error) {
func (a *UsageMeteringApi) GetMonthlyCostAttribution(ctx _context.Context, startMonth time.Time, endMonth time.Time, fields string, o ...GetMonthlyCostAttributionOptionalParameters) (MonthlyCostAttributionResponse, *_nethttp.Response, error) {
var (
localVarHTTPMethod = _nethttp.MethodGet
localVarPostBody interface{}
Expand Down Expand Up @@ -741,10 +734,8 @@ func (a *UsageMeteringApi) GetMonthlyCostAttribution(ctx _context.Context, start
localVarQueryParams := _neturl.Values{}
localVarFormParams := _neturl.Values{}
localVarQueryParams.Add("start_month", datadog.ParameterToString(startMonth, ""))
localVarQueryParams.Add("end_month", datadog.ParameterToString(endMonth, ""))
localVarQueryParams.Add("fields", datadog.ParameterToString(fields, ""))
if optionalParams.EndMonth != nil {
localVarQueryParams.Add("end_month", datadog.ParameterToString(*optionalParams.EndMonth, ""))
}
if optionalParams.SortDirection != nil {
localVarQueryParams.Add("sort_direction", datadog.ParameterToString(*optionalParams.SortDirection, ""))
}
Expand Down
2 changes: 1 addition & 1 deletion examples/v2/usage-metering/GetMonthlyCostAttribution.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func main() {
configuration.SetUnstableOperationEnabled("v2.GetMonthlyCostAttribution", true)
apiClient := datadog.NewAPIClient(configuration)
api := datadogV2.NewUsageMeteringApi(apiClient)
resp, r, err := api.GetMonthlyCostAttribution(ctx, time.Now().AddDate(0, 0, -5), "infra_host_total_cost", *datadogV2.NewGetMonthlyCostAttributionOptionalParameters().WithEndMonth(time.Now().AddDate(0, 0, -3)))
resp, r, err := api.GetMonthlyCostAttribution(ctx, time.Now().AddDate(0, 0, -5), time.Now().AddDate(0, 0, -3), "infra_host_total_cost", *datadogV2.NewGetMonthlyCostAttributionOptionalParameters())

if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `UsageMeteringApi.GetMonthlyCostAttribution`: %v\n", err)
Expand Down
4 changes: 2 additions & 2 deletions tests/scenarios/features/v2/usage_metering.feature
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ Feature: Usage Metering
Given operation "GetMonthlyCostAttribution" enabled
And new "GetMonthlyCostAttribution" request
And request contains "start_month" parameter with value "{{ timeISO('now - 5d') }}"
And request contains "fields" parameter with value "not_a_product"
And request contains "end_month" parameter with value "{{ timeISO('now - 3d') }}"
And request contains "fields" parameter with value "not_a_product"
When the request is sent
Then the response status is 400 Bad Request

Expand All @@ -29,8 +29,8 @@ Feature: Usage Metering
Given operation "GetMonthlyCostAttribution" enabled
And new "GetMonthlyCostAttribution" request
And request contains "start_month" parameter with value "{{ timeISO('now - 5d') }}"
And request contains "fields" parameter with value "infra_host_total_cost"
And request contains "end_month" parameter with value "{{ timeISO('now - 3d') }}"
And request contains "fields" parameter with value "infra_host_total_cost"
When the request is sent
Then the response status is 200 OK

Expand Down

0 comments on commit 9a87fd7

Please sign in to comment.