Skip to content

Commit 058f498

Browse files
committed
[API] Adds user profile APIs
1 parent 1533c46 commit 058f498

15 files changed

+724
-11
lines changed
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# Licensed to Elasticsearch B.V. under one or more contributor
2+
# license agreements. See the NOTICE file distributed with
3+
# this work for additional information regarding copyright
4+
# ownership. Elasticsearch B.V. licenses this file to you under
5+
# the Apache License, Version 2.0 (the "License"); you may
6+
# not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
#
18+
# Auto generated from commit f284cc16f4d4b4289bc679aa1529bb504190fe80
19+
# @see https://github.com/elastic/elasticsearch-specification
20+
#
21+
module Elasticsearch
22+
module API
23+
module Security
24+
module Actions
25+
# Activate a user profile.
26+
# Create or update a user profile on behalf of another user.
27+
# NOTE: The user profile feature is designed only for use by Kibana and Elastic's Observability, Enterprise Search, and Elastic Security solutions.
28+
# Individual users and external applications should not call this API directly.
29+
# The calling application must have either an +access_token+ or a combination of +username+ and +password+ for the user that the profile document is intended for.
30+
# Elastic reserves the right to change or remove this feature in future releases without prior notice.
31+
# This API creates or updates a profile document for end users with information that is extracted from the user's authentication object including +username+, +full_name,+ +roles+, and the authentication realm.
32+
# For example, in the JWT +access_token+ case, the profile user's +username+ is extracted from the JWT token claim pointed to by the +claims.principal+ setting of the JWT realm that authenticated the token.
33+
# When updating a profile document, the API enables the document if it was disabled.
34+
# Any updates do not change existing content for either the +labels+ or +data+ fields.
35+
#
36+
# @option arguments [Hash] :headers Custom HTTP headers
37+
# @option arguments [Hash] :body request body
38+
#
39+
# @see https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-security-activate-user-profile
40+
#
41+
def activate_user_profile(arguments = {})
42+
request_opts = { endpoint: arguments[:endpoint] || 'security.activate_user_profile' }
43+
44+
raise ArgumentError, "Required argument 'body' missing" unless arguments[:body]
45+
46+
arguments = arguments.clone
47+
headers = arguments.delete(:headers) || {}
48+
49+
body = arguments.delete(:body)
50+
51+
method = Elasticsearch::API::HTTP_POST
52+
path = '_security/profile/_activate'
53+
params = {}
54+
55+
Elasticsearch::API::Response.new(
56+
perform_request(method, path, params, body, headers, request_opts)
57+
)
58+
end
59+
end
60+
end
61+
end
62+
end
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# Licensed to Elasticsearch B.V. under one or more contributor
2+
# license agreements. See the NOTICE file distributed with
3+
# this work for additional information regarding copyright
4+
# ownership. Elasticsearch B.V. licenses this file to you under
5+
# the Apache License, Version 2.0 (the "License"); you may
6+
# not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
#
18+
# Auto generated from commit f284cc16f4d4b4289bc679aa1529bb504190fe80
19+
# @see https://github.com/elastic/elasticsearch-specification
20+
#
21+
module Elasticsearch
22+
module API
23+
module Security
24+
module Actions
25+
# Disable a user profile.
26+
# Disable user profiles so that they are not visible in user profile searches.
27+
# NOTE: The user profile feature is designed only for use by Kibana and Elastic's Observability, Enterprise Search, and Elastic Security solutions.
28+
# Individual users and external applications should not call this API directly.
29+
# Elastic reserves the right to change or remove this feature in future releases without prior notice.
30+
# When you activate a user profile, its automatically enabled and visible in user profile searches. You can use the disable user profile API to disable a user profile so it’s not visible in these searches.
31+
# To re-enable a disabled user profile, use the enable user profile API .
32+
#
33+
# @option arguments [String] :uid Unique identifier for the user profile. (*Required*)
34+
# @option arguments [String] :refresh If 'true', Elasticsearch refreshes the affected shards to make this operation visible to search.
35+
# If 'wait_for', it waits for a refresh to make this operation visible to search.
36+
# If 'false', it does nothing with refreshes. Server default: false.
37+
# @option arguments [Hash] :headers Custom HTTP headers
38+
#
39+
# @see https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-security-disable-user-profile
40+
#
41+
def disable_user_profile(arguments = {})
42+
request_opts = { endpoint: arguments[:endpoint] || 'security.disable_user_profile' }
43+
44+
defined_params = [:uid].each_with_object({}) do |variable, set_variables|
45+
set_variables[variable] = arguments[variable] if arguments.key?(variable)
46+
end
47+
request_opts[:defined_params] = defined_params unless defined_params.empty?
48+
49+
raise ArgumentError, "Required argument 'uid' missing" unless arguments[:uid]
50+
51+
arguments = arguments.clone
52+
headers = arguments.delete(:headers) || {}
53+
54+
body = nil
55+
56+
_uid = arguments.delete(:uid)
57+
58+
method = Elasticsearch::API::HTTP_PUT
59+
path = "_security/profile/#{Utils.listify(_uid)}/_disable"
60+
params = Utils.process_params(arguments)
61+
62+
Elasticsearch::API::Response.new(
63+
perform_request(method, path, params, body, headers, request_opts)
64+
)
65+
end
66+
end
67+
end
68+
end
69+
end
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# Licensed to Elasticsearch B.V. under one or more contributor
2+
# license agreements. See the NOTICE file distributed with
3+
# this work for additional information regarding copyright
4+
# ownership. Elasticsearch B.V. licenses this file to you under
5+
# the Apache License, Version 2.0 (the "License"); you may
6+
# not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
#
18+
# Auto generated from commit f284cc16f4d4b4289bc679aa1529bb504190fe80
19+
# @see https://github.com/elastic/elasticsearch-specification
20+
#
21+
module Elasticsearch
22+
module API
23+
module Security
24+
module Actions
25+
# Enable a user profile.
26+
# Enable user profiles to make them visible in user profile searches.
27+
# NOTE: The user profile feature is designed only for use by Kibana and Elastic's Observability, Enterprise Search, and Elastic Security solutions.
28+
# Individual users and external applications should not call this API directly.
29+
# Elastic reserves the right to change or remove this feature in future releases without prior notice.
30+
# When you activate a user profile, it's automatically enabled and visible in user profile searches.
31+
# If you later disable the user profile, you can use the enable user profile API to make the profile visible in these searches again.
32+
#
33+
# @option arguments [String] :uid A unique identifier for the user profile. (*Required*)
34+
# @option arguments [String] :refresh If 'true', Elasticsearch refreshes the affected shards to make this operation
35+
# visible to search.
36+
# If 'wait_for', it waits for a refresh to make this operation visible to search.
37+
# If 'false', nothing is done with refreshes. Server default: false.
38+
# @option arguments [Hash] :headers Custom HTTP headers
39+
#
40+
# @see https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-security-enable-user-profile
41+
#
42+
def enable_user_profile(arguments = {})
43+
request_opts = { endpoint: arguments[:endpoint] || 'security.enable_user_profile' }
44+
45+
defined_params = [:uid].each_with_object({}) do |variable, set_variables|
46+
set_variables[variable] = arguments[variable] if arguments.key?(variable)
47+
end
48+
request_opts[:defined_params] = defined_params unless defined_params.empty?
49+
50+
raise ArgumentError, "Required argument 'uid' missing" unless arguments[:uid]
51+
52+
arguments = arguments.clone
53+
headers = arguments.delete(:headers) || {}
54+
55+
body = nil
56+
57+
_uid = arguments.delete(:uid)
58+
59+
method = Elasticsearch::API::HTTP_PUT
60+
path = "_security/profile/#{Utils.listify(_uid)}/_enable"
61+
params = Utils.process_params(arguments)
62+
63+
Elasticsearch::API::Response.new(
64+
perform_request(method, path, params, body, headers, request_opts)
65+
)
66+
end
67+
end
68+
end
69+
end
70+
end
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# Licensed to Elasticsearch B.V. under one or more contributor
2+
# license agreements. See the NOTICE file distributed with
3+
# this work for additional information regarding copyright
4+
# ownership. Elasticsearch B.V. licenses this file to you under
5+
# the Apache License, Version 2.0 (the "License"); you may
6+
# not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
#
18+
# Auto generated from commit f284cc16f4d4b4289bc679aa1529bb504190fe80
19+
# @see https://github.com/elastic/elasticsearch-specification
20+
#
21+
module Elasticsearch
22+
module API
23+
module Security
24+
module Actions
25+
# Get a user profile.
26+
# Get a user's profile using the unique profile ID.
27+
# NOTE: The user profile feature is designed only for use by Kibana and Elastic's Observability, Enterprise Search, and Elastic Security solutions.
28+
# Individual users and external applications should not call this API directly.
29+
# Elastic reserves the right to change or remove this feature in future releases without prior notice.
30+
#
31+
# @option arguments [Userprofileid] :uid A unique identifier for the user profile. (*Required*)
32+
# @option arguments [String] :data A comma-separated list of filters for the +data+ field of the profile document.
33+
# To return all content use +data=*+.
34+
# To return a subset of content use +data=<key>+ to retrieve content nested under the specified +<key>+.
35+
# By default returns no +data+ content.
36+
# @option arguments [Hash] :headers Custom HTTP headers
37+
#
38+
# @see https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-security-get-user-profile
39+
#
40+
def get_user_profile(arguments = {})
41+
request_opts = { endpoint: arguments[:endpoint] || 'security.get_user_profile' }
42+
43+
defined_params = [:uid].each_with_object({}) do |variable, set_variables|
44+
set_variables[variable] = arguments[variable] if arguments.key?(variable)
45+
end
46+
request_opts[:defined_params] = defined_params unless defined_params.empty?
47+
48+
raise ArgumentError, "Required argument 'uid' missing" unless arguments[:uid]
49+
50+
arguments = arguments.clone
51+
headers = arguments.delete(:headers) || {}
52+
53+
body = nil
54+
55+
_uid = arguments.delete(:uid)
56+
57+
method = Elasticsearch::API::HTTP_GET
58+
path = "_security/profile/#{Utils.listify(_uid)}"
59+
params = Utils.process_params(arguments)
60+
61+
Elasticsearch::API::Response.new(
62+
perform_request(method, path, params, body, headers, request_opts)
63+
)
64+
end
65+
end
66+
end
67+
end
68+
end
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# Licensed to Elasticsearch B.V. under one or more contributor
2+
# license agreements. See the NOTICE file distributed with
3+
# this work for additional information regarding copyright
4+
# ownership. Elasticsearch B.V. licenses this file to you under
5+
# the Apache License, Version 2.0 (the "License"); you may
6+
# not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
#
18+
# Auto generated from commit f284cc16f4d4b4289bc679aa1529bb504190fe80
19+
# @see https://github.com/elastic/elasticsearch-specification
20+
#
21+
module Elasticsearch
22+
module API
23+
module Security
24+
module Actions
25+
# Check user profile privileges.
26+
# Determine whether the users associated with the specified user profile IDs have all the requested privileges.
27+
# NOTE: The user profile feature is designed only for use by Kibana and Elastic's Observability, Enterprise Search, and Elastic Security solutions. Individual users and external applications should not call this API directly.
28+
# Elastic reserves the right to change or remove this feature in future releases without prior notice.
29+
#
30+
# @option arguments [Hash] :headers Custom HTTP headers
31+
# @option arguments [Hash] :body request body
32+
#
33+
# @see https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-security-has-privileges-user-profile
34+
#
35+
def has_privileges_user_profile(arguments = {})
36+
request_opts = { endpoint: arguments[:endpoint] || 'security.has_privileges_user_profile' }
37+
38+
raise ArgumentError, "Required argument 'body' missing" unless arguments[:body]
39+
40+
arguments = arguments.clone
41+
headers = arguments.delete(:headers) || {}
42+
43+
body = arguments.delete(:body)
44+
45+
method = Elasticsearch::API::HTTP_POST
46+
path = '_security/profile/_has_privileges'
47+
params = {}
48+
49+
Elasticsearch::API::Response.new(
50+
perform_request(method, path, params, body, headers, request_opts)
51+
)
52+
end
53+
end
54+
end
55+
end
56+
end
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# Licensed to Elasticsearch B.V. under one or more contributor
2+
# license agreements. See the NOTICE file distributed with
3+
# this work for additional information regarding copyright
4+
# ownership. Elasticsearch B.V. licenses this file to you under
5+
# the Apache License, Version 2.0 (the "License"); you may
6+
# not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
#
18+
# Auto generated from commit f284cc16f4d4b4289bc679aa1529bb504190fe80
19+
# @see https://github.com/elastic/elasticsearch-specification
20+
#
21+
module Elasticsearch
22+
module API
23+
module Security
24+
module Actions
25+
# Suggest a user profile.
26+
# Get suggestions for user profiles that match specified search criteria.
27+
# NOTE: The user profile feature is designed only for use by Kibana and Elastic's Observability, Enterprise Search, and Elastic Security solutions.
28+
# Individual users and external applications should not call this API directly.
29+
# Elastic reserves the right to change or remove this feature in future releases without prior notice.
30+
#
31+
# @option arguments [String] :data A comma-separated list of filters for the +data+ field of the profile document.
32+
# To return all content use +data=*+.
33+
# To return a subset of content, use +data=<key>+ to retrieve content nested under the specified +<key>+.
34+
# By default, the API returns no +data+ content.
35+
# It is an error to specify +data+ as both the query parameter and the request body field.
36+
# @option arguments [Hash] :headers Custom HTTP headers
37+
# @option arguments [Hash] :body request body
38+
#
39+
# @see https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-security-suggest-user-profiles
40+
#
41+
def suggest_user_profiles(arguments = {})
42+
request_opts = { endpoint: arguments[:endpoint] || 'security.suggest_user_profiles' }
43+
44+
arguments = arguments.clone
45+
headers = arguments.delete(:headers) || {}
46+
47+
body = arguments.delete(:body)
48+
49+
method = if body
50+
Elasticsearch::API::HTTP_POST
51+
else
52+
Elasticsearch::API::HTTP_GET
53+
end
54+
55+
path = "_security/profile/_suggest"
56+
params = Utils.process_params(arguments)
57+
58+
Elasticsearch::API::Response.new(
59+
perform_request(method, path, params, body, headers, request_opts)
60+
)
61+
end
62+
end
63+
end
64+
end
65+
end

0 commit comments

Comments
 (0)