Skip to content

Commit a68a27f

Browse files
committed
Add create a cross cluster API key
1 parent 412e17e commit a68a27f

File tree

3 files changed

+130
-21
lines changed

3 files changed

+130
-21
lines changed
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
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 { RequestBase } from '@_types/Base'
21+
import { Metadata, Name } from '@_types/common'
22+
import { Duration } from '@_types/Time'
23+
24+
/**
25+
* Create a cross-cluster API key.
26+
*
27+
* Create an API key of the `cross_cluster` type for the API key based remote cluster access.
28+
* A `cross_cluster` API key cannot be used to authenticate through the REST interface.
29+
*
30+
* IMPORTANT: To authenticate this request you must use a credential that is not an API key. Even if you use an API key that has the required privilege, the API returns an error.
31+
*
32+
* Cross-cluster API keys are created by the Elasticsearch API key service, which is automatically enabled.
33+
*
34+
* A successful request returns a JSON structure that contains the API key, its unique ID, and its name. If applicable, it also returns expiration information for the API key in milliseconds.
35+
*
36+
* By default, API keys never expire. You can specify expiration information when you create the API keys.
37+
*
38+
* Cross-cluster API keys can only be updated with the update cross-cluster API key API.
39+
* Attempting to update them with the update REST API key API or the bulk update REST API keys API will result in an error.
40+
* @rest_spec_name security.create_cross_cluster_api_key
41+
* @availability stack stability=stable
42+
* @cluster_privileges manage_security
43+
* @ext_doc_id remote-clusters-api-key
44+
*/
45+
export interface Request extends RequestBase {
46+
body: {
47+
/**
48+
* Expiration time for the API key.
49+
* By default, API keys never expire.
50+
*/
51+
expiration?: Duration
52+
/**
53+
* Arbitrary metadata that you want to associate with the API key.
54+
* It supports nested data structure.
55+
* Within the metadata object, keys beginning with `_` are reserved for system usage.
56+
*/
57+
metadata?: Metadata
58+
/** Specifies the name for this API key. */
59+
name?: Name
60+
}
61+
}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
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 { Id, Name } from '@_types/common'
21+
import { long } from '@_types/Numeric'
22+
23+
export class Response {
24+
body: {
25+
/**
26+
* Generated API key.
27+
*/
28+
api_key: string
29+
/**
30+
* Expiration in milliseconds for the API key.
31+
*/
32+
expiration?: long
33+
/**
34+
* Unique ID for this API key.
35+
*/
36+
id: Id
37+
/**
38+
* Specifies the name for this API key.
39+
*/
40+
name: Name
41+
/**
42+
* API key credentials which is the base64-encoding of
43+
* the UTF-8 representation of `id` and `api_key` joined
44+
* by a colon (`:`).
45+
*/
46+
encoded: string
47+
}
48+
}

specification/security/update_cross_cluster_api_key/UpdateCrossClusterApiKeyRequest.ts

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -22,32 +22,32 @@ import { Id, Metadata } from '@_types/common'
2222
import { Duration } from '@_types/Time'
2323

2424
/**
25-
* Update cross-cluster API key.
25+
* Update a cross-cluster API key.
2626
*
2727
* Update the attributes of an existing cross-cluster API key, which is used for API key based remote cluster access.
2828
* @rest_spec_name security.update_cross_cluster_api_key
2929
* @availability stack stability=stable
3030
* @ext_doc_id remote-clusters-api-key
3131
*/
3232
export interface Request extends RequestBase {
33-
path_parts: {
34-
/**
35-
* The ID of the cross-cluster API key to update.
36-
*/
37-
id: Id
38-
}
39-
body: {
40-
/**
41-
* Expiration time for the API key.
42-
* By default, API keys never expire. This property can be omitted to leave the value unchanged.
43-
*/
44-
expiration?: Duration
45-
/**
46-
* Arbitrary metadata that you want to associate with the API key.
47-
* It supports nested data structure.
48-
* Within the metadata object, keys beginning with `_` are reserved for system usage.
49-
* When specified, this information fully replaces metadata previously associated with the API key.
50-
*/
51-
metadata?: Metadata
52-
}
33+
path_parts: {
34+
/**
35+
* The ID of the cross-cluster API key to update.
36+
*/
37+
id: Id
38+
}
39+
body: {
40+
/**
41+
* Expiration time for the API key.
42+
* By default, API keys never expire. This property can be omitted to leave the value unchanged.
43+
*/
44+
expiration?: Duration
45+
/**
46+
* Arbitrary metadata that you want to associate with the API key.
47+
* It supports nested data structure.
48+
* Within the metadata object, keys beginning with `_` are reserved for system usage.
49+
* When specified, this information fully replaces metadata previously associated with the API key.
50+
*/
51+
metadata?: Metadata
52+
}
5353
}

0 commit comments

Comments
 (0)