Skip to content

Commit ca8b65f

Browse files
github-actions[bot]flobernd
andauthoredAug 27, 2024··
Add support for Security APIs (#8315) (#8316)
Co-authored-by: Florian Bernd <[email protected]>
1 parent 887c8f8 commit ca8b65f

File tree

336 files changed

+45513
-1
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

336 files changed

+45513
-1
lines changed
 

Diff for: ‎src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/ApiUrlLookup.g.cs

+47
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,53 @@ internal static class ApiUrlLookup
216216
internal static ApiUrls QueryRulesListRulesets = new ApiUrls(new[] { "_query_rules" });
217217
internal static ApiUrls QueryRulesPutRule = new ApiUrls(new[] { "_query_rules/{ruleset_id}/_rule/{rule_id}" });
218218
internal static ApiUrls QueryRulesPutRuleset = new ApiUrls(new[] { "_query_rules/{ruleset_id}" });
219+
internal static ApiUrls SecurityActivateUserProfile = new ApiUrls(new[] { "_security/profile/_activate" });
220+
internal static ApiUrls SecurityAuthenticate = new ApiUrls(new[] { "_security/_authenticate" });
221+
internal static ApiUrls SecurityBulkDeleteRole = new ApiUrls(new[] { "_security/role" });
222+
internal static ApiUrls SecurityBulkPutRole = new ApiUrls(new[] { "_security/role" });
223+
internal static ApiUrls SecurityClearApiKeyCache = new ApiUrls(new[] { "_security/api_key/{ids}/_clear_cache" });
224+
internal static ApiUrls SecurityClearCachedPrivileges = new ApiUrls(new[] { "_security/privilege/{application}/_clear_cache" });
225+
internal static ApiUrls SecurityClearCachedRealms = new ApiUrls(new[] { "_security/realm/{realms}/_clear_cache" });
226+
internal static ApiUrls SecurityClearCachedRoles = new ApiUrls(new[] { "_security/role/{name}/_clear_cache" });
227+
internal static ApiUrls SecurityClearCachedServiceTokens = new ApiUrls(new[] { "_security/service/{namespace}/{service}/credential/token/{name}/_clear_cache" });
228+
internal static ApiUrls SecurityCreateApiKey = new ApiUrls(new[] { "_security/api_key" });
229+
internal static ApiUrls SecurityCreateServiceToken = new ApiUrls(new[] { "_security/service/{namespace}/{service}/credential/token/{name}", "_security/service/{namespace}/{service}/credential/token" });
230+
internal static ApiUrls SecurityDeletePrivileges = new ApiUrls(new[] { "_security/privilege/{application}/{name}" });
231+
internal static ApiUrls SecurityDeleteRole = new ApiUrls(new[] { "_security/role/{name}" });
232+
internal static ApiUrls SecurityDeleteRoleMapping = new ApiUrls(new[] { "_security/role_mapping/{name}" });
233+
internal static ApiUrls SecurityDeleteServiceToken = new ApiUrls(new[] { "_security/service/{namespace}/{service}/credential/token/{name}" });
234+
internal static ApiUrls SecurityDisableUserProfile = new ApiUrls(new[] { "_security/profile/{uid}/_disable" });
235+
internal static ApiUrls SecurityEnableUserProfile = new ApiUrls(new[] { "_security/profile/{uid}/_enable" });
236+
internal static ApiUrls SecurityGetApiKey = new ApiUrls(new[] { "_security/api_key" });
237+
internal static ApiUrls SecurityGetBuiltinPrivileges = new ApiUrls(new[] { "_security/privilege/_builtin" });
238+
internal static ApiUrls SecurityGetPrivileges = new ApiUrls(new[] { "_security/privilege", "_security/privilege/{application}", "_security/privilege/{application}/{name}" });
239+
internal static ApiUrls SecurityGetRole = new ApiUrls(new[] { "_security/role/{name}", "_security/role" });
240+
internal static ApiUrls SecurityGetRoleMapping = new ApiUrls(new[] { "_security/role_mapping/{name}", "_security/role_mapping" });
241+
internal static ApiUrls SecurityGetServiceAccounts = new ApiUrls(new[] { "_security/service/{namespace}/{service}", "_security/service/{namespace}", "_security/service" });
242+
internal static ApiUrls SecurityGetServiceCredentials = new ApiUrls(new[] { "_security/service/{namespace}/{service}/credential" });
243+
internal static ApiUrls SecurityGetToken = new ApiUrls(new[] { "_security/oauth2/token" });
244+
internal static ApiUrls SecurityGetUserPrivileges = new ApiUrls(new[] { "_security/user/_privileges" });
245+
internal static ApiUrls SecurityGetUserProfile = new ApiUrls(new[] { "_security/profile/{uid}" });
246+
internal static ApiUrls SecurityGrantApiKey = new ApiUrls(new[] { "_security/api_key/grant" });
247+
internal static ApiUrls SecurityHasPrivileges = new ApiUrls(new[] { "_security/user/_has_privileges", "_security/user/{user}/_has_privileges" });
248+
internal static ApiUrls SecurityHasPrivilegesUserProfile = new ApiUrls(new[] { "_security/profile/_has_privileges" });
249+
internal static ApiUrls SecurityInvalidateApiKey = new ApiUrls(new[] { "_security/api_key" });
250+
internal static ApiUrls SecurityInvalidateToken = new ApiUrls(new[] { "_security/oauth2/token" });
251+
internal static ApiUrls SecurityPutPrivileges = new ApiUrls(new[] { "_security/privilege" });
252+
internal static ApiUrls SecurityPutRole = new ApiUrls(new[] { "_security/role/{name}" });
253+
internal static ApiUrls SecurityPutRoleMapping = new ApiUrls(new[] { "_security/role_mapping/{name}" });
254+
internal static ApiUrls SecurityQueryApiKeys = new ApiUrls(new[] { "_security/_query/api_key" });
255+
internal static ApiUrls SecurityQueryRole = new ApiUrls(new[] { "_security/_query/role" });
256+
internal static ApiUrls SecurityQueryUser = new ApiUrls(new[] { "_security/_query/user" });
257+
internal static ApiUrls SecuritySamlAuthenticate = new ApiUrls(new[] { "_security/saml/authenticate" });
258+
internal static ApiUrls SecuritySamlCompleteLogout = new ApiUrls(new[] { "_security/saml/complete_logout" });
259+
internal static ApiUrls SecuritySamlInvalidate = new ApiUrls(new[] { "_security/saml/invalidate" });
260+
internal static ApiUrls SecuritySamlLogout = new ApiUrls(new[] { "_security/saml/logout" });
261+
internal static ApiUrls SecuritySamlPrepareAuthentication = new ApiUrls(new[] { "_security/saml/prepare" });
262+
internal static ApiUrls SecuritySamlServiceProviderMetadata = new ApiUrls(new[] { "_security/saml/metadata/{realm_name}" });
263+
internal static ApiUrls SecuritySuggestUserProfiles = new ApiUrls(new[] { "_security/profile/_suggest" });
264+
internal static ApiUrls SecurityUpdateApiKey = new ApiUrls(new[] { "_security/api_key/{id}" });
265+
internal static ApiUrls SecurityUpdateUserProfileData = new ApiUrls(new[] { "_security/profile/{uid}/_data" });
219266
internal static ApiUrls SnapshotCleanupRepository = new ApiUrls(new[] { "_snapshot/{repository}/_cleanup" });
220267
internal static ApiUrls SnapshotClone = new ApiUrls(new[] { "_snapshot/{repository}/{snapshot}/_clone/{target_snapshot}" });
221268
internal static ApiUrls SnapshotCreate = new ApiUrls(new[] { "_snapshot/{repository}/{snapshot}" });
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
// Licensed to Elasticsearch B.V under one or more agreements.
2+
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
3+
// See the LICENSE file in the project root for more information.
4+
//
5+
// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗
6+
// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝
7+
// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗
8+
// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝
9+
// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗
10+
// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝
11+
// ------------------------------------------------
12+
//
13+
// This file is automatically generated.
14+
// Please do not edit these files manually.
15+
//
16+
// ------------------------------------------------
17+
18+
#nullable restore
19+
20+
using Elastic.Clients.Elasticsearch.Serverless.Fluent;
21+
using Elastic.Clients.Elasticsearch.Serverless.Requests;
22+
using Elastic.Clients.Elasticsearch.Serverless.Serialization;
23+
using Elastic.Transport;
24+
using System;
25+
using System.Collections.Generic;
26+
using System.Linq.Expressions;
27+
using System.Text.Json;
28+
using System.Text.Json.Serialization;
29+
30+
namespace Elastic.Clients.Elasticsearch.Serverless.Security;
31+
32+
public sealed partial class ActivateUserProfileRequestParameters : RequestParameters
33+
{
34+
}
35+
36+
/// <summary>
37+
/// <para>
38+
/// Creates or updates a user profile on behalf of another user.
39+
/// </para>
40+
/// </summary>
41+
public sealed partial class ActivateUserProfileRequest : PlainRequest<ActivateUserProfileRequestParameters>
42+
{
43+
internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityActivateUserProfile;
44+
45+
protected override HttpMethod StaticHttpMethod => HttpMethod.POST;
46+
47+
internal override bool SupportsBody => true;
48+
49+
internal override string OperationName => "security.activate_user_profile";
50+
51+
[JsonInclude, JsonPropertyName("access_token")]
52+
public string? AccessToken { get; set; }
53+
[JsonInclude, JsonPropertyName("grant_type")]
54+
public Elastic.Clients.Elasticsearch.Serverless.Security.GrantType GrantType { get; set; }
55+
[JsonInclude, JsonPropertyName("password")]
56+
public string? Password { get; set; }
57+
[JsonInclude, JsonPropertyName("username")]
58+
public string? Username { get; set; }
59+
}
60+
61+
/// <summary>
62+
/// <para>
63+
/// Creates or updates a user profile on behalf of another user.
64+
/// </para>
65+
/// </summary>
66+
public sealed partial class ActivateUserProfileRequestDescriptor : RequestDescriptor<ActivateUserProfileRequestDescriptor, ActivateUserProfileRequestParameters>
67+
{
68+
internal ActivateUserProfileRequestDescriptor(Action<ActivateUserProfileRequestDescriptor> configure) => configure.Invoke(this);
69+
70+
public ActivateUserProfileRequestDescriptor()
71+
{
72+
}
73+
74+
internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityActivateUserProfile;
75+
76+
protected override HttpMethod StaticHttpMethod => HttpMethod.POST;
77+
78+
internal override bool SupportsBody => true;
79+
80+
internal override string OperationName => "security.activate_user_profile";
81+
82+
private string? AccessTokenValue { get; set; }
83+
private Elastic.Clients.Elasticsearch.Serverless.Security.GrantType GrantTypeValue { get; set; }
84+
private string? PasswordValue { get; set; }
85+
private string? UsernameValue { get; set; }
86+
87+
public ActivateUserProfileRequestDescriptor AccessToken(string? accessToken)
88+
{
89+
AccessTokenValue = accessToken;
90+
return Self;
91+
}
92+
93+
public ActivateUserProfileRequestDescriptor GrantType(Elastic.Clients.Elasticsearch.Serverless.Security.GrantType grantType)
94+
{
95+
GrantTypeValue = grantType;
96+
return Self;
97+
}
98+
99+
public ActivateUserProfileRequestDescriptor Password(string? password)
100+
{
101+
PasswordValue = password;
102+
return Self;
103+
}
104+
105+
public ActivateUserProfileRequestDescriptor Username(string? username)
106+
{
107+
UsernameValue = username;
108+
return Self;
109+
}
110+
111+
protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings)
112+
{
113+
writer.WriteStartObject();
114+
if (!string.IsNullOrEmpty(AccessTokenValue))
115+
{
116+
writer.WritePropertyName("access_token");
117+
writer.WriteStringValue(AccessTokenValue);
118+
}
119+
120+
writer.WritePropertyName("grant_type");
121+
JsonSerializer.Serialize(writer, GrantTypeValue, options);
122+
if (!string.IsNullOrEmpty(PasswordValue))
123+
{
124+
writer.WritePropertyName("password");
125+
writer.WriteStringValue(PasswordValue);
126+
}
127+
128+
if (!string.IsNullOrEmpty(UsernameValue))
129+
{
130+
writer.WritePropertyName("username");
131+
writer.WriteStringValue(UsernameValue);
132+
}
133+
134+
writer.WriteEndObject();
135+
}
136+
}

0 commit comments

Comments
 (0)
Please sign in to comment.