Skip to content

Commit 25975f4

Browse files
committed
Add spec for bulk put roles
1 parent 09b5022 commit 25975f4

File tree

3 files changed

+117
-0
lines changed

3 files changed

+117
-0
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
/*
2+
* Licensed to Elasticsearch B.V. under one or more contributor
3+
* license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright
5+
* ownership. Elasticsearch B.V. licenses this file to you under
6+
* the Apache License, Version 2.0 (the "License"); you may
7+
* not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
import { Dictionary } from '@spec_utils/Dictionary'
21+
import { RequestBase } from '@_types/Base'
22+
import { Refresh } from '@_types/common'
23+
import { RoleDescriptor } from '@security/_types/RoleDescriptor'
24+
25+
/**
26+
* The role management APIs are generally the preferred way to manage roles, rather than using file-based role management.
27+
* The bulk create or update roles API cannot update roles that are defined in roles files.
28+
* @rest_spec_name security.bulk_put_role
29+
* @availability stack since=8.15.0 stability=stable
30+
* @availability serverless stability=stable visibility=private
31+
* @cluster_privileges manage_security
32+
*/
33+
export interface Request extends RequestBase {
34+
query_parameters: {
35+
refresh?: Refresh
36+
}
37+
body: {
38+
/**
39+
* A dictionary of role name to RoleDescriptor objects to add or update
40+
*/
41+
roles: Dictionary<string, RoleDescriptor>
42+
}
43+
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
/*
2+
* Licensed to Elasticsearch B.V. under one or more contributor
3+
* license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright
5+
* ownership. Elasticsearch B.V. licenses this file to you under
6+
* the Apache License, Version 2.0 (the "License"); you may
7+
* not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
import { BulkError } from '@security/bulk_put_role/types'
21+
22+
export class Response {
23+
body: {
24+
/**
25+
* Array of created roles
26+
*/
27+
created?: string[]
28+
/**
29+
* Array of updated roles
30+
*/
31+
updated?: string[]
32+
/**
33+
* Array of role names without any changes
34+
*/
35+
noop?: string[]
36+
/**
37+
* Present if any updates resulted in errors
38+
*/
39+
errors?: BulkError
40+
}
41+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/*
2+
* Licensed to Elasticsearch B.V. under one or more contributor
3+
* license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright
5+
* ownership. Elasticsearch B.V. licenses this file to you under
6+
* the Apache License, Version 2.0 (the "License"); you may
7+
* not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
import { integer } from '@_types/Numeric'
21+
import { Dictionary } from '@spec_utils/Dictionary'
22+
import { ErrorCause } from '@_types/Errors'
23+
24+
export class BulkError {
25+
/**
26+
* The number of errors
27+
*/
28+
count: integer
29+
/**
30+
* Details about the errors, keyed by role name
31+
*/
32+
details: Dictionary<string, ErrorCause>
33+
}

0 commit comments

Comments
 (0)