Skip to content

Commit dac7201

Browse files
authored
Support for security remote_cluster and associated privileges (#3125)
This commit adds support for the remote_cluster in the role and role descriptors. Additionally: * adds missing references to remote_indices * add new cluster privilege monitor_stats * adds related version information where applicable * updates references to cluster from string[] to proper enumeration
1 parent 55d431a commit dac7201

File tree

8 files changed

+357
-31
lines changed

8 files changed

+357
-31
lines changed

output/schema/schema.json

Lines changed: 246 additions & 23 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

output/typescript/types.ts

Lines changed: 18 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
22
"dependencies": {
3-
"@stoplight/spectral-cli": "^6.13.1"
3+
"@stoplight/spectral-cli": "^6.14.1"
44
}
55
}

specification/security/_types/Privileges.ts

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,10 @@ export enum ClusterPrivilege {
151151
* @availability stack
152152
*/
153153
monitor_snapshot,
154+
/**
155+
* @availability stack since=8.17.0
156+
*/
157+
monitor_stats,
154158
/**
155159
* @availability stack
156160
*/
@@ -194,6 +198,21 @@ export enum ClusterPrivilege {
194198
write_fleet_secrets
195199
}
196200

201+
/**
202+
* The subset of cluster level privileges that can be defined for remote clusters.
203+
* @availability stack
204+
*/
205+
export enum RemoteClusterPrivilege {
206+
/**
207+
* @availability stack since=8.14.0
208+
*/
209+
monitor_enrich,
210+
/**
211+
* @availability stack since=8.17.0
212+
*/
213+
monitor_stats
214+
}
215+
197216
// Keep in sync with RemoteIndicesPrivileges
198217
export class IndicesPrivileges {
199218
/**
@@ -221,6 +240,9 @@ export class IndicesPrivileges {
221240
allow_restricted_indices?: boolean
222241
}
223242

243+
/**
244+
* The subset of index level privileges that can be defined for remote clusters.
245+
*/
224246
// Keep in sync with IndicesPrivileges
225247
export class RemoteIndicesPrivileges {
226248
/**
@@ -252,6 +274,20 @@ export class RemoteIndicesPrivileges {
252274
allow_restricted_indices?: boolean
253275
}
254276

277+
/**
278+
* The subset of cluster level privileges that can be defined for remote clusters.
279+
*/
280+
export class RemoteClusterPrivileges {
281+
/**
282+
* A list of cluster aliases to which the permissions in this entry apply.
283+
*/
284+
clusters: Names
285+
/**
286+
* The cluster level privileges that owners of the role have on the remote cluster.
287+
*/
288+
privileges: RemoteClusterPrivilege[]
289+
}
290+
255291
export class UserIndicesPrivileges {
256292
/**
257293
* The document fields that the owners of the role have read access to.

specification/security/_types/RoleDescriptor.ts

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@ import {
2525
ApplicationPrivileges,
2626
ClusterPrivilege,
2727
GlobalPrivilege,
28-
IndicesPrivileges
28+
IndicesPrivileges,
29+
RemoteClusterPrivileges,
30+
RemoteIndicesPrivileges
2931
} from './Privileges'
3032

3133
export class RoleDescriptor {
@@ -38,6 +40,19 @@ export class RoleDescriptor {
3840
* @aliases index
3941
*/
4042
indices?: IndicesPrivileges[]
43+
44+
/**
45+
* A list of indices permissions for remote clusters.
46+
* @availability stack since=8.14.0
47+
*/
48+
remote_indices?: RemoteIndicesPrivileges[]
49+
50+
/**
51+
* A list of cluster permissions for remote clusters. Note - this is limited a subset of the cluster permissions.
52+
* @availability stack since=8.15.0
53+
*/
54+
remote_cluster?: RemoteClusterPrivileges[]
55+
4156
/**
4257
* An object defining global privileges. A global privilege is a form of cluster privilege that is request-aware. Support for global privileges is currently limited to the management of application privileges.
4358
* @availability stack
@@ -73,6 +88,17 @@ export class RoleDescriptorRead implements OverloadOf<RoleDescriptor> {
7388
* @aliases index
7489
*/
7590
indices: IndicesPrivileges[]
91+
/**
92+
* A list of indices permissions for remote clusters.
93+
* @availability stack since=8.14.0
94+
*/
95+
remote_indices?: RemoteIndicesPrivileges[]
96+
97+
/**
98+
* A list of cluster permissions for remote clusters. Note - this is limited a subset of the cluster permissions.
99+
* @availability stack since=8.15.0
100+
*/
101+
remote_cluster?: RemoteClusterPrivileges[]
76102
/**
77103
* An object defining global privileges. A global privilege is a form of cluster privilege that is request-aware. Support for global privileges is currently limited to the management of application privileges.
78104
*/

specification/security/get_builtin_privileges/SecurityGetBuiltinPrivilegesResponse.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,16 @@
1717
* under the License.
1818
*/
1919

20+
import {
21+
ClusterPrivilege,
22+
RemoteClusterPrivilege
23+
} from '@security/_types/Privileges'
2024
import { IndexName } from '@_types/common'
2125

2226
export class Response {
23-
body: { cluster: string[]; index: IndexName[] }
27+
body: {
28+
cluster: ClusterPrivilege[]
29+
index: IndexName[]
30+
remote_cluster: RemoteClusterPrivilege[]
31+
}
2432
}

specification/security/get_role/types.ts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,27 @@
1919

2020
import {
2121
ApplicationPrivileges,
22-
IndicesPrivileges
22+
ClusterPrivilege,
23+
IndicesPrivileges,
24+
RemoteClusterPrivileges,
25+
RemoteIndicesPrivileges
2326
} from '@security/_types/Privileges'
2427
import { RoleTemplate } from '@security/_types/RoleTemplate'
2528
import { Dictionary } from '@spec_utils/Dictionary'
2629
import { UserDefinedValue } from '@spec_utils/UserDefinedValue'
2730
import { Metadata } from '@_types/common'
2831

2932
export class Role {
30-
cluster: string[]
33+
cluster: ClusterPrivilege[]
3134
indices: IndicesPrivileges[]
35+
/**
36+
* @availability stack since=8.14.0
37+
*/
38+
remote_indices?: RemoteIndicesPrivileges[]
39+
/**
40+
* @availability stack since=8.15.0
41+
*/
42+
remote_cluster?: RemoteClusterPrivileges[]
3243
metadata: Metadata
3344
run_as: string[]
3445
transient_metadata?: Dictionary<string, UserDefinedValue>

specification/security/put_role/SecurityPutRoleRequest.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import {
2121
ApplicationPrivileges,
2222
ClusterPrivilege,
2323
IndicesPrivileges,
24+
RemoteClusterPrivileges,
2425
RemoteIndicesPrivileges
2526
} from '@security/_types/Privileges'
2627
import { Dictionary } from '@spec_utils/Dictionary'
@@ -74,6 +75,12 @@ export interface Request extends RequestBase {
7475
*
7576
*/
7677
remote_indices?: RemoteIndicesPrivileges[]
78+
/**
79+
* A list of remote cluster permissions entries.
80+
* @availability stack since=8.15.0
81+
*
82+
*/
83+
remote_cluster?: RemoteClusterPrivileges[]
7784
/**
7885
* Optional metadata. Within the metadata object, keys that begin with an underscore (`_`) are reserved for system use.
7986
*/

0 commit comments

Comments
 (0)