From a87af8524103573ef377bc2101fe5170c945428f Mon Sep 17 00:00:00 2001 From: "api-clients-generation-pipeline[bot]" <54105614+api-clients-generation-pipeline[bot]@users.noreply.github.com> Date: Fri, 17 Nov 2023 20:01:29 +0000 Subject: [PATCH] Fix Powerpack schema (#2262) Co-authored-by: ci.datadog-api-spec --- .apigentools-info | 8 +-- .generator/schemas/v2/openapi.yaml | 3 +- .../model_powerpack_relationships.go | 16 +++--- ...del_powerpacks_response_meta_pagination.go | 49 ++++++++++++------- 4 files changed, 44 insertions(+), 32 deletions(-) diff --git a/.apigentools-info b/.apigentools-info index 454b91775e2..f9d61fac733 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.6", - "regenerated": "2023-11-17 18:38:51.988816", - "spec_repo_commit": "ea610108" + "regenerated": "2023-11-17 19:36:44.377368", + "spec_repo_commit": "506ed2d8" }, "v2": { "apigentools_version": "1.6.6", - "regenerated": "2023-11-17 18:38:52.010141", - "spec_repo_commit": "ea610108" + "regenerated": "2023-11-17 19:36:44.393021", + "spec_repo_commit": "506ed2d8" } } } \ No newline at end of file diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 6c9b5a922f3..8b8e69b310f 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -12084,7 +12084,7 @@ components: description: Powerpack relationship object. properties: author: - $ref: '#/components/schemas/Creator' + $ref: '#/components/schemas/RelationshipToUser' type: object PowerpackResponse: description: Response object which includes a single powerpack configuration. @@ -12156,6 +12156,7 @@ components: last_offset: description: The last offset. format: int64 + nullable: true type: integer limit: description: Pagination limit. diff --git a/api/datadogV2/model_powerpack_relationships.go b/api/datadogV2/model_powerpack_relationships.go index 4fc992c08ad..7d86c2a90ce 100644 --- a/api/datadogV2/model_powerpack_relationships.go +++ b/api/datadogV2/model_powerpack_relationships.go @@ -10,8 +10,8 @@ import ( // PowerpackRelationships Powerpack relationship object. type PowerpackRelationships struct { - // Creator of the object. - Author *Creator `json:"author,omitempty"` + // Relationship to user. + Author *RelationshipToUser `json:"author,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{} @@ -35,9 +35,9 @@ func NewPowerpackRelationshipsWithDefaults() *PowerpackRelationships { } // GetAuthor returns the Author field value if set, zero value otherwise. -func (o *PowerpackRelationships) GetAuthor() Creator { +func (o *PowerpackRelationships) GetAuthor() RelationshipToUser { if o == nil || o.Author == nil { - var ret Creator + var ret RelationshipToUser return ret } return *o.Author @@ -45,7 +45,7 @@ func (o *PowerpackRelationships) GetAuthor() Creator { // GetAuthorOk returns a tuple with the Author field value if set, nil otherwise // and a boolean to check if the value has been set. -func (o *PowerpackRelationships) GetAuthorOk() (*Creator, bool) { +func (o *PowerpackRelationships) GetAuthorOk() (*RelationshipToUser, bool) { if o == nil || o.Author == nil { return nil, false } @@ -57,8 +57,8 @@ func (o *PowerpackRelationships) HasAuthor() bool { return o != nil && o.Author != nil } -// SetAuthor gets a reference to the given Creator and assigns it to the Author field. -func (o *PowerpackRelationships) SetAuthor(v Creator) { +// SetAuthor gets a reference to the given RelationshipToUser and assigns it to the Author field. +func (o *PowerpackRelationships) SetAuthor(v RelationshipToUser) { o.Author = &v } @@ -81,7 +81,7 @@ func (o PowerpackRelationships) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *PowerpackRelationships) UnmarshalJSON(bytes []byte) (err error) { all := struct { - Author *Creator `json:"author,omitempty"` + Author *RelationshipToUser `json:"author,omitempty"` }{} if err = datadog.Unmarshal(bytes, &all); err != nil { return datadog.Unmarshal(bytes, &o.UnparsedObject) diff --git a/api/datadogV2/model_powerpacks_response_meta_pagination.go b/api/datadogV2/model_powerpacks_response_meta_pagination.go index ca8be4c8b2c..14edef72780 100644 --- a/api/datadogV2/model_powerpacks_response_meta_pagination.go +++ b/api/datadogV2/model_powerpacks_response_meta_pagination.go @@ -13,7 +13,7 @@ type PowerpacksResponseMetaPagination struct { // The first offset. FirstOffset *int64 `json:"first_offset,omitempty"` // The last offset. - LastOffset *int64 `json:"last_offset,omitempty"` + LastOffset datadog.NullableInt64 `json:"last_offset,omitempty"` // Pagination limit. Limit *int64 `json:"limit,omitempty"` // The next offset. @@ -76,32 +76,43 @@ func (o *PowerpacksResponseMetaPagination) SetFirstOffset(v int64) { o.FirstOffset = &v } -// GetLastOffset returns the LastOffset field value if set, zero value otherwise. +// GetLastOffset returns the LastOffset field value if set, zero value otherwise (both if not set or set to explicit null). func (o *PowerpacksResponseMetaPagination) GetLastOffset() int64 { - if o == nil || o.LastOffset == nil { + if o == nil || o.LastOffset.Get() == nil { var ret int64 return ret } - return *o.LastOffset + return *o.LastOffset.Get() } // GetLastOffsetOk returns a tuple with the LastOffset field value if set, nil otherwise // and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned. func (o *PowerpacksResponseMetaPagination) GetLastOffsetOk() (*int64, bool) { - if o == nil || o.LastOffset == nil { + if o == nil { return nil, false } - return o.LastOffset, true + return o.LastOffset.Get(), o.LastOffset.IsSet() } // HasLastOffset returns a boolean if a field has been set. func (o *PowerpacksResponseMetaPagination) HasLastOffset() bool { - return o != nil && o.LastOffset != nil + return o != nil && o.LastOffset.IsSet() } -// SetLastOffset gets a reference to the given int64 and assigns it to the LastOffset field. +// SetLastOffset gets a reference to the given datadog.NullableInt64 and assigns it to the LastOffset field. func (o *PowerpacksResponseMetaPagination) SetLastOffset(v int64) { - o.LastOffset = &v + o.LastOffset.Set(&v) +} + +// SetLastOffsetNil sets the value for LastOffset to be an explicit nil. +func (o *PowerpacksResponseMetaPagination) SetLastOffsetNil() { + o.LastOffset.Set(nil) +} + +// UnsetLastOffset ensures that no value is present for LastOffset, not even an explicit nil. +func (o *PowerpacksResponseMetaPagination) UnsetLastOffset() { + o.LastOffset.Unset() } // GetLimit returns the Limit field value if set, zero value otherwise. @@ -281,8 +292,8 @@ func (o PowerpacksResponseMetaPagination) MarshalJSON() ([]byte, error) { if o.FirstOffset != nil { toSerialize["first_offset"] = o.FirstOffset } - if o.LastOffset != nil { - toSerialize["last_offset"] = o.LastOffset + if o.LastOffset.IsSet() { + toSerialize["last_offset"] = o.LastOffset.Get() } if o.Limit != nil { toSerialize["limit"] = o.Limit @@ -312,14 +323,14 @@ func (o PowerpacksResponseMetaPagination) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *PowerpacksResponseMetaPagination) UnmarshalJSON(bytes []byte) (err error) { all := struct { - FirstOffset *int64 `json:"first_offset,omitempty"` - LastOffset *int64 `json:"last_offset,omitempty"` - Limit *int64 `json:"limit,omitempty"` - NextOffset *int64 `json:"next_offset,omitempty"` - Offset *int64 `json:"offset,omitempty"` - PrevOffset *int64 `json:"prev_offset,omitempty"` - Total *int64 `json:"total,omitempty"` - Type *string `json:"type,omitempty"` + FirstOffset *int64 `json:"first_offset,omitempty"` + LastOffset datadog.NullableInt64 `json:"last_offset,omitempty"` + Limit *int64 `json:"limit,omitempty"` + NextOffset *int64 `json:"next_offset,omitempty"` + Offset *int64 `json:"offset,omitempty"` + PrevOffset *int64 `json:"prev_offset,omitempty"` + Total *int64 `json:"total,omitempty"` + Type *string `json:"type,omitempty"` }{} if err = datadog.Unmarshal(bytes, &all); err != nil { return datadog.Unmarshal(bytes, &o.UnparsedObject)