|
20 | 20 | import org.elasticsearch.client.security.ClearRolesCacheRequest;
|
21 | 21 | import org.elasticsearch.client.security.ClearRolesCacheResponse;
|
22 | 22 | import org.elasticsearch.client.security.ClearSecurityCacheResponse;
|
| 23 | +import org.elasticsearch.client.security.ClearServiceAccountTokenCacheRequest; |
23 | 24 | import org.elasticsearch.client.security.CreateApiKeyRequest;
|
24 | 25 | import org.elasticsearch.client.security.CreateApiKeyResponse;
|
| 26 | +import org.elasticsearch.client.security.CreateServiceAccountTokenRequest; |
| 27 | +import org.elasticsearch.client.security.CreateServiceAccountTokenResponse; |
25 | 28 | import org.elasticsearch.client.security.CreateTokenRequest;
|
26 | 29 | import org.elasticsearch.client.security.CreateTokenResponse;
|
27 | 30 | import org.elasticsearch.client.security.DelegatePkiAuthenticationRequest;
|
|
32 | 35 | import org.elasticsearch.client.security.DeleteRoleMappingResponse;
|
33 | 36 | import org.elasticsearch.client.security.DeleteRoleRequest;
|
34 | 37 | import org.elasticsearch.client.security.DeleteRoleResponse;
|
| 38 | +import org.elasticsearch.client.security.DeleteServiceAccountTokenRequest; |
| 39 | +import org.elasticsearch.client.security.DeleteServiceAccountTokenResponse; |
35 | 40 | import org.elasticsearch.client.security.DeleteUserRequest;
|
36 | 41 | import org.elasticsearch.client.security.DeleteUserResponse;
|
37 | 42 | import org.elasticsearch.client.security.DisableUserRequest;
|
|
46 | 51 | import org.elasticsearch.client.security.GetRoleMappingsResponse;
|
47 | 52 | import org.elasticsearch.client.security.GetRolesRequest;
|
48 | 53 | import org.elasticsearch.client.security.GetRolesResponse;
|
| 54 | +import org.elasticsearch.client.security.GetServiceAccountCredentialsRequest; |
| 55 | +import org.elasticsearch.client.security.GetServiceAccountCredentialsResponse; |
| 56 | +import org.elasticsearch.client.security.GetServiceAccountsRequest; |
| 57 | +import org.elasticsearch.client.security.GetServiceAccountsResponse; |
49 | 58 | import org.elasticsearch.client.security.GetSslCertificatesRequest;
|
50 | 59 | import org.elasticsearch.client.security.GetSslCertificatesResponse;
|
51 | 60 | import org.elasticsearch.client.security.GetUserPrivilegesRequest;
|
@@ -569,6 +578,38 @@ public Cancellable clearApiKeyCacheAsync(ClearApiKeyCacheRequest request, Reques
|
569 | 578 | ClearSecurityCacheResponse::fromXContent, listener, emptySet());
|
570 | 579 | }
|
571 | 580 |
|
| 581 | + /** |
| 582 | + * Clears the service account token cache for the specified namespace, service-name and list of token names. |
| 583 | + * See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-clear-service-token-cache.html"> |
| 584 | + * the docs</a> for more. |
| 585 | + * |
| 586 | + * @param request the request with namespace, service-name and token names for the service account tokens |
| 587 | + * that should be cleared from the cache. |
| 588 | + * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized |
| 589 | + * @return the response from the clear security cache call |
| 590 | + * @throws IOException in case there is a problem sending the request or parsing back the response |
| 591 | + */public ClearSecurityCacheResponse clearServiceAccountTokenCache(ClearServiceAccountTokenCacheRequest request, |
| 592 | + RequestOptions options) throws IOException { |
| 593 | + return restHighLevelClient.performRequestAndParseEntity(request, SecurityRequestConverters::clearServiceAccountTokenCache, |
| 594 | + options, ClearSecurityCacheResponse::fromXContent, emptySet()); |
| 595 | + } |
| 596 | + |
| 597 | + /** |
| 598 | + * Clears the service account token cache for the specified namespace, service-name and list of token names asynchronously. |
| 599 | + * See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-clear-service-token-cache.html"> |
| 600 | + * the docs</a> for more. |
| 601 | + * |
| 602 | + * @param request the request with namespace, service-name and token names for the service account tokens |
| 603 | + * that should be cleared from the cache. |
| 604 | + * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized |
| 605 | + * @param listener the listener to be notified upon request completion |
| 606 | + * @return cancellable that may be used to cancel the request |
| 607 | + */public Cancellable clearServiceAccountTokenCacheAsync(ClearServiceAccountTokenCacheRequest request, RequestOptions options, |
| 608 | + ActionListener<ClearSecurityCacheResponse> listener) { |
| 609 | + return restHighLevelClient.performRequestAsyncAndParseEntity(request, SecurityRequestConverters::clearServiceAccountTokenCache, |
| 610 | + options, ClearSecurityCacheResponse::fromXContent, listener, emptySet()); |
| 611 | + } |
| 612 | + |
572 | 613 | /**
|
573 | 614 | * Synchronously retrieve the X.509 certificates that are used to encrypt communications in an Elasticsearch cluster.
|
574 | 615 | * See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-ssl.html">
|
@@ -1098,6 +1139,131 @@ public Cancellable grantApiKeyAsync(final GrantApiKeyRequest request, final Requ
|
1098 | 1139 | CreateApiKeyResponse::fromXContent, listener, emptySet());
|
1099 | 1140 | }
|
1100 | 1141 |
|
| 1142 | + /** |
| 1143 | + * Get a service account, or list of service accounts synchronously. |
| 1144 | + * See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-get-service-accounts.html"> |
| 1145 | + * the docs</a> for more information. |
| 1146 | + * @param request the request with namespace and service-name |
| 1147 | + * @param options the request options (e.g., headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized |
| 1148 | + * @return the response from the get service accounts call |
| 1149 | + * @throws IOException in case there is a problem sending the request or parsing back the response |
| 1150 | + */ |
| 1151 | + public GetServiceAccountsResponse getServiceAccounts(GetServiceAccountsRequest request, RequestOptions options) throws IOException { |
| 1152 | + return restHighLevelClient.performRequestAndParseEntity(request, SecurityRequestConverters::getServiceAccounts, options, |
| 1153 | + GetServiceAccountsResponse::fromXContent, emptySet()); |
| 1154 | + } |
| 1155 | + |
| 1156 | + /** |
| 1157 | + * Get a service account, or list of service accounts asynchronously. |
| 1158 | + * See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-get-service-accounts.html"> |
| 1159 | + * the docs</a> for more information. |
| 1160 | + * @param request the request with namespace and service-name |
| 1161 | + * @param options the request options (e.g., headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized |
| 1162 | + * @param listener the listener to be notified upon request completion |
| 1163 | + * @return cancellable that may be used to cancel the request |
| 1164 | + */ |
| 1165 | + public Cancellable getServiceAccountsAsync(GetServiceAccountsRequest request, RequestOptions options, |
| 1166 | + ActionListener<GetServiceAccountsResponse> listener) { |
| 1167 | + return restHighLevelClient.performRequestAsyncAndParseEntity(request, SecurityRequestConverters::getServiceAccounts, options, |
| 1168 | + GetServiceAccountsResponse::fromXContent, listener, emptySet()); |
| 1169 | + } |
| 1170 | + |
| 1171 | + /** |
| 1172 | + * Create a service account token.<br> |
| 1173 | + * See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-create-service-token.html"> |
| 1174 | + * the docs</a> for more. |
| 1175 | + * |
| 1176 | + * @param request the request to create a service account token |
| 1177 | + * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized |
| 1178 | + * @return the response from the create service account token call |
| 1179 | + * @throws IOException in case there is a problem sending the request or parsing back the response |
| 1180 | + */ |
| 1181 | + public CreateServiceAccountTokenResponse createServiceAccountToken(final CreateServiceAccountTokenRequest request, |
| 1182 | + final RequestOptions options) throws IOException { |
| 1183 | + return restHighLevelClient.performRequestAndParseEntity(request, SecurityRequestConverters::createServiceAccountToken, options, |
| 1184 | + CreateServiceAccountTokenResponse::fromXContent, emptySet()); |
| 1185 | + } |
| 1186 | + |
| 1187 | + /** |
| 1188 | + * Asynchronously creates a service account token.<br> |
| 1189 | + * See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-create-service-token.html"> |
| 1190 | + * the docs</a> for more. |
| 1191 | + * |
| 1192 | + * @param request the request to create a service account token |
| 1193 | + * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized |
| 1194 | + * @param listener the listener to be notified upon request completion |
| 1195 | + * @return cancellable that may be used to cancel the request |
| 1196 | + */ |
| 1197 | + public Cancellable createServiceAccountTokenAsync(final CreateServiceAccountTokenRequest request, |
| 1198 | + final RequestOptions options, |
| 1199 | + final ActionListener<CreateServiceAccountTokenResponse> listener) { |
| 1200 | + return restHighLevelClient.performRequestAsyncAndParseEntity(request, SecurityRequestConverters::createServiceAccountToken, options, |
| 1201 | + CreateServiceAccountTokenResponse::fromXContent, listener, emptySet()); |
| 1202 | + } |
| 1203 | + |
| 1204 | + /** |
| 1205 | + * Delete a service account token.<br> |
| 1206 | + * See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-delete-service-token.html"> |
| 1207 | + * the docs</a> for more. |
| 1208 | + * |
| 1209 | + * @param request the request to delete a service account token |
| 1210 | + * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized |
| 1211 | + * @return the response from the create service account token call |
| 1212 | + * @throws IOException in case there is a problem sending the request or parsing back the response |
| 1213 | + */ |
| 1214 | + public DeleteServiceAccountTokenResponse deleteServiceAccountToken(final DeleteServiceAccountTokenRequest request, |
| 1215 | + final RequestOptions options) throws IOException { |
| 1216 | + return restHighLevelClient.performRequestAndParseEntity(request, SecurityRequestConverters::deleteServiceAccountToken, options, |
| 1217 | + DeleteServiceAccountTokenResponse::fromXContent, emptySet()); |
| 1218 | + } |
| 1219 | + |
| 1220 | + /** |
| 1221 | + * Asynchronously deletes a service account token.<br> |
| 1222 | + * See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-delete-service-token.html"> |
| 1223 | + * the docs</a> for more. |
| 1224 | + * |
| 1225 | + * @param request the request to delete a service account token |
| 1226 | + * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized |
| 1227 | + * @param listener the listener to be notified upon request completion |
| 1228 | + * @return cancellable that may be used to cancel the request |
| 1229 | + */ |
| 1230 | + public Cancellable deleteServiceAccountTokenAsync(final DeleteServiceAccountTokenRequest request, |
| 1231 | + final RequestOptions options, |
| 1232 | + final ActionListener<DeleteServiceAccountTokenResponse> listener) { |
| 1233 | + return restHighLevelClient.performRequestAsyncAndParseEntity(request, SecurityRequestConverters::deleteServiceAccountToken, options, |
| 1234 | + DeleteServiceAccountTokenResponse::fromXContent, listener, emptySet()); |
| 1235 | + } |
| 1236 | + |
| 1237 | + /** |
| 1238 | + * Get credentials for a service account synchronously. |
| 1239 | + * See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-get-service-credentails.html"> |
| 1240 | + * the docs</a> for more information. |
| 1241 | + * @param request the request with namespace and service-name |
| 1242 | + * @param options the request options (e.g., headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized |
| 1243 | + * @return the response from the get service accounts call |
| 1244 | + * @throws IOException in case there is a problem sending the request or parsing back the response |
| 1245 | + */ |
| 1246 | + public GetServiceAccountCredentialsResponse getServiceAccountCredentials(GetServiceAccountCredentialsRequest request, |
| 1247 | + RequestOptions options) throws IOException { |
| 1248 | + return restHighLevelClient.performRequestAndParseEntity(request, SecurityRequestConverters::getServiceAccountCredentials, |
| 1249 | + options, GetServiceAccountCredentialsResponse::fromXContent, emptySet()); |
| 1250 | + } |
| 1251 | + |
| 1252 | + /** |
| 1253 | + * Get credentials for a service account asynchronously. |
| 1254 | + * See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-get-service-credentails.html"> |
| 1255 | + * the docs</a> for more information. |
| 1256 | + * @param request the request with namespace and service-name |
| 1257 | + * @param options the request options (e.g., headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized |
| 1258 | + * @param listener the listener to be notified upon request completion |
| 1259 | + * @return cancellable that may be used to cancel the request |
| 1260 | + */ |
| 1261 | + public Cancellable getServiceAccountCredentialsAsync(GetServiceAccountCredentialsRequest request, RequestOptions options, |
| 1262 | + ActionListener<GetServiceAccountCredentialsResponse> listener) { |
| 1263 | + return restHighLevelClient.performRequestAsyncAndParseEntity(request, SecurityRequestConverters::getServiceAccountCredentials, |
| 1264 | + options, GetServiceAccountCredentialsResponse::fromXContent, listener, emptySet()); |
| 1265 | + } |
| 1266 | + |
1101 | 1267 | /**
|
1102 | 1268 | * Get an Elasticsearch access token from an {@code X509Certificate} chain. The certificate chain is that of the client from a mutually
|
1103 | 1269 | * authenticated TLS session, and it is validated by the PKI realms with {@code delegation.enabled} toggled to {@code true}.<br>
|
|
0 commit comments