Skip to content

Commit 57729da

Browse files
committed
[codegen] Update to latest API spec
1 parent 9b763fd commit 57729da

File tree

11 files changed

+1204
-39
lines changed

11 files changed

+1204
-39
lines changed

java-client/src/main/java/co/elastic/clients/elasticsearch/_types/Time.java

+4-3
Original file line numberDiff line numberDiff line change
@@ -43,16 +43,17 @@
4343
import java.util.function.Function;
4444
import javax.annotation.Nullable;
4545

46-
// typedef: _types.Time
46+
// typedef: _types.Duration
4747

4848
/**
4949
* Whenever durations need to be specified, e.g. for a timeout parameter, the
5050
* duration must specify the unit, like 2d for 2 days.
5151
*
5252
* @see <a href=
53-
* "https://github.com/elastic/elasticsearch/blob/8.3/libs/core/src/main/java/org/elasticsearch/core/TimeValue.java">Documentation
53+
* "https://github.com/elastic/elasticsearch/blob/master/libs/core/src/main/java/org/elasticsearch/core/TimeValue.java">Documentation
5454
* on elastic.co</a>
55-
* @see <a href="../doc-files/api-spec.html#_types.Time">API specification</a>
55+
* @see <a href="../doc-files/api-spec.html#_types.Duration">API
56+
* specification</a>
5657
*/
5758
@JsonpDeserializable
5859
public class Time implements TaggedUnion<Time.Kind, Object>, JsonpSerializable {

java-client/src/main/java/co/elastic/clients/elasticsearch/doc-files/api-spec.html

+23-19
Original file line numberDiff line numberDiff line change
@@ -2022,29 +2022,29 @@
20222022
'searchable_snapshots.stats.Request': 'searchable_snapshots/stats/SearchableSnapshotsStatsRequest.ts#L24-L36',
20232023
'searchable_snapshots.stats.Response': 'searchable_snapshots/stats/SearchableSnapshotsStatsResponse.ts#L22-L27',
20242024
'security._types.ApiKey': 'security/_types/ApiKey.ts#L23-L33',
2025-
'security._types.ApplicationGlobalUserPrivileges': 'security/_types/Privileges.ts#L163-L165',
2025+
'security._types.ApplicationGlobalUserPrivileges': 'security/_types/Privileges.ts#L164-L166',
20262026
'security._types.ApplicationPrivileges': 'security/_types/Privileges.ts#L26-L39',
20272027
'security._types.ClusterNode': 'security/_types/ClusterNode.ts#L22-L24',
2028-
'security._types.ClusterPrivilege': 'security/_types/Privileges.ts#L41-L78',
2028+
'security._types.ClusterPrivilege': 'security/_types/Privileges.ts#L41-L79',
20292029
'security._types.CreatedStatus': 'security/_types/CreatedStatus.ts#L20-L22',
20302030
'security._types.FieldRule': 'security/_types/RoleMappingRule.ts#L33-L42',
20312031
'security._types.FieldSecurity': 'security/_types/FieldSecurity.ts#L22-L25',
2032-
'security._types.GlobalPrivilege': 'security/_types/Privileges.ts#L159-L161',
2032+
'security._types.GlobalPrivilege': 'security/_types/Privileges.ts#L160-L162',
20332033
'security._types.GrantType': 'security/_types/GrantType.ts#L20-L23',
2034-
'security._types.IndexPrivilege': 'security/_types/Privileges.ts#L137-L157',
2035-
'security._types.IndicesPrivileges': 'security/_types/Privileges.ts#L80-L103',
2036-
'security._types.ManageUserPrivileges': 'security/_types/Privileges.ts#L167-L169',
2034+
'security._types.IndexPrivilege': 'security/_types/Privileges.ts#L138-L158',
2035+
'security._types.IndicesPrivileges': 'security/_types/Privileges.ts#L81-L104',
2036+
'security._types.ManageUserPrivileges': 'security/_types/Privileges.ts#L168-L170',
20372037
'security._types.Realm': 'security/_types/RoleMappingRule.ts#L44-L46',
20382038
'security._types.RealmInfo': 'security/_types/RealmInfo.ts#L22-L25',
20392039
'security._types.RoleMapping': 'security/_types/RoleMapping.ts#L25-L31',
20402040
'security._types.RoleMappingRule': 'security/_types/RoleMappingRule.ts#L23-L31',
20412041
'security._types.TransientMetadataConfig': 'security/_types/TransientMetadataConfig.ts#L20-L22',
20422042
'security._types.User': 'security/_types/User.ts#L22-L29',
2043-
'security._types.UserProfile': 'security/_types/UserProfile.ts#L41-L47',
2044-
'security._types.UserProfileHitMetadata': 'security/_types/UserProfile.ts#L27-L30',
2045-
'security._types.UserProfileUser': 'security/_types/UserProfile.ts#L32-L39',
2046-
'security._types.UserProfileWithMetadata': 'security/_types/UserProfile.ts#L49-L52',
2047-
'security.activate_user_profile.Request': 'security/activate_user_profile/Request.ts#L23-L36',
2043+
'security._types.UserProfile': 'security/_types/UserProfile.ts#L43-L49',
2044+
'security._types.UserProfileHitMetadata': 'security/_types/UserProfile.ts#L29-L32',
2045+
'security._types.UserProfileUser': 'security/_types/UserProfile.ts#L34-L41',
2046+
'security._types.UserProfileWithMetadata': 'security/_types/UserProfile.ts#L51-L54',
2047+
'security.activate_user_profile.Request': 'security/activate_user_profile/Request.ts#L23-L37',
20482048
'security.activate_user_profile.Response': 'security/activate_user_profile/Response.ts#L22-L24',
20492049
'security.authenticate.Request': 'security/authenticate/SecurityAuthenticateRequest.ts#L22-L28',
20502050
'security.authenticate.Response': 'security/authenticate/SecurityAuthenticateResponse.ts#L25-L40',
@@ -2064,7 +2064,7 @@
20642064
'security.create_api_key.Request': 'security/create_api_key/SecurityCreateApiKeyRequest.ts#L26-L51',
20652065
'security.create_api_key.Response': 'security/create_api_key/SecurityCreateApiKeyResponse.ts#L23-L49',
20662066
'security.create_api_key.RoleDescriptor': 'security/create_api_key/types.ts#L30-L39',
2067-
'security.create_service_token.Request': 'security/create_service_token/CreateServiceTokenRequest.ts#L23-L34',
2067+
'security.create_service_token.Request': 'security/create_service_token/CreateServiceTokenRequest.ts#L24-L39',
20682068
'security.create_service_token.Response': 'security/create_service_token/CreateServiceTokenResponse.ts#L22-L27',
20692069
'security.create_service_token.Token': 'security/create_service_token/types.ts#L22-L25',
20702070
'security.delete_privileges.FoundStatus': 'security/delete_privileges/types.ts#L20-L22',
@@ -2080,11 +2080,11 @@
20802080
'security.delete_user.Response': 'security/delete_user/SecurityDeleteUserResponse.ts#L20-L22',
20812081
'security.disable_user.Request': 'security/disable_user/SecurityDisableUserRequest.ts#L23-L35',
20822082
'security.disable_user.Response': 'security/disable_user/SecurityDisableUserResponse.ts#L20-L22',
2083-
'security.disable_user_profile.Request': 'security/disable_user_profile/Request.ts#L23-L45',
2083+
'security.disable_user_profile.Request': 'security/disable_user_profile/Request.ts#L24-L47',
20842084
'security.disable_user_profile.Response': 'security/disable_user_profile/Response.ts#L22-L24',
20852085
'security.enable_user.Request': 'security/enable_user/SecurityEnableUserRequest.ts#L23-L35',
20862086
'security.enable_user.Response': 'security/enable_user/SecurityEnableUserResponse.ts#L20-L22',
2087-
'security.enable_user_profile.Request': 'security/enable_user_profile/Request.ts#L23-L45',
2087+
'security.enable_user_profile.Request': 'security/enable_user_profile/Request.ts#L24-L47',
20882088
'security.enable_user_profile.Response': 'security/enable_user_profile/Response.ts#L22-L24',
20892089
'security.enroll_kibana.Request': 'security/enroll_kibana/Request.ts#L22-L28',
20902090
'security.enroll_kibana.Response': 'security/enroll_kibana/Response.ts#L20-L25',
@@ -2122,7 +2122,7 @@
21222122
'security.get_user.Response': 'security/get_user/SecurityGetUserResponse.ts#L23-L25',
21232123
'security.get_user_privileges.Request': 'security/get_user_privileges/SecurityGetUserPrivilegesRequest.ts#L23-L36',
21242124
'security.get_user_privileges.Response': 'security/get_user_privileges/SecurityGetUserPrivilegesResponse.ts#L26-L37',
2125-
'security.get_user_profile.Request': 'security/get_user_profile/Request.ts#L22-L44',
2125+
'security.get_user_profile.Request': 'security/get_user_profile/Request.ts#L23-L46',
21262126
'security.get_user_profile.Response': 'security/get_user_profile/Response.ts#L23-L25',
21272127
'security.grant_api_key.ApiKeyGrantType': 'security/grant_api_key/types.ts#L31-L34',
21282128
'security.grant_api_key.GrantApiKey': 'security/grant_api_key/types.ts#L25-L29',
@@ -2132,6 +2132,9 @@
21322132
'security.has_privileges.IndexPrivilegesCheck': 'security/has_privileges/types.ts#L33-L44',
21332133
'security.has_privileges.Request': 'security/has_privileges/SecurityHasPrivilegesRequest.ts#L25-L42',
21342134
'security.has_privileges.Response': 'security/has_privileges/SecurityHasPrivilegesResponse.ts#L24-L32',
2135+
'security.has_privileges_user_profile.PrivilegesCheck': 'security/has_privileges_user_profile/types.ts#L26-L33',
2136+
'security.has_privileges_user_profile.Request': 'security/has_privileges_user_profile/Request.ts#L24-L38',
2137+
'security.has_privileges_user_profile.Response': 'security/has_privileges_user_profile/Response.ts#L22-L37',
21352138
'security.invalidate_api_key.Request': 'security/invalidate_api_key/SecurityInvalidateApiKeyRequest.ts#L23-L37',
21362139
'security.invalidate_api_key.Response': 'security/invalidate_api_key/SecurityInvalidateApiKeyResponse.ts#L23-L30',
21372140
'security.invalidate_token.Request': 'security/invalidate_token/SecurityInvalidateTokenRequest.ts#L23-L35',
@@ -2159,10 +2162,11 @@
21592162
'security.saml_prepare_authentication.Response': 'security/saml_prepare_authentication/Response.ts#L22-L28',
21602163
'security.saml_service_provider_metadata.Request': 'security/saml_service_provider_metadata/Request.ts#L23-L34',
21612164
'security.saml_service_provider_metadata.Response': 'security/saml_service_provider_metadata/Response.ts#L20-L24',
2162-
'security.suggest_user_profiles.Request': 'security/suggest_user_profiles/Request.ts#L23-L51',
2165+
'security.suggest_user_profiles.Hint': 'security/suggest_user_profiles/types.ts#L23-L34',
2166+
'security.suggest_user_profiles.Request': 'security/suggest_user_profiles/Request.ts#L24-L66',
21632167
'security.suggest_user_profiles.Response': 'security/suggest_user_profiles/Response.ts#L29-L35',
21642168
'security.suggest_user_profiles.TotalUserProfiles': 'security/suggest_user_profiles/Response.ts#L24-L27',
2165-
'security.update_user_profile_data.Request': 'security/update_user_profile_data/Request.ts#L26-L68',
2169+
'security.update_user_profile_data.Request': 'security/update_user_profile_data/Request.ts#L27-L70',
21662170
'security.update_user_profile_data.Response': 'security/update_user_profile_data/Response.ts#L22-L24',
21672171
'shutdown._types.Type': 'shutdown/_types/types.ts#L20-L24',
21682172
'shutdown.delete_node.Request': 'shutdown/delete_node/ShutdownDeleteNodeRequest.ts#L24-L45',
@@ -2505,10 +2509,10 @@
25052509
if (hash.length > 1) {
25062510
hash = hash.substring(1);
25072511
}
2508-
window.location = "https://github.com/elastic/elasticsearch-specification/tree/679f9a5c53c5b764fe02ebba39d9b94b94634684/specification/" + (paths[hash] || "");
2512+
window.location = "https://github.com/elastic/elasticsearch-specification/tree/135ae054e304239743b5777ad8d41cb2c9091d35/specification/" + (paths[hash] || "");
25092513
</script>
25102514
</head>
25112515
<body>
2512-
Please see the <a href="https://github.com/elastic/elasticsearch-specification/tree/679f9a5c53c5b764fe02ebba39d9b94b94634684/specification/">Elasticsearch API specification</a>.
2516+
Please see the <a href="https://github.com/elastic/elasticsearch-specification/tree/135ae054e304239743b5777ad8d41cb2c9091d35/specification/">Elasticsearch API specification</a>.
25132517
</body>
25142518
</html>

java-client/src/main/java/co/elastic/clients/elasticsearch/security/ClusterPrivilege.java

+2
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ public enum ClusterPrivilege implements JsonEnum {
8181

8282
ManageTransform("manage_transform"),
8383

84+
ManageUserProfile("manage_user_profile"),
85+
8486
ManageWatcher("manage_watcher"),
8587

8688
Monitor("monitor"),

java-client/src/main/java/co/elastic/clients/elasticsearch/security/CreateServiceTokenRequest.java

+53-9
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
package co.elastic.clients.elasticsearch.security;
2525

2626
import co.elastic.clients.elasticsearch._types.ErrorResponse;
27+
import co.elastic.clients.elasticsearch._types.Refresh;
2728
import co.elastic.clients.elasticsearch._types.RequestBase;
2829
import co.elastic.clients.json.JsonpDeserializable;
2930
import co.elastic.clients.json.JsonpDeserializer;
@@ -36,15 +37,16 @@
3637
import co.elastic.clients.util.ObjectBuilderBase;
3738
import jakarta.json.stream.JsonGenerator;
3839
import java.lang.String;
39-
import java.util.Collections;
40+
import java.util.HashMap;
41+
import java.util.Map;
4042
import java.util.Objects;
4143
import java.util.function.Function;
4244
import javax.annotation.Nullable;
4345

4446
// typedef: security.create_service_token.Request
4547

4648
/**
47-
* Creates a service account token for access without requiring basic
49+
* Creates a service accounts token for access without requiring basic
4850
* authentication.
4951
*
5052
* @see <a href=
@@ -53,18 +55,23 @@
5355
*/
5456

5557
public class CreateServiceTokenRequest extends RequestBase {
58+
@Nullable
5659
private final String name;
5760

5861
private final String namespace;
5962

63+
@Nullable
64+
private final Refresh refresh;
65+
6066
private final String service;
6167

6268
// ---------------------------------------------------------------------------------------------
6369

6470
private CreateServiceTokenRequest(Builder builder) {
6571

66-
this.name = ApiTypeHelper.requireNonNull(builder.name, this, "name");
72+
this.name = builder.name;
6773
this.namespace = ApiTypeHelper.requireNonNull(builder.namespace, this, "namespace");
74+
this.refresh = builder.refresh;
6875
this.service = ApiTypeHelper.requireNonNull(builder.service, this, "service");
6976

7077
}
@@ -74,10 +81,11 @@ public static CreateServiceTokenRequest of(Function<Builder, ObjectBuilder<Creat
7481
}
7582

7683
/**
77-
* Required - An identifier for the token name
84+
* An identifier for the token name
7885
* <p>
7986
* API name: {@code name}
8087
*/
88+
@Nullable
8189
public final String name() {
8290
return this.name;
8391
}
@@ -91,6 +99,19 @@ public final String namespace() {
9199
return this.namespace;
92100
}
93101

102+
/**
103+
* If <code>true</code> then refresh the affected shards to make this operation
104+
* visible to search, if <code>wait_for</code> (the default) then wait for a
105+
* refresh to make this operation visible to search, if <code>false</code> then
106+
* do nothing with refreshes.
107+
* <p>
108+
* API name: {@code refresh}
109+
*/
110+
@Nullable
111+
public final Refresh refresh() {
112+
return this.refresh;
113+
}
114+
94115
/**
95116
* Required - An identifier for the service name
96117
* <p>
@@ -107,18 +128,22 @@ public final String service() {
107128
*/
108129

109130
public static class Builder extends ObjectBuilderBase implements ObjectBuilder<CreateServiceTokenRequest> {
131+
@Nullable
110132
private String name;
111133

112134
private String namespace;
113135

136+
@Nullable
137+
private Refresh refresh;
138+
114139
private String service;
115140

116141
/**
117-
* Required - An identifier for the token name
142+
* An identifier for the token name
118143
* <p>
119144
* API name: {@code name}
120145
*/
121-
public final Builder name(String value) {
146+
public final Builder name(@Nullable String value) {
122147
this.name = value;
123148
return this;
124149
}
@@ -133,6 +158,19 @@ public final Builder namespace(String value) {
133158
return this;
134159
}
135160

161+
/**
162+
* If <code>true</code> then refresh the affected shards to make this operation
163+
* visible to search, if <code>wait_for</code> (the default) then wait for a
164+
* refresh to make this operation visible to search, if <code>false</code> then
165+
* do nothing with refreshes.
166+
* <p>
167+
* API name: {@code refresh}
168+
*/
169+
public final Builder refresh(@Nullable Refresh value) {
170+
this.refresh = value;
171+
return this;
172+
}
173+
136174
/**
137175
* Required - An identifier for the service name
138176
* <p>
@@ -174,7 +212,8 @@ public CreateServiceTokenRequest build() {
174212

175213
propsSet |= _service;
176214
propsSet |= _namespace;
177-
propsSet |= _name;
215+
if (request.name() != null)
216+
propsSet |= _name;
178217

179218
if (propsSet == (_namespace | _service | _name))
180219
return "PUT";
@@ -194,7 +233,8 @@ public CreateServiceTokenRequest build() {
194233

195234
propsSet |= _service;
196235
propsSet |= _namespace;
197-
propsSet |= _name;
236+
if (request.name() != null)
237+
propsSet |= _name;
198238

199239
if (propsSet == (_namespace | _service | _name)) {
200240
StringBuilder buf = new StringBuilder();
@@ -228,7 +268,11 @@ public CreateServiceTokenRequest build() {
228268

229269
// Request parameters
230270
request -> {
231-
return Collections.emptyMap();
271+
Map<String, String> params = new HashMap<>();
272+
if (request.refresh != null) {
273+
params.put("refresh", request.refresh.jsonValue());
274+
}
275+
return params;
232276

233277
}, SimpleEndpoint.emptyMap(), false, CreateServiceTokenResponse._DESERIALIZER);
234278
}

java-client/src/main/java/co/elastic/clients/elasticsearch/security/ElasticsearchSecurityAsyncClient.java

+36
Original file line numberDiff line numberDiff line change
@@ -1256,6 +1256,42 @@ public CompletableFuture<HasPrivilegesResponse> hasPrivileges() {
12561256
HasPrivilegesRequest._ENDPOINT, this.transportOptions);
12571257
}
12581258

1259+
// ----- Endpoint: security.has_privileges_user_profile
1260+
1261+
/**
1262+
* Determines whether the users associated with the specified profile IDs have
1263+
* all the requested privileges.
1264+
*
1265+
* @see <a href=
1266+
* "https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-has-privileges-user-profile.html">Documentation
1267+
* on elastic.co</a>
1268+
*/
1269+
1270+
public CompletableFuture<HasPrivilegesUserProfileResponse> hasPrivilegesUserProfile(
1271+
HasPrivilegesUserProfileRequest request) {
1272+
@SuppressWarnings("unchecked")
1273+
JsonEndpoint<HasPrivilegesUserProfileRequest, HasPrivilegesUserProfileResponse, ErrorResponse> endpoint = (JsonEndpoint<HasPrivilegesUserProfileRequest, HasPrivilegesUserProfileResponse, ErrorResponse>) HasPrivilegesUserProfileRequest._ENDPOINT;
1274+
1275+
return this.transport.performRequestAsync(request, endpoint, this.transportOptions);
1276+
}
1277+
1278+
/**
1279+
* Determines whether the users associated with the specified profile IDs have
1280+
* all the requested privileges.
1281+
*
1282+
* @param fn
1283+
* a function that initializes a builder to create the
1284+
* {@link HasPrivilegesUserProfileRequest}
1285+
* @see <a href=
1286+
* "https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-has-privileges-user-profile.html">Documentation
1287+
* on elastic.co</a>
1288+
*/
1289+
1290+
public final CompletableFuture<HasPrivilegesUserProfileResponse> hasPrivilegesUserProfile(
1291+
Function<HasPrivilegesUserProfileRequest.Builder, ObjectBuilder<HasPrivilegesUserProfileRequest>> fn) {
1292+
return hasPrivilegesUserProfile(fn.apply(new HasPrivilegesUserProfileRequest.Builder()).build());
1293+
}
1294+
12591295
// ----- Endpoint: security.invalidate_api_key
12601296

12611297
/**

java-client/src/main/java/co/elastic/clients/elasticsearch/security/ElasticsearchSecurityClient.java

+37
Original file line numberDiff line numberDiff line change
@@ -1294,6 +1294,43 @@ public HasPrivilegesResponse hasPrivileges() throws IOException, ElasticsearchEx
12941294
this.transportOptions);
12951295
}
12961296

1297+
// ----- Endpoint: security.has_privileges_user_profile
1298+
1299+
/**
1300+
* Determines whether the users associated with the specified profile IDs have
1301+
* all the requested privileges.
1302+
*
1303+
* @see <a href=
1304+
* "https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-has-privileges-user-profile.html">Documentation
1305+
* on elastic.co</a>
1306+
*/
1307+
1308+
public HasPrivilegesUserProfileResponse hasPrivilegesUserProfile(HasPrivilegesUserProfileRequest request)
1309+
throws IOException, ElasticsearchException {
1310+
@SuppressWarnings("unchecked")
1311+
JsonEndpoint<HasPrivilegesUserProfileRequest, HasPrivilegesUserProfileResponse, ErrorResponse> endpoint = (JsonEndpoint<HasPrivilegesUserProfileRequest, HasPrivilegesUserProfileResponse, ErrorResponse>) HasPrivilegesUserProfileRequest._ENDPOINT;
1312+
1313+
return this.transport.performRequest(request, endpoint, this.transportOptions);
1314+
}
1315+
1316+
/**
1317+
* Determines whether the users associated with the specified profile IDs have
1318+
* all the requested privileges.
1319+
*
1320+
* @param fn
1321+
* a function that initializes a builder to create the
1322+
* {@link HasPrivilegesUserProfileRequest}
1323+
* @see <a href=
1324+
* "https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-has-privileges-user-profile.html">Documentation
1325+
* on elastic.co</a>
1326+
*/
1327+
1328+
public final HasPrivilegesUserProfileResponse hasPrivilegesUserProfile(
1329+
Function<HasPrivilegesUserProfileRequest.Builder, ObjectBuilder<HasPrivilegesUserProfileRequest>> fn)
1330+
throws IOException, ElasticsearchException {
1331+
return hasPrivilegesUserProfile(fn.apply(new HasPrivilegesUserProfileRequest.Builder()).build());
1332+
}
1333+
12971334
// ----- Endpoint: security.invalidate_api_key
12981335

12991336
/**

0 commit comments

Comments
 (0)