Skip to content

Commit

Permalink
Regenerate client from commit 7b7ec49c of spec repo
Browse files Browse the repository at this point in the history
  • Loading branch information
ci.datadog-api-spec committed Dec 20, 2024
1 parent 2a26be6 commit 282e155
Show file tree
Hide file tree
Showing 4 changed files with 283 additions and 8 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-12-19 07:26:27.191303",
"spec_repo_commit": "5dd2cbe4"
"regenerated": "2024-12-20 20:08:09.571387",
"spec_repo_commit": "7b7ec49c"
},
"v2": {
"apigentools_version": "1.6.6",
"regenerated": "2024-12-19 07:26:27.207255",
"spec_repo_commit": "5dd2cbe4"
"regenerated": "2024-12-20 20:08:09.586595",
"spec_repo_commit": "7b7ec49c"
}
}
}
24 changes: 24 additions & 0 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14770,6 +14770,12 @@ components:
the error.
example: Missing required attribute in body
type: string
meta:
additionalProperties: {}
description: Non-standard meta-information about the error
type: object
source:
$ref: '#/components/schemas/JSONAPIErrorItemSource'
status:
description: Status code of the response.
example: '400'
Expand All @@ -14779,6 +14785,24 @@ components:
example: Bad Request
type: string
type: object
JSONAPIErrorItemSource:
description: References to the source of the error.
properties:
header:
description: a string indicating the name of a single request header which
caused the error.
example: Authorization
type: string
parameter:
description: A string indicating which URI query parameter caused the error.
example: limit
type: string
pointer:
description: A JSON Pointer to the value in the request document that caused
the error.
example: /data/attributes/title
type: string
type: object
JSONAPIErrorResponse:
description: API error response.
properties:
Expand Down
87 changes: 83 additions & 4 deletions api/datadogV2/model_jsonapi_error_item.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ import (
type JSONAPIErrorItem struct {
// A human-readable explanation specific to this occurrence of the error.
Detail *string `json:"detail,omitempty"`
// Non-standard meta-information about the error
Meta map[string]interface{} `json:"meta,omitempty"`
// References to the source of the error.
Source *JSONAPIErrorItemSource `json:"source,omitempty"`
// Status code of the response.
Status *string `json:"status,omitempty"`
// Short human-readable summary of the error.
Expand Down Expand Up @@ -66,6 +70,62 @@ func (o *JSONAPIErrorItem) SetDetail(v string) {
o.Detail = &v
}

// GetMeta returns the Meta field value if set, zero value otherwise.
func (o *JSONAPIErrorItem) GetMeta() map[string]interface{} {
if o == nil || o.Meta == nil {
var ret map[string]interface{}
return ret
}
return o.Meta
}

// GetMetaOk returns a tuple with the Meta field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *JSONAPIErrorItem) GetMetaOk() (*map[string]interface{}, bool) {
if o == nil || o.Meta == nil {
return nil, false
}
return &o.Meta, true
}

// HasMeta returns a boolean if a field has been set.
func (o *JSONAPIErrorItem) HasMeta() bool {
return o != nil && o.Meta != nil
}

// SetMeta gets a reference to the given map[string]interface{} and assigns it to the Meta field.
func (o *JSONAPIErrorItem) SetMeta(v map[string]interface{}) {
o.Meta = v
}

// GetSource returns the Source field value if set, zero value otherwise.
func (o *JSONAPIErrorItem) GetSource() JSONAPIErrorItemSource {
if o == nil || o.Source == nil {
var ret JSONAPIErrorItemSource
return ret
}
return *o.Source
}

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

// HasSource returns a boolean if a field has been set.
func (o *JSONAPIErrorItem) HasSource() bool {
return o != nil && o.Source != nil
}

// SetSource gets a reference to the given JSONAPIErrorItemSource and assigns it to the Source field.
func (o *JSONAPIErrorItem) SetSource(v JSONAPIErrorItemSource) {
o.Source = &v
}

// GetStatus returns the Status field value if set, zero value otherwise.
func (o *JSONAPIErrorItem) GetStatus() string {
if o == nil || o.Status == nil {
Expand Down Expand Up @@ -131,6 +191,12 @@ func (o JSONAPIErrorItem) MarshalJSON() ([]byte, error) {
if o.Detail != nil {
toSerialize["detail"] = o.Detail
}
if o.Meta != nil {
toSerialize["meta"] = o.Meta
}
if o.Source != nil {
toSerialize["source"] = o.Source
}
if o.Status != nil {
toSerialize["status"] = o.Status
}
Expand All @@ -147,26 +213,39 @@ func (o JSONAPIErrorItem) MarshalJSON() ([]byte, error) {
// UnmarshalJSON deserializes the given payload.
func (o *JSONAPIErrorItem) UnmarshalJSON(bytes []byte) (err error) {
all := struct {
Detail *string `json:"detail,omitempty"`
Status *string `json:"status,omitempty"`
Title *string `json:"title,omitempty"`
Detail *string `json:"detail,omitempty"`
Meta map[string]interface{} `json:"meta,omitempty"`
Source *JSONAPIErrorItemSource `json:"source,omitempty"`
Status *string `json:"status,omitempty"`
Title *string `json:"title,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{"detail", "status", "title"})
datadog.DeleteKeys(additionalProperties, &[]string{"detail", "meta", "source", "status", "title"})
} else {
return err
}

hasInvalidField := false
o.Detail = all.Detail
o.Meta = all.Meta
if all.Source != nil && all.Source.UnparsedObject != nil && o.UnparsedObject == nil {
hasInvalidField = true
}
o.Source = all.Source
o.Status = all.Status
o.Title = all.Title

if len(additionalProperties) > 0 {
o.AdditionalProperties = additionalProperties
}

if hasInvalidField {
return datadog.Unmarshal(bytes, &o.UnparsedObject)
}

return nil
}
172 changes: 172 additions & 0 deletions api/datadogV2/model_jsonapi_error_item_source.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,172 @@
// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
// This product includes software developed at Datadog (https://www.datadoghq.com/).
// Copyright 2019-Present Datadog, Inc.

package datadogV2

import (
"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
)

// JSONAPIErrorItemSource References to the source of the error.
type JSONAPIErrorItemSource struct {
// a string indicating the name of a single request header which caused the error.
Header *string `json:"header,omitempty"`
// A string indicating which URI query parameter caused the error.
Parameter *string `json:"parameter,omitempty"`
// A JSON Pointer to the value in the request document that caused the error.
Pointer *string `json:"pointer,omitempty"`
// UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct
UnparsedObject map[string]interface{} `json:"-"`
AdditionalProperties map[string]interface{} `json:"-"`
}

// NewJSONAPIErrorItemSource instantiates a new JSONAPIErrorItemSource object.
// This constructor will assign default values to properties that have it defined,
// and makes sure properties required by API are set, but the set of arguments
// will change when the set of required properties is changed.
func NewJSONAPIErrorItemSource() *JSONAPIErrorItemSource {
this := JSONAPIErrorItemSource{}
return &this
}

// NewJSONAPIErrorItemSourceWithDefaults instantiates a new JSONAPIErrorItemSource object.
// This constructor will only assign default values to properties that have it defined,
// but it doesn't guarantee that properties required by API are set.
func NewJSONAPIErrorItemSourceWithDefaults() *JSONAPIErrorItemSource {
this := JSONAPIErrorItemSource{}
return &this
}

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

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

// HasHeader returns a boolean if a field has been set.
func (o *JSONAPIErrorItemSource) HasHeader() bool {
return o != nil && o.Header != nil
}

// SetHeader gets a reference to the given string and assigns it to the Header field.
func (o *JSONAPIErrorItemSource) SetHeader(v string) {
o.Header = &v
}

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

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

// HasParameter returns a boolean if a field has been set.
func (o *JSONAPIErrorItemSource) HasParameter() bool {
return o != nil && o.Parameter != nil
}

// SetParameter gets a reference to the given string and assigns it to the Parameter field.
func (o *JSONAPIErrorItemSource) SetParameter(v string) {
o.Parameter = &v
}

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

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

// HasPointer returns a boolean if a field has been set.
func (o *JSONAPIErrorItemSource) HasPointer() bool {
return o != nil && o.Pointer != nil
}

// SetPointer gets a reference to the given string and assigns it to the Pointer field.
func (o *JSONAPIErrorItemSource) SetPointer(v string) {
o.Pointer = &v
}

// MarshalJSON serializes the struct using spec logic.
func (o JSONAPIErrorItemSource) MarshalJSON() ([]byte, error) {
toSerialize := map[string]interface{}{}
if o.UnparsedObject != nil {
return datadog.Marshal(o.UnparsedObject)
}
if o.Header != nil {
toSerialize["header"] = o.Header
}
if o.Parameter != nil {
toSerialize["parameter"] = o.Parameter
}
if o.Pointer != nil {
toSerialize["pointer"] = o.Pointer
}

for key, value := range o.AdditionalProperties {
toSerialize[key] = value
}
return datadog.Marshal(toSerialize)
}

// UnmarshalJSON deserializes the given payload.
func (o *JSONAPIErrorItemSource) UnmarshalJSON(bytes []byte) (err error) {
all := struct {
Header *string `json:"header,omitempty"`
Parameter *string `json:"parameter,omitempty"`
Pointer *string `json:"pointer,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{"header", "parameter", "pointer"})
} else {
return err
}
o.Header = all.Header
o.Parameter = all.Parameter
o.Pointer = all.Pointer

if len(additionalProperties) > 0 {
o.AdditionalProperties = additionalProperties
}

return nil
}

0 comments on commit 282e155

Please sign in to comment.