Skip to content

Commit

Permalink
Regenerate client from commit b2126cb8 of spec repo
Browse files Browse the repository at this point in the history
  • Loading branch information
ci.datadog-api-spec committed Jun 14, 2024
1 parent c292550 commit f26dd6c
Show file tree
Hide file tree
Showing 4 changed files with 158 additions and 41 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-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"
}
}
}
6 changes: 6 additions & 0 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
83 changes: 46 additions & 37 deletions api/datadogV2/model_list_ap_is_response_data.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{}
Expand All @@ -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 {
Expand Down Expand Up @@ -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
Expand All @@ -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
}
102 changes: 102 additions & 0 deletions api/datadogV2/model_list_ap_is_response_data_attributes.go
Original file line number Diff line number Diff line change
@@ -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
}

0 comments on commit f26dd6c

Please sign in to comment.