Skip to content

Commit 2ad4eb4

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Fix Org Groups pagination response shape (DataDog#4023)
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
1 parent 088aaa4 commit 2ad4eb4

8 files changed

Lines changed: 875 additions & 72 deletions

.generator/schemas/v2/openapi.yaml

Lines changed: 120 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -52255,6 +52255,8 @@ components:
5225552255
items:
5225652256
$ref: "#/components/schemas/OrgGroupMembershipData"
5225752257
type: array
52258+
links:
52259+
$ref: "#/components/schemas/OrgGroupPaginationLinks"
5225852260
meta:
5225952261
$ref: "#/components/schemas/OrgGroupPaginationMeta"
5226052262
required:
@@ -52372,6 +52374,8 @@ components:
5237252374
items:
5237352375
$ref: "#/components/schemas/OrgGroupMembershipData"
5237452376
type: array
52377+
links:
52378+
$ref: "#/components/schemas/OrgGroupPaginationLinks"
5237552379
meta:
5237652380
$ref: "#/components/schemas/OrgGroupPaginationMeta"
5237752381
required:
@@ -52472,24 +52476,71 @@ components:
5247252476
required:
5247352477
- data
5247452478
type: object
52479+
OrgGroupPaginationLinks:
52480+
description: Pagination links for navigating between pages of an org group list response.
52481+
properties:
52482+
first:
52483+
description: Link to the first page.
52484+
type: string
52485+
last:
52486+
description: Link to the last page.
52487+
type: string
52488+
next:
52489+
description: Link to the next page.
52490+
nullable: true
52491+
type: string
52492+
prev:
52493+
description: Link to the previous page.
52494+
nullable: true
52495+
type: string
52496+
self:
52497+
description: Link to the current page.
52498+
type: string
52499+
type: object
5247552500
OrgGroupPaginationMeta:
52476-
description: Pagination metadata.
52501+
description: Pagination metadata for org group list responses.
5247752502
properties:
5247852503
page:
5247952504
$ref: "#/components/schemas/OrgGroupPaginationMetaPage"
52480-
required:
52481-
- page
5248252505
type: object
5248352506
OrgGroupPaginationMetaPage:
52484-
description: Page-based pagination details.
52507+
description: Page-based pagination details for org group list responses.
5248552508
properties:
52486-
total_count:
52487-
description: The total number of items.
52488-
example: 42
52509+
first_number:
52510+
description: First page number.
5248952511
format: int64
5249052512
type: integer
52491-
required:
52492-
- total_count
52513+
last_number:
52514+
description: Last page number.
52515+
format: int64
52516+
nullable: true
52517+
type: integer
52518+
next_number:
52519+
description: Next page number.
52520+
format: int64
52521+
nullable: true
52522+
type: integer
52523+
number:
52524+
description: Page number.
52525+
format: int64
52526+
type: integer
52527+
prev_number:
52528+
description: Previous page number.
52529+
format: int64
52530+
nullable: true
52531+
type: integer
52532+
size:
52533+
description: Page size.
52534+
format: int64
52535+
type: integer
52536+
total:
52537+
description: Total number of results.
52538+
format: int64
52539+
type: integer
52540+
type:
52541+
description: Pagination type.
52542+
example: "number_size"
52543+
type: string
5249352544
type: object
5249452545
OrgGroupPolicyAttributes:
5249552546
description: Attributes of an org group policy.
@@ -52679,6 +52730,8 @@ components:
5267952730
items:
5268052731
$ref: "#/components/schemas/OrgGroupPolicyData"
5268152732
type: array
52733+
links:
52734+
$ref: "#/components/schemas/OrgGroupPaginationLinks"
5268252735
meta:
5268352736
$ref: "#/components/schemas/OrgGroupPaginationMeta"
5268452737
required:
@@ -52792,6 +52845,8 @@ components:
5279252845
items:
5279352846
$ref: "#/components/schemas/OrgGroupPolicyOverrideData"
5279452847
type: array
52848+
links:
52849+
$ref: "#/components/schemas/OrgGroupPaginationLinks"
5279552850
meta:
5279652851
$ref: "#/components/schemas/OrgGroupPaginationMeta"
5279752852
required:
@@ -111991,9 +112046,22 @@ paths:
111991112046
id: "a1b2c3d4-e5f6-7890-abcd-ef0123456789"
111992112047
type: org_groups
111993112048
type: org_group_memberships
112049+
links:
112050+
first: "https://api.datadoghq.com/api/v2/org_group_memberships?filter%5Borg_group_id%5D=a1b2c3d4-e5f6-7890-abcd-ef0123456789&page%5Bnumber%5D=0&page%5Bsize%5D=50"
112051+
last: "https://api.datadoghq.com/api/v2/org_group_memberships?filter%5Borg_group_id%5D=a1b2c3d4-e5f6-7890-abcd-ef0123456789&page%5Bnumber%5D=0&page%5Bsize%5D=50"
112052+
next:
112053+
prev:
112054+
self: "https://api.datadoghq.com/api/v2/org_group_memberships?filter%5Borg_group_id%5D=a1b2c3d4-e5f6-7890-abcd-ef0123456789&page%5Bnumber%5D=0&page%5Bsize%5D=50"
111994112055
meta:
111995112056
page:
111996-
total_count: 1
112057+
first_number: 0
112058+
last_number: 0
112059+
next_number:
112060+
number: 0
112061+
prev_number:
112062+
size: 50
112063+
total: 1
112064+
type: number_size
111997112065
schema:
111998112066
$ref: "#/components/schemas/OrgGroupMembershipListResponse"
111999112067
description: OK
@@ -112292,9 +112360,22 @@ paths:
112292112360
id: "a1b2c3d4-e5f6-7890-abcd-ef0123456789"
112293112361
type: org_groups
112294112362
type: org_group_policies
112363+
links:
112364+
first: "https://api.datadoghq.com/api/v2/org_group_policies?filter%5Borg_group_id%5D=a1b2c3d4-e5f6-7890-abcd-ef0123456789&page%5Bnumber%5D=0&page%5Bsize%5D=50"
112365+
last: "https://api.datadoghq.com/api/v2/org_group_policies?filter%5Borg_group_id%5D=a1b2c3d4-e5f6-7890-abcd-ef0123456789&page%5Bnumber%5D=0&page%5Bsize%5D=50"
112366+
next:
112367+
prev:
112368+
self: "https://api.datadoghq.com/api/v2/org_group_policies?filter%5Borg_group_id%5D=a1b2c3d4-e5f6-7890-abcd-ef0123456789&page%5Bnumber%5D=0&page%5Bsize%5D=50"
112295112369
meta:
112296112370
page:
112297-
total_count: 1
112371+
first_number: 0
112372+
last_number: 0
112373+
next_number:
112374+
number: 0
112375+
prev_number:
112376+
size: 50
112377+
total: 1
112378+
type: number_size
112298112379
schema:
112299112380
$ref: "#/components/schemas/OrgGroupPolicyListResponse"
112300112381
description: OK
@@ -112683,9 +112764,22 @@ paths:
112683112764
id: "1a2b3c4d-5e6f-7890-abcd-ef0123456789"
112684112765
type: org_group_policies
112685112766
type: org_group_policy_overrides
112767+
links:
112768+
first: "https://api.datadoghq.com/api/v2/org_group_policy_overrides?filter%5Borg_group_id%5D=a1b2c3d4-e5f6-7890-abcd-ef0123456789&page%5Bnumber%5D=0&page%5Bsize%5D=50"
112769+
last: "https://api.datadoghq.com/api/v2/org_group_policy_overrides?filter%5Borg_group_id%5D=a1b2c3d4-e5f6-7890-abcd-ef0123456789&page%5Bnumber%5D=0&page%5Bsize%5D=50"
112770+
next:
112771+
prev:
112772+
self: "https://api.datadoghq.com/api/v2/org_group_policy_overrides?filter%5Borg_group_id%5D=a1b2c3d4-e5f6-7890-abcd-ef0123456789&page%5Bnumber%5D=0&page%5Bsize%5D=50"
112686112773
meta:
112687112774
page:
112688-
total_count: 1
112775+
first_number: 0
112776+
last_number: 0
112777+
next_number:
112778+
number: 0
112779+
prev_number:
112780+
size: 50
112781+
total: 1
112782+
type: number_size
112689112783
schema:
112690112784
$ref: "#/components/schemas/OrgGroupPolicyOverrideListResponse"
112691112785
description: OK
@@ -113024,9 +113118,22 @@ paths:
113024113118
owner_org_uuid: "b2c3d4e5-f6a7-8901-bcde-f01234567890"
113025113119
id: "a1b2c3d4-e5f6-7890-abcd-ef0123456789"
113026113120
type: org_groups
113121+
links:
113122+
first: "https://api.datadoghq.com/api/v2/org_groups?page%5Bnumber%5D=0&page%5Bsize%5D=50"
113123+
last: "https://api.datadoghq.com/api/v2/org_groups?page%5Bnumber%5D=0&page%5Bsize%5D=50"
113124+
next:
113125+
prev:
113126+
self: "https://api.datadoghq.com/api/v2/org_groups?page%5Bnumber%5D=0&page%5Bsize%5D=50"
113027113127
meta:
113028113128
page:
113029-
total_count: 1
113129+
first_number: 0
113130+
last_number: 0
113131+
next_number:
113132+
number: 0
113133+
prev_number:
113134+
size: 50
113135+
total: 1
113136+
type: number_size
113030113137
schema:
113031113138
$ref: "#/components/schemas/OrgGroupListResponse"
113032113139
description: OK

api/datadogV2/model_org_group_list_response.go

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ type OrgGroupListResponse struct {
1616
Data []OrgGroupData `json:"data"`
1717
// Related resources included in the response when requested with the `include` parameter.
1818
Included []OrgGroupMembershipData `json:"included,omitempty"`
19-
// Pagination metadata.
19+
// Pagination links for navigating between pages of an org group list response.
20+
Links *OrgGroupPaginationLinks `json:"links,omitempty"`
21+
// Pagination metadata for org group list responses.
2022
Meta *OrgGroupPaginationMeta `json:"meta,omitempty"`
2123
// UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct
2224
UnparsedObject map[string]interface{} `json:"-"`
@@ -92,6 +94,34 @@ func (o *OrgGroupListResponse) SetIncluded(v []OrgGroupMembershipData) {
9294
o.Included = v
9395
}
9496

97+
// GetLinks returns the Links field value if set, zero value otherwise.
98+
func (o *OrgGroupListResponse) GetLinks() OrgGroupPaginationLinks {
99+
if o == nil || o.Links == nil {
100+
var ret OrgGroupPaginationLinks
101+
return ret
102+
}
103+
return *o.Links
104+
}
105+
106+
// GetLinksOk returns a tuple with the Links field value if set, nil otherwise
107+
// and a boolean to check if the value has been set.
108+
func (o *OrgGroupListResponse) GetLinksOk() (*OrgGroupPaginationLinks, bool) {
109+
if o == nil || o.Links == nil {
110+
return nil, false
111+
}
112+
return o.Links, true
113+
}
114+
115+
// HasLinks returns a boolean if a field has been set.
116+
func (o *OrgGroupListResponse) HasLinks() bool {
117+
return o != nil && o.Links != nil
118+
}
119+
120+
// SetLinks gets a reference to the given OrgGroupPaginationLinks and assigns it to the Links field.
121+
func (o *OrgGroupListResponse) SetLinks(v OrgGroupPaginationLinks) {
122+
o.Links = &v
123+
}
124+
95125
// GetMeta returns the Meta field value if set, zero value otherwise.
96126
func (o *OrgGroupListResponse) GetMeta() OrgGroupPaginationMeta {
97127
if o == nil || o.Meta == nil {
@@ -130,6 +160,9 @@ func (o OrgGroupListResponse) MarshalJSON() ([]byte, error) {
130160
if o.Included != nil {
131161
toSerialize["included"] = o.Included
132162
}
163+
if o.Links != nil {
164+
toSerialize["links"] = o.Links
165+
}
133166
if o.Meta != nil {
134167
toSerialize["meta"] = o.Meta
135168
}
@@ -145,6 +178,7 @@ func (o *OrgGroupListResponse) UnmarshalJSON(bytes []byte) (err error) {
145178
all := struct {
146179
Data *[]OrgGroupData `json:"data"`
147180
Included []OrgGroupMembershipData `json:"included,omitempty"`
181+
Links *OrgGroupPaginationLinks `json:"links,omitempty"`
148182
Meta *OrgGroupPaginationMeta `json:"meta,omitempty"`
149183
}{}
150184
if err = datadog.Unmarshal(bytes, &all); err != nil {
@@ -155,14 +189,18 @@ func (o *OrgGroupListResponse) UnmarshalJSON(bytes []byte) (err error) {
155189
}
156190
additionalProperties := make(map[string]interface{})
157191
if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil {
158-
datadog.DeleteKeys(additionalProperties, &[]string{"data", "included", "meta"})
192+
datadog.DeleteKeys(additionalProperties, &[]string{"data", "included", "links", "meta"})
159193
} else {
160194
return err
161195
}
162196

163197
hasInvalidField := false
164198
o.Data = *all.Data
165199
o.Included = all.Included
200+
if all.Links != nil && all.Links.UnparsedObject != nil && o.UnparsedObject == nil {
201+
hasInvalidField = true
202+
}
203+
o.Links = all.Links
166204
if all.Meta != nil && all.Meta.UnparsedObject != nil && o.UnparsedObject == nil {
167205
hasInvalidField = true
168206
}

api/datadogV2/model_org_group_membership_list_response.go

Lines changed: 42 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ import (
1414
type OrgGroupMembershipListResponse struct {
1515
// An array of org group memberships.
1616
Data []OrgGroupMembershipData `json:"data"`
17-
// Pagination metadata.
17+
// Pagination links for navigating between pages of an org group list response.
18+
Links *OrgGroupPaginationLinks `json:"links,omitempty"`
19+
// Pagination metadata for org group list responses.
1820
Meta *OrgGroupPaginationMeta `json:"meta,omitempty"`
1921
// UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct
2022
UnparsedObject map[string]interface{} `json:"-"`
@@ -62,6 +64,34 @@ func (o *OrgGroupMembershipListResponse) SetData(v []OrgGroupMembershipData) {
6264
o.Data = v
6365
}
6466

67+
// GetLinks returns the Links field value if set, zero value otherwise.
68+
func (o *OrgGroupMembershipListResponse) GetLinks() OrgGroupPaginationLinks {
69+
if o == nil || o.Links == nil {
70+
var ret OrgGroupPaginationLinks
71+
return ret
72+
}
73+
return *o.Links
74+
}
75+
76+
// GetLinksOk returns a tuple with the Links field value if set, nil otherwise
77+
// and a boolean to check if the value has been set.
78+
func (o *OrgGroupMembershipListResponse) GetLinksOk() (*OrgGroupPaginationLinks, bool) {
79+
if o == nil || o.Links == nil {
80+
return nil, false
81+
}
82+
return o.Links, true
83+
}
84+
85+
// HasLinks returns a boolean if a field has been set.
86+
func (o *OrgGroupMembershipListResponse) HasLinks() bool {
87+
return o != nil && o.Links != nil
88+
}
89+
90+
// SetLinks gets a reference to the given OrgGroupPaginationLinks and assigns it to the Links field.
91+
func (o *OrgGroupMembershipListResponse) SetLinks(v OrgGroupPaginationLinks) {
92+
o.Links = &v
93+
}
94+
6595
// GetMeta returns the Meta field value if set, zero value otherwise.
6696
func (o *OrgGroupMembershipListResponse) GetMeta() OrgGroupPaginationMeta {
6797
if o == nil || o.Meta == nil {
@@ -97,6 +127,9 @@ func (o OrgGroupMembershipListResponse) MarshalJSON() ([]byte, error) {
97127
return datadog.Marshal(o.UnparsedObject)
98128
}
99129
toSerialize["data"] = o.Data
130+
if o.Links != nil {
131+
toSerialize["links"] = o.Links
132+
}
100133
if o.Meta != nil {
101134
toSerialize["meta"] = o.Meta
102135
}
@@ -110,8 +143,9 @@ func (o OrgGroupMembershipListResponse) MarshalJSON() ([]byte, error) {
110143
// UnmarshalJSON deserializes the given payload.
111144
func (o *OrgGroupMembershipListResponse) UnmarshalJSON(bytes []byte) (err error) {
112145
all := struct {
113-
Data *[]OrgGroupMembershipData `json:"data"`
114-
Meta *OrgGroupPaginationMeta `json:"meta,omitempty"`
146+
Data *[]OrgGroupMembershipData `json:"data"`
147+
Links *OrgGroupPaginationLinks `json:"links,omitempty"`
148+
Meta *OrgGroupPaginationMeta `json:"meta,omitempty"`
115149
}{}
116150
if err = datadog.Unmarshal(bytes, &all); err != nil {
117151
return datadog.Unmarshal(bytes, &o.UnparsedObject)
@@ -121,13 +155,17 @@ func (o *OrgGroupMembershipListResponse) UnmarshalJSON(bytes []byte) (err error)
121155
}
122156
additionalProperties := make(map[string]interface{})
123157
if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil {
124-
datadog.DeleteKeys(additionalProperties, &[]string{"data", "meta"})
158+
datadog.DeleteKeys(additionalProperties, &[]string{"data", "links", "meta"})
125159
} else {
126160
return err
127161
}
128162

129163
hasInvalidField := false
130164
o.Data = *all.Data
165+
if all.Links != nil && all.Links.UnparsedObject != nil && o.UnparsedObject == nil {
166+
hasInvalidField = true
167+
}
168+
o.Links = all.Links
131169
if all.Meta != nil && all.Meta.UnparsedObject != nil && o.UnparsedObject == nil {
132170
hasInvalidField = true
133171
}

0 commit comments

Comments
 (0)