Skip to content

Commit 2cd26ee

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

7 files changed

Lines changed: 126 additions & 14 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

examples/v2/roles/CreateRole.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
data: DatadogAPIClient::V2::RoleCreateData.new({
88
attributes: DatadogAPIClient::V2::RoleCreateAttributes.new({
99
name: "developers",
10+
receives_permissions_from: [],
1011
}),
1112
relationships: DatadogAPIClient::V2::RoleRelationships.new({
1213
permissions: DatadogAPIClient::V2::RelationshipToPermissions.new({

features/v2/roles.feature

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ Feature: Roles
66
account assets can be granted to roles in the Datadog application without
77
using this API. For example, granting read access on a specific log index
88
to a role can be done in Datadog from the [Pipelines
9-
page](https://app.datadoghq.com/logs/pipelines).
9+
page](https://app.datadoghq.com/logs/pipelines). Roles can also be
10+
managed in bulk through the Datadog UI, which provides the capability to
11+
assign a single permission to multiple roles simultaneously.
1012

1113
Background:
1214
Given a valid "apiKeyAuth" key in the system
@@ -64,7 +66,7 @@ Feature: Roles
6466
Scenario: Create a new role by cloning an existing role returns "Not found" response
6567
Given new "CloneRole" request
6668
And request contains "role_id" parameter from "REPLACE.ME"
67-
And body with value {"data": {"attributes": {"name": "cloned-role"}, "type": "roles"}}
69+
And body with value {"data": {"attributes": {"name": "cloned-role", "receives_permissions_from": []}, "type": "roles"}}
6870
When the request is sent
6971
Then the response status is 404 Not found
7072

@@ -81,14 +83,14 @@ Feature: Roles
8183
@generated @skip @team:DataDog/aaa-core-access
8284
Scenario: Create role returns "Bad Request" response
8385
Given new "CreateRole" request
84-
And body with value {"data": {"attributes": {"name": "developers"}, "relationships": {"permissions": {"data": [{"type": "permissions"}]}}, "type": "roles"}}
86+
And body with value {"data": {"attributes": {"name": "developers", "receives_permissions_from": []}, "relationships": {"permissions": {"data": [{"type": "permissions"}]}}, "type": "roles"}}
8587
When the request is sent
8688
Then the response status is 400 Bad Request
8789

8890
@generated @skip @team:DataDog/aaa-core-access
8991
Scenario: Create role returns "OK" response
9092
Given new "CreateRole" request
91-
And body with value {"data": {"attributes": {"name": "developers"}, "relationships": {"permissions": {"data": [{"type": "permissions"}]}}, "type": "roles"}}
93+
And body with value {"data": {"attributes": {"name": "developers", "receives_permissions_from": []}, "relationships": {"permissions": {"data": [{"type": "permissions"}]}}, "type": "roles"}}
9294
When the request is sent
9395
Then the response status is 200 OK
9496

@@ -335,6 +337,6 @@ Feature: Roles
335337
Scenario: Update a role returns "Unprocessable Entity" response
336338
Given new "UpdateRole" request
337339
And request contains "role_id" parameter from "REPLACE.ME"
338-
And body with value {"data": {"attributes": {}, "id": "00000000-0000-1111-0000-000000000000", "relationships": {"permissions": {"data": [{"type": "permissions"}]}}, "type": "roles"}}
340+
And body with value {"data": {"attributes": {"receives_permissions_from": []}, "id": "00000000-0000-1111-0000-000000000000", "relationships": {"permissions": {"data": [{"type": "permissions"}]}}, "type": "roles"}}
339341
When the request is sent
340342
Then the response status is 422 Unprocessable Entity

lib/datadog_api_client/v2/models/role_attributes.rb

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@ class RoleAttributes
3030
# The name of the role. The name is neither unique nor a stable identifier of the role.
3131
attr_accessor :name
3232

33+
# The managed role from which this role automatically inherits new permissions.
34+
# Specify one of the following: "Datadog Admin Role", "Datadog Standard Role", or "Datadog Read Only Role".
35+
# If empty or not specified, the role does not automatically inherit permissions from any managed role.
36+
attr_accessor :receives_permissions_from
37+
3338
# Number of users with that role.
3439
attr_accessor :user_count
3540

@@ -42,6 +47,7 @@ def self.attribute_map
4247
:'created_at' => :'created_at',
4348
:'modified_at' => :'modified_at',
4449
:'name' => :'name',
50+
:'receives_permissions_from' => :'receives_permissions_from',
4551
:'user_count' => :'user_count'
4652
}
4753
end
@@ -53,6 +59,7 @@ def self.openapi_types
5359
:'created_at' => :'Time',
5460
:'modified_at' => :'Time',
5561
:'name' => :'String',
62+
:'receives_permissions_from' => :'Array<String>',
5663
:'user_count' => :'Integer'
5764
}
5865
end
@@ -87,6 +94,12 @@ def initialize(attributes = {})
8794
self.name = attributes[:'name']
8895
end
8996

97+
if attributes.key?(:'receives_permissions_from')
98+
if (value = attributes[:'receives_permissions_from']).is_a?(Array)
99+
self.receives_permissions_from = value
100+
end
101+
end
102+
90103
if attributes.key?(:'user_count')
91104
self.user_count = attributes[:'user_count']
92105
end
@@ -121,6 +134,7 @@ def ==(o)
121134
created_at == o.created_at &&
122135
modified_at == o.modified_at &&
123136
name == o.name &&
137+
receives_permissions_from == o.receives_permissions_from &&
124138
user_count == o.user_count &&
125139
additional_properties == o.additional_properties
126140
end
@@ -129,7 +143,7 @@ def ==(o)
129143
# @return [Integer] Hash code
130144
# @!visibility private
131145
def hash
132-
[created_at, modified_at, name, user_count, additional_properties].hash
146+
[created_at, modified_at, name, receives_permissions_from, user_count, additional_properties].hash
133147
end
134148
end
135149
end

lib/datadog_api_client/v2/models/role_clone_attributes.rb

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,21 +24,28 @@ class RoleCloneAttributes
2424
# Name of the new role that is cloned.
2525
attr_reader :name
2626

27+
# The managed role from which this role automatically inherits new permissions.
28+
# Specify one of the following: "Datadog Admin Role", "Datadog Standard Role", or "Datadog Read Only Role".
29+
# If empty or not specified, the role does not automatically inherit permissions from any managed role.
30+
attr_accessor :receives_permissions_from
31+
2732
attr_accessor :additional_properties
2833

2934
# Attribute mapping from ruby-style variable name to JSON key.
3035
# @!visibility private
3136
def self.attribute_map
3237
{
33-
:'name' => :'name'
38+
:'name' => :'name',
39+
:'receives_permissions_from' => :'receives_permissions_from'
3440
}
3541
end
3642

3743
# Attribute type mapping.
3844
# @!visibility private
3945
def self.openapi_types
4046
{
41-
:'name' => :'String'
47+
:'name' => :'String',
48+
:'receives_permissions_from' => :'Array<String>'
4249
}
4350
end
4451

@@ -63,6 +70,12 @@ def initialize(attributes = {})
6370
if attributes.key?(:'name')
6471
self.name = attributes[:'name']
6572
end
73+
74+
if attributes.key?(:'receives_permissions_from')
75+
if (value = attributes[:'receives_permissions_from']).is_a?(Array)
76+
self.receives_permissions_from = value
77+
end
78+
end
6679
end
6780

6881
# Check to see if the all the properties in the model are valid
@@ -110,14 +123,15 @@ def ==(o)
110123
return true if self.equal?(o)
111124
self.class == o.class &&
112125
name == o.name &&
126+
receives_permissions_from == o.receives_permissions_from &&
113127
additional_properties == o.additional_properties
114128
end
115129

116130
# Calculates hash code according to all attributes.
117131
# @return [Integer] Hash code
118132
# @!visibility private
119133
def hash
120-
[name, additional_properties].hash
134+
[name, receives_permissions_from, additional_properties].hash
121135
end
122136
end
123137
end

lib/datadog_api_client/v2/models/role_create_attributes.rb

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@ class RoleCreateAttributes
3030
# Name of the role.
3131
attr_reader :name
3232

33+
# The managed role from which this role automatically inherits new permissions.
34+
# Specify one of the following: "Datadog Admin Role", "Datadog Standard Role", or "Datadog Read Only Role".
35+
# If empty or not specified, the role does not automatically inherit permissions from any managed role.
36+
attr_accessor :receives_permissions_from
37+
3338
attr_accessor :additional_properties
3439

3540
# Attribute mapping from ruby-style variable name to JSON key.
@@ -38,7 +43,8 @@ def self.attribute_map
3843
{
3944
:'created_at' => :'created_at',
4045
:'modified_at' => :'modified_at',
41-
:'name' => :'name'
46+
:'name' => :'name',
47+
:'receives_permissions_from' => :'receives_permissions_from'
4248
}
4349
end
4450

@@ -48,7 +54,8 @@ def self.openapi_types
4854
{
4955
:'created_at' => :'Time',
5056
:'modified_at' => :'Time',
51-
:'name' => :'String'
57+
:'name' => :'String',
58+
:'receives_permissions_from' => :'Array<String>'
5259
}
5360
end
5461

@@ -81,6 +88,12 @@ def initialize(attributes = {})
8188
if attributes.key?(:'name')
8289
self.name = attributes[:'name']
8390
end
91+
92+
if attributes.key?(:'receives_permissions_from')
93+
if (value = attributes[:'receives_permissions_from']).is_a?(Array)
94+
self.receives_permissions_from = value
95+
end
96+
end
8497
end
8598

8699
# Check to see if the all the properties in the model are valid
@@ -130,14 +143,15 @@ def ==(o)
130143
created_at == o.created_at &&
131144
modified_at == o.modified_at &&
132145
name == o.name &&
146+
receives_permissions_from == o.receives_permissions_from &&
133147
additional_properties == o.additional_properties
134148
end
135149

136150
# Calculates hash code according to all attributes.
137151
# @return [Integer] Hash code
138152
# @!visibility private
139153
def hash
140-
[created_at, modified_at, name, additional_properties].hash
154+
[created_at, modified_at, name, receives_permissions_from, additional_properties].hash
141155
end
142156
end
143157
end

lib/datadog_api_client/v2/models/role_update_attributes.rb

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@ class RoleUpdateAttributes
3030
# Name of the role.
3131
attr_accessor :name
3232

33+
# The managed role from which this role automatically inherits new permissions.
34+
# Specify one of the following: "Datadog Admin Role", "Datadog Standard Role", or "Datadog Read Only Role".
35+
# If empty or not specified, the role does not automatically inherit permissions from any managed role.
36+
attr_accessor :receives_permissions_from
37+
3338
# The user count.
3439
attr_reader :user_count
3540

@@ -42,6 +47,7 @@ def self.attribute_map
4247
:'created_at' => :'created_at',
4348
:'modified_at' => :'modified_at',
4449
:'name' => :'name',
50+
:'receives_permissions_from' => :'receives_permissions_from',
4551
:'user_count' => :'user_count'
4652
}
4753
end
@@ -53,6 +59,7 @@ def self.openapi_types
5359
:'created_at' => :'Time',
5460
:'modified_at' => :'Time',
5561
:'name' => :'String',
62+
:'receives_permissions_from' => :'Array<String>',
5663
:'user_count' => :'Integer'
5764
}
5865
end
@@ -87,6 +94,12 @@ def initialize(attributes = {})
8794
self.name = attributes[:'name']
8895
end
8996

97+
if attributes.key?(:'receives_permissions_from')
98+
if (value = attributes[:'receives_permissions_from']).is_a?(Array)
99+
self.receives_permissions_from = value
100+
end
101+
end
102+
90103
if attributes.key?(:'user_count')
91104
self.user_count = attributes[:'user_count']
92105
end
@@ -139,6 +152,7 @@ def ==(o)
139152
created_at == o.created_at &&
140153
modified_at == o.modified_at &&
141154
name == o.name &&
155+
receives_permissions_from == o.receives_permissions_from &&
142156
user_count == o.user_count &&
143157
additional_properties == o.additional_properties
144158
end
@@ -147,7 +161,7 @@ def ==(o)
147161
# @return [Integer] Hash code
148162
# @!visibility private
149163
def hash
150-
[created_at, modified_at, name, user_count, additional_properties].hash
164+
[created_at, modified_at, name, receives_permissions_from, user_count, additional_properties].hash
151165
end
152166
end
153167
end

0 commit comments

Comments
 (0)