|
| 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 { RoleDescriptor } from '@security/_types/RoleDescriptor' |
| 21 | +import { Dictionary } from '@spec_utils/Dictionary' |
| 22 | +import { RequestBase } from '@_types/Base' |
| 23 | +import { Metadata } from '@_types/common' |
| 24 | +import { Duration } from '@_types/Time' |
| 25 | + |
| 26 | +/** |
| 27 | + * Bulk update API keys. |
| 28 | + * Update the attributes for multiple API keys. |
| 29 | + * |
| 30 | + * IMPORTANT: It is not possible to use an API key as the authentication credential for this API. To update API keys, the owner user's credentials are required. |
| 31 | + * |
| 32 | + * This API is similar to the update API key API but enables you to apply the same update to multiple API keys in one API call. This operation can greatly improve performance over making individual updates. |
| 33 | + * |
| 34 | + * It is not possible to update expired or invalidated API keys. |
| 35 | + * |
| 36 | + * This API supports updates to API key access scope, metadata and expiration. |
| 37 | + * The access scope of each API key is derived from the `role_descriptors` you specify in the request and a snapshot of the owner user's permissions at the time of the request. |
| 38 | + * The snapshot of the owner's permissions is updated automatically on every call. |
| 39 | + * |
| 40 | + * IMPORTANT: If you don't specify `role_descriptors` in the request, a call to this API might still change an API key's access scope. This change can occur if the owner user's permissions have changed since the API key was created or last modified. |
| 41 | + * |
| 42 | + * A successful request returns a JSON structure that contains the IDs of all updated API keys, the IDs of API keys that already had the requested changes and did not require an update, and error details for any failed update. |
| 43 | + * @rest_spec_name security.bulk_update_api_keys |
| 44 | + * @availability stack since=8.5.0 stability=stable visibility=public |
| 45 | + * @doc_id security-api-bulk-update-key |
| 46 | + * @cluster_privileges manage_own_api_key |
| 47 | + */ |
| 48 | +export interface Request extends RequestBase { |
| 49 | + body: { |
| 50 | + /** |
| 51 | + * Expiration time for the API keys. |
| 52 | + * By default, API keys never expire. |
| 53 | + * This property can be omitted to leave the value unchanged. |
| 54 | + */ |
| 55 | + expiration?: Duration |
| 56 | + /** |
| 57 | + * The API key identifiers. |
| 58 | + */ |
| 59 | + ids: string[] |
| 60 | + /** |
| 61 | + * Arbitrary nested metadata to associate with the API keys. |
| 62 | + * Within the `metadata` object, top-level keys beginning with an underscore (`_`) are reserved for system usage. |
| 63 | + * Any information specified with this parameter fully replaces metadata previously associated with the API key. |
| 64 | + */ |
| 65 | + metadata?: Metadata |
| 66 | + /** |
| 67 | + * The role descriptors to assign to the API keys. |
| 68 | + * An API key's effective permissions are an intersection of its assigned privileges and the point-in-time snapshot of permissions of the owner user. |
| 69 | + * You can assign new privileges by specifying them in this parameter. |
| 70 | + * To remove assigned privileges, supply the `role_descriptors` parameter as an empty object `{}`. |
| 71 | + * If an API key has no assigned privileges, it inherits the owner user's full permissions. |
| 72 | + * The snapshot of the owner's permissions is always updated, whether you supply the `role_descriptors` parameter. |
| 73 | + * The structure of a role descriptor is the same as the request for the create API keys API. |
| 74 | + */ |
| 75 | + role_descriptors?: Dictionary<string, RoleDescriptor> |
| 76 | + } |
| 77 | +} |
0 commit comments