Skip to content

Commit 802d694

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Add receives_permissions_from field to Roles API (DataDog#3696)
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
1 parent 4a160f4 commit 802d694

7 files changed

Lines changed: 227 additions & 23 deletions

File tree

.generator/schemas/v2/openapi.yaml

Lines changed: 54 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49931,6 +49931,18 @@ components:
4993149931
description: The name of the role. The name is neither unique nor a stable
4993249932
identifier of the role.
4993349933
type: string
49934+
receives_permissions_from:
49935+
description: 'The managed role from which this role automatically inherits
49936+
new permissions.
49937+
49938+
Specify one of the following: "Datadog Admin Role", "Datadog Standard
49939+
Role", or "Datadog Read Only Role".
49940+
49941+
If empty or not specified, the role does not automatically inherit permissions
49942+
from any managed role.'
49943+
items:
49944+
type: string
49945+
type: array
4993449946
user_count:
4993549947
description: Number of users with that role.
4993649948
format: int64
@@ -49956,6 +49968,18 @@ components:
4995649968
description: Name of the new role that is cloned.
4995749969
example: cloned-role
4995849970
type: string
49971+
receives_permissions_from:
49972+
description: 'The managed role from which this role automatically inherits
49973+
new permissions.
49974+
49975+
Specify one of the following: "Datadog Admin Role", "Datadog Standard
49976+
Role", or "Datadog Read Only Role".
49977+
49978+
If empty or not specified, the role does not automatically inherit permissions
49979+
from any managed role.'
49980+
items:
49981+
type: string
49982+
type: array
4995949983
required:
4996049984
- name
4996149985
type: object
@@ -49984,6 +50008,18 @@ components:
4998450008
description: Name of the role.
4998550009
example: developers
4998650010
type: string
50011+
receives_permissions_from:
50012+
description: 'The managed role from which this role automatically inherits
50013+
new permissions.
50014+
50015+
Specify one of the following: "Datadog Admin Role", "Datadog Standard
50016+
Role", or "Datadog Read Only Role".
50017+
50018+
If empty or not specified, the role does not automatically inherit permissions
50019+
from any managed role.'
50020+
items:
50021+
type: string
50022+
type: array
4998750023
required:
4998850024
- name
4998950025
type: object
@@ -50105,6 +50141,18 @@ components:
5010550141
name:
5010650142
description: Name of the role.
5010750143
type: string
50144+
receives_permissions_from:
50145+
description: 'The managed role from which this role automatically inherits
50146+
new permissions.
50147+
50148+
Specify one of the following: "Datadog Admin Role", "Datadog Standard
50149+
Role", or "Datadog Read Only Role".
50150+
50151+
If empty or not specified, the role does not automatically inherit permissions
50152+
from any managed role.'
50153+
items:
50154+
type: string
50155+
type: array
5010850156
user_count:
5010950157
description: The user count.
5011050158
format: int32
@@ -105571,7 +105619,12 @@ tags:
105571105619

105572105620
read access on a specific log index to a role can be done in Datadog from the
105573105621

105574-
[Pipelines page](https://app.datadoghq.com/logs/pipelines).'
105622+
[Pipelines page](https://app.datadoghq.com/logs/pipelines).
105623+
105624+
105625+
Roles can also be managed in bulk through the Datadog UI, which provides
105626+
105627+
the capability to assign a single permission to multiple roles simultaneously.'
105575105628
name: Roles
105576105629
- description: Auto-generated tag Rum Audience Management
105577105630
name: Rum Audience Management

api/datadogV2/model_role_attributes.go

Lines changed: 42 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ type RoleAttributes struct {
1818
ModifiedAt *time.Time `json:"modified_at,omitempty"`
1919
// The name of the role. The name is neither unique nor a stable identifier of the role.
2020
Name *string `json:"name,omitempty"`
21+
// The managed role from which this role automatically inherits new permissions.
22+
// Specify one of the following: "Datadog Admin Role", "Datadog Standard Role", or "Datadog Read Only Role".
23+
// If empty or not specified, the role does not automatically inherit permissions from any managed role.
24+
ReceivesPermissionsFrom []string `json:"receives_permissions_from,omitempty"`
2125
// Number of users with that role.
2226
UserCount *int64 `json:"user_count,omitempty"`
2327
// UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct
@@ -126,6 +130,34 @@ func (o *RoleAttributes) SetName(v string) {
126130
o.Name = &v
127131
}
128132

133+
// GetReceivesPermissionsFrom returns the ReceivesPermissionsFrom field value if set, zero value otherwise.
134+
func (o *RoleAttributes) GetReceivesPermissionsFrom() []string {
135+
if o == nil || o.ReceivesPermissionsFrom == nil {
136+
var ret []string
137+
return ret
138+
}
139+
return o.ReceivesPermissionsFrom
140+
}
141+
142+
// GetReceivesPermissionsFromOk returns a tuple with the ReceivesPermissionsFrom field value if set, nil otherwise
143+
// and a boolean to check if the value has been set.
144+
func (o *RoleAttributes) GetReceivesPermissionsFromOk() (*[]string, bool) {
145+
if o == nil || o.ReceivesPermissionsFrom == nil {
146+
return nil, false
147+
}
148+
return &o.ReceivesPermissionsFrom, true
149+
}
150+
151+
// HasReceivesPermissionsFrom returns a boolean if a field has been set.
152+
func (o *RoleAttributes) HasReceivesPermissionsFrom() bool {
153+
return o != nil && o.ReceivesPermissionsFrom != nil
154+
}
155+
156+
// SetReceivesPermissionsFrom gets a reference to the given []string and assigns it to the ReceivesPermissionsFrom field.
157+
func (o *RoleAttributes) SetReceivesPermissionsFrom(v []string) {
158+
o.ReceivesPermissionsFrom = v
159+
}
160+
129161
// GetUserCount returns the UserCount field value if set, zero value otherwise.
130162
func (o *RoleAttributes) GetUserCount() int64 {
131163
if o == nil || o.UserCount == nil {
@@ -177,6 +209,9 @@ func (o RoleAttributes) MarshalJSON() ([]byte, error) {
177209
if o.Name != nil {
178210
toSerialize["name"] = o.Name
179211
}
212+
if o.ReceivesPermissionsFrom != nil {
213+
toSerialize["receives_permissions_from"] = o.ReceivesPermissionsFrom
214+
}
180215
if o.UserCount != nil {
181216
toSerialize["user_count"] = o.UserCount
182217
}
@@ -190,23 +225,25 @@ func (o RoleAttributes) MarshalJSON() ([]byte, error) {
190225
// UnmarshalJSON deserializes the given payload.
191226
func (o *RoleAttributes) UnmarshalJSON(bytes []byte) (err error) {
192227
all := struct {
193-
CreatedAt *time.Time `json:"created_at,omitempty"`
194-
ModifiedAt *time.Time `json:"modified_at,omitempty"`
195-
Name *string `json:"name,omitempty"`
196-
UserCount *int64 `json:"user_count,omitempty"`
228+
CreatedAt *time.Time `json:"created_at,omitempty"`
229+
ModifiedAt *time.Time `json:"modified_at,omitempty"`
230+
Name *string `json:"name,omitempty"`
231+
ReceivesPermissionsFrom []string `json:"receives_permissions_from,omitempty"`
232+
UserCount *int64 `json:"user_count,omitempty"`
197233
}{}
198234
if err = datadog.Unmarshal(bytes, &all); err != nil {
199235
return datadog.Unmarshal(bytes, &o.UnparsedObject)
200236
}
201237
additionalProperties := make(map[string]interface{})
202238
if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil {
203-
datadog.DeleteKeys(additionalProperties, &[]string{"created_at", "modified_at", "name", "user_count"})
239+
datadog.DeleteKeys(additionalProperties, &[]string{"created_at", "modified_at", "name", "receives_permissions_from", "user_count"})
204240
} else {
205241
return err
206242
}
207243
o.CreatedAt = all.CreatedAt
208244
o.ModifiedAt = all.ModifiedAt
209245
o.Name = all.Name
246+
o.ReceivesPermissionsFrom = all.ReceivesPermissionsFrom
210247
o.UserCount = all.UserCount
211248

212249
if len(additionalProperties) > 0 {

api/datadogV2/model_role_clone_attributes.go

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ import (
1414
type RoleCloneAttributes struct {
1515
// Name of the new role that is cloned.
1616
Name string `json:"name"`
17+
// The managed role from which this role automatically inherits new permissions.
18+
// Specify one of the following: "Datadog Admin Role", "Datadog Standard Role", or "Datadog Read Only Role".
19+
// If empty or not specified, the role does not automatically inherit permissions from any managed role.
20+
ReceivesPermissionsFrom []string `json:"receives_permissions_from,omitempty"`
1721
// UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct
1822
UnparsedObject map[string]interface{} `json:"-"`
1923
AdditionalProperties map[string]interface{} `json:"-"`
@@ -60,13 +64,44 @@ func (o *RoleCloneAttributes) SetName(v string) {
6064
o.Name = v
6165
}
6266

67+
// GetReceivesPermissionsFrom returns the ReceivesPermissionsFrom field value if set, zero value otherwise.
68+
func (o *RoleCloneAttributes) GetReceivesPermissionsFrom() []string {
69+
if o == nil || o.ReceivesPermissionsFrom == nil {
70+
var ret []string
71+
return ret
72+
}
73+
return o.ReceivesPermissionsFrom
74+
}
75+
76+
// GetReceivesPermissionsFromOk returns a tuple with the ReceivesPermissionsFrom field value if set, nil otherwise
77+
// and a boolean to check if the value has been set.
78+
func (o *RoleCloneAttributes) GetReceivesPermissionsFromOk() (*[]string, bool) {
79+
if o == nil || o.ReceivesPermissionsFrom == nil {
80+
return nil, false
81+
}
82+
return &o.ReceivesPermissionsFrom, true
83+
}
84+
85+
// HasReceivesPermissionsFrom returns a boolean if a field has been set.
86+
func (o *RoleCloneAttributes) HasReceivesPermissionsFrom() bool {
87+
return o != nil && o.ReceivesPermissionsFrom != nil
88+
}
89+
90+
// SetReceivesPermissionsFrom gets a reference to the given []string and assigns it to the ReceivesPermissionsFrom field.
91+
func (o *RoleCloneAttributes) SetReceivesPermissionsFrom(v []string) {
92+
o.ReceivesPermissionsFrom = v
93+
}
94+
6395
// MarshalJSON serializes the struct using spec logic.
6496
func (o RoleCloneAttributes) MarshalJSON() ([]byte, error) {
6597
toSerialize := map[string]interface{}{}
6698
if o.UnparsedObject != nil {
6799
return datadog.Marshal(o.UnparsedObject)
68100
}
69101
toSerialize["name"] = o.Name
102+
if o.ReceivesPermissionsFrom != nil {
103+
toSerialize["receives_permissions_from"] = o.ReceivesPermissionsFrom
104+
}
70105

71106
for key, value := range o.AdditionalProperties {
72107
toSerialize[key] = value
@@ -77,7 +112,8 @@ func (o RoleCloneAttributes) MarshalJSON() ([]byte, error) {
77112
// UnmarshalJSON deserializes the given payload.
78113
func (o *RoleCloneAttributes) UnmarshalJSON(bytes []byte) (err error) {
79114
all := struct {
80-
Name *string `json:"name"`
115+
Name *string `json:"name"`
116+
ReceivesPermissionsFrom []string `json:"receives_permissions_from,omitempty"`
81117
}{}
82118
if err = datadog.Unmarshal(bytes, &all); err != nil {
83119
return datadog.Unmarshal(bytes, &o.UnparsedObject)
@@ -87,11 +123,12 @@ func (o *RoleCloneAttributes) UnmarshalJSON(bytes []byte) (err error) {
87123
}
88124
additionalProperties := make(map[string]interface{})
89125
if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil {
90-
datadog.DeleteKeys(additionalProperties, &[]string{"name"})
126+
datadog.DeleteKeys(additionalProperties, &[]string{"name", "receives_permissions_from"})
91127
} else {
92128
return err
93129
}
94130
o.Name = *all.Name
131+
o.ReceivesPermissionsFrom = all.ReceivesPermissionsFrom
95132

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

api/datadogV2/model_role_create_attributes.go

Lines changed: 41 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ type RoleCreateAttributes struct {
1919
ModifiedAt *time.Time `json:"modified_at,omitempty"`
2020
// Name of the role.
2121
Name string `json:"name"`
22+
// The managed role from which this role automatically inherits new permissions.
23+
// Specify one of the following: "Datadog Admin Role", "Datadog Standard Role", or "Datadog Read Only Role".
24+
// If empty or not specified, the role does not automatically inherit permissions from any managed role.
25+
ReceivesPermissionsFrom []string `json:"receives_permissions_from,omitempty"`
2226
// UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct
2327
UnparsedObject map[string]interface{} `json:"-"`
2428
AdditionalProperties map[string]interface{} `json:"-"`
@@ -121,6 +125,34 @@ func (o *RoleCreateAttributes) SetName(v string) {
121125
o.Name = v
122126
}
123127

128+
// GetReceivesPermissionsFrom returns the ReceivesPermissionsFrom field value if set, zero value otherwise.
129+
func (o *RoleCreateAttributes) GetReceivesPermissionsFrom() []string {
130+
if o == nil || o.ReceivesPermissionsFrom == nil {
131+
var ret []string
132+
return ret
133+
}
134+
return o.ReceivesPermissionsFrom
135+
}
136+
137+
// GetReceivesPermissionsFromOk returns a tuple with the ReceivesPermissionsFrom field value if set, nil otherwise
138+
// and a boolean to check if the value has been set.
139+
func (o *RoleCreateAttributes) GetReceivesPermissionsFromOk() (*[]string, bool) {
140+
if o == nil || o.ReceivesPermissionsFrom == nil {
141+
return nil, false
142+
}
143+
return &o.ReceivesPermissionsFrom, true
144+
}
145+
146+
// HasReceivesPermissionsFrom returns a boolean if a field has been set.
147+
func (o *RoleCreateAttributes) HasReceivesPermissionsFrom() bool {
148+
return o != nil && o.ReceivesPermissionsFrom != nil
149+
}
150+
151+
// SetReceivesPermissionsFrom gets a reference to the given []string and assigns it to the ReceivesPermissionsFrom field.
152+
func (o *RoleCreateAttributes) SetReceivesPermissionsFrom(v []string) {
153+
o.ReceivesPermissionsFrom = v
154+
}
155+
124156
// MarshalJSON serializes the struct using spec logic.
125157
func (o RoleCreateAttributes) MarshalJSON() ([]byte, error) {
126158
toSerialize := map[string]interface{}{}
@@ -142,6 +174,9 @@ func (o RoleCreateAttributes) MarshalJSON() ([]byte, error) {
142174
}
143175
}
144176
toSerialize["name"] = o.Name
177+
if o.ReceivesPermissionsFrom != nil {
178+
toSerialize["receives_permissions_from"] = o.ReceivesPermissionsFrom
179+
}
145180

146181
for key, value := range o.AdditionalProperties {
147182
toSerialize[key] = value
@@ -152,9 +187,10 @@ func (o RoleCreateAttributes) MarshalJSON() ([]byte, error) {
152187
// UnmarshalJSON deserializes the given payload.
153188
func (o *RoleCreateAttributes) UnmarshalJSON(bytes []byte) (err error) {
154189
all := struct {
155-
CreatedAt *time.Time `json:"created_at,omitempty"`
156-
ModifiedAt *time.Time `json:"modified_at,omitempty"`
157-
Name *string `json:"name"`
190+
CreatedAt *time.Time `json:"created_at,omitempty"`
191+
ModifiedAt *time.Time `json:"modified_at,omitempty"`
192+
Name *string `json:"name"`
193+
ReceivesPermissionsFrom []string `json:"receives_permissions_from,omitempty"`
158194
}{}
159195
if err = datadog.Unmarshal(bytes, &all); err != nil {
160196
return datadog.Unmarshal(bytes, &o.UnparsedObject)
@@ -164,13 +200,14 @@ func (o *RoleCreateAttributes) UnmarshalJSON(bytes []byte) (err error) {
164200
}
165201
additionalProperties := make(map[string]interface{})
166202
if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil {
167-
datadog.DeleteKeys(additionalProperties, &[]string{"created_at", "modified_at", "name"})
203+
datadog.DeleteKeys(additionalProperties, &[]string{"created_at", "modified_at", "name", "receives_permissions_from"})
168204
} else {
169205
return err
170206
}
171207
o.CreatedAt = all.CreatedAt
172208
o.ModifiedAt = all.ModifiedAt
173209
o.Name = *all.Name
210+
o.ReceivesPermissionsFrom = all.ReceivesPermissionsFrom
174211

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

0 commit comments

Comments
 (0)