diff --git a/.apigentools-info b/.apigentools-info index afed1fbeae4..c92371b66f1 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.6", - "regenerated": "2024-06-13 08:10:10.481512", - "spec_repo_commit": "eb5da65e" + "regenerated": "2024-06-14 08:39:18.736041", + "spec_repo_commit": "b2126cb8" }, "v2": { "apigentools_version": "1.6.6", - "regenerated": "2024-06-13 08:10:10.499687", - "spec_repo_commit": "eb5da65e" + "regenerated": "2024-06-14 08:39:18.753862", + "spec_repo_commit": "b2126cb8" } } } \ No newline at end of file diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index b0fef5c9fe2..7d45c6982de 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -10568,8 +10568,14 @@ components: ListAPIsResponseData: description: Data envelope for `ListAPIsResponse`. properties: + attributes: + $ref: '#/components/schemas/ListAPIsResponseDataAttributes' id: $ref: '#/components/schemas/ApiID' + type: object + ListAPIsResponseDataAttributes: + description: Attributes for `ListAPIsResponseData`. + properties: name: description: API name. example: Payments API diff --git a/api/datadogV2/model_list_ap_is_response_data.go b/api/datadogV2/model_list_ap_is_response_data.go index b06e0373ba2..752dc5e8857 100644 --- a/api/datadogV2/model_list_ap_is_response_data.go +++ b/api/datadogV2/model_list_ap_is_response_data.go @@ -12,10 +12,10 @@ import ( // ListAPIsResponseData Data envelope for `ListAPIsResponse`. type ListAPIsResponseData struct { + // Attributes for `ListAPIsResponseData`. + Attributes *ListAPIsResponseDataAttributes `json:"attributes,omitempty"` // API identifier. Id *uuid.UUID `json:"id,omitempty"` - // API name. - Name *string `json:"name,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{} @@ -38,6 +38,34 @@ func NewListAPIsResponseDataWithDefaults() *ListAPIsResponseData { return &this } +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *ListAPIsResponseData) GetAttributes() ListAPIsResponseDataAttributes { + if o == nil || o.Attributes == nil { + var ret ListAPIsResponseDataAttributes + return ret + } + return *o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ListAPIsResponseData) GetAttributesOk() (*ListAPIsResponseDataAttributes, bool) { + if o == nil || o.Attributes == nil { + return nil, false + } + return o.Attributes, true +} + +// HasAttributes returns a boolean if a field has been set. +func (o *ListAPIsResponseData) HasAttributes() bool { + return o != nil && o.Attributes != nil +} + +// SetAttributes gets a reference to the given ListAPIsResponseDataAttributes and assigns it to the Attributes field. +func (o *ListAPIsResponseData) SetAttributes(v ListAPIsResponseDataAttributes) { + o.Attributes = &v +} + // GetId returns the Id field value if set, zero value otherwise. func (o *ListAPIsResponseData) GetId() uuid.UUID { if o == nil || o.Id == nil { @@ -66,46 +94,18 @@ func (o *ListAPIsResponseData) SetId(v uuid.UUID) { o.Id = &v } -// GetName returns the Name field value if set, zero value otherwise. -func (o *ListAPIsResponseData) GetName() string { - if o == nil || o.Name == nil { - var ret string - return ret - } - return *o.Name -} - -// GetNameOk returns a tuple with the Name field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ListAPIsResponseData) GetNameOk() (*string, bool) { - if o == nil || o.Name == nil { - return nil, false - } - return o.Name, true -} - -// HasName returns a boolean if a field has been set. -func (o *ListAPIsResponseData) HasName() bool { - return o != nil && o.Name != nil -} - -// SetName gets a reference to the given string and assigns it to the Name field. -func (o *ListAPIsResponseData) SetName(v string) { - o.Name = &v -} - // MarshalJSON serializes the struct using spec logic. func (o ListAPIsResponseData) MarshalJSON() ([]byte, error) { toSerialize := map[string]interface{}{} if o.UnparsedObject != nil { return datadog.Marshal(o.UnparsedObject) } + if o.Attributes != nil { + toSerialize["attributes"] = o.Attributes + } if o.Id != nil { toSerialize["id"] = o.Id } - if o.Name != nil { - toSerialize["name"] = o.Name - } for key, value := range o.AdditionalProperties { toSerialize[key] = value @@ -116,24 +116,33 @@ func (o ListAPIsResponseData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ListAPIsResponseData) UnmarshalJSON(bytes []byte) (err error) { all := struct { - Id *uuid.UUID `json:"id,omitempty"` - Name *string `json:"name,omitempty"` + Attributes *ListAPIsResponseDataAttributes `json:"attributes,omitempty"` + Id *uuid.UUID `json:"id,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{"id", "name"}) + datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "id"}) } else { return err } + + hasInvalidField := false + if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Attributes = all.Attributes o.Id = all.Id - o.Name = all.Name if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/api/datadogV2/model_list_ap_is_response_data_attributes.go b/api/datadogV2/model_list_ap_is_response_data_attributes.go new file mode 100644 index 00000000000..75c6535086b --- /dev/null +++ b/api/datadogV2/model_list_ap_is_response_data_attributes.go @@ -0,0 +1,102 @@ +// 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" +) + +// ListAPIsResponseDataAttributes Attributes for `ListAPIsResponseData`. +type ListAPIsResponseDataAttributes struct { + // API name. + Name *string `json:"name,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{} +} + +// NewListAPIsResponseDataAttributes instantiates a new ListAPIsResponseDataAttributes 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 NewListAPIsResponseDataAttributes() *ListAPIsResponseDataAttributes { + this := ListAPIsResponseDataAttributes{} + return &this +} + +// NewListAPIsResponseDataAttributesWithDefaults instantiates a new ListAPIsResponseDataAttributes 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 NewListAPIsResponseDataAttributesWithDefaults() *ListAPIsResponseDataAttributes { + this := ListAPIsResponseDataAttributes{} + return &this +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *ListAPIsResponseDataAttributes) GetName() string { + if o == nil || o.Name == nil { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ListAPIsResponseDataAttributes) GetNameOk() (*string, bool) { + if o == nil || o.Name == nil { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *ListAPIsResponseDataAttributes) HasName() bool { + return o != nil && o.Name != nil +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *ListAPIsResponseDataAttributes) SetName(v string) { + o.Name = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o ListAPIsResponseDataAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Name != nil { + toSerialize["name"] = o.Name + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *ListAPIsResponseDataAttributes) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Name *string `json:"name,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{"name"}) + } else { + return err + } + o.Name = all.Name + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +}