summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-10-31 21:11:07 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2022-10-31 21:11:07 +0000
commit16776d7f4fdb0cef173fcebb189c53b5bc0ecd39 (patch)
treebe139dfe434ae8b8f3094d00eeef166afd516074 /lib
parent30b8ea126ffffc9bef610d38f8ebcd91bb687aba (diff)
downloadgitlab-ce-16776d7f4fdb0cef173fcebb189c53b5bc0ecd39.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib')
-rw-r--r--lib/api/api.rb4
-rw-r--r--lib/api/clusters/agent_tokens.rb14
-rw-r--r--lib/api/clusters/agents.rb20
-rw-r--r--lib/api/entities/entity_helpers.rb4
4 files changed, 25 insertions, 17 deletions
diff --git a/lib/api/api.rb b/lib/api/api.rb
index 851f4e83494..38c20e80d14 100644
--- a/lib/api/api.rb
+++ b/lib/api/api.rb
@@ -171,6 +171,8 @@ module API
namespace do
mount ::API::AccessRequests
mount ::API::Appearance
+ mount ::API::Clusters::Agents
+ mount ::API::Clusters::AgentTokens
mount ::API::DeployKeys
mount ::API::DeployTokens
mount ::API::Deployments
@@ -212,8 +214,6 @@ module API
mount ::API::Ci::SecureFiles
mount ::API::Ci::Triggers
mount ::API::Ci::Variables
- mount ::API::Clusters::Agents
- mount ::API::Clusters::AgentTokens
mount ::API::CommitStatuses
mount ::API::Commits
mount ::API::ComposerPackages
diff --git a/lib/api/clusters/agent_tokens.rb b/lib/api/clusters/agent_tokens.rb
index 1f9c8700d7a..02d3fcdf5ea 100644
--- a/lib/api/clusters/agent_tokens.rb
+++ b/lib/api/clusters/agent_tokens.rb
@@ -18,9 +18,10 @@ module API
end
resource ':id/cluster_agents/:agent_id' do
resource :tokens do
- desc 'List agent tokens' do
- detail 'This feature was introduced in GitLab 15.0.'
+ desc 'List tokens for an agent' do
+ detail 'This feature was introduced in GitLab 15.0. Returns a list of tokens for an agent.'
success Entities::Clusters::AgentTokenBasic
+ tags %w[cluster_agents]
end
params do
use :pagination
@@ -32,8 +33,9 @@ module API
end
desc 'Get a single agent token' do
- detail 'This feature was introduced in GitLab 15.0.'
+ detail 'This feature was introduced in GitLab 15.0. Gets a single agent token.'
success Entities::Clusters::AgentToken
+ tags %w[cluster_agents]
end
params do
requires :token_id, type: Integer, desc: 'The ID of the agent token'
@@ -47,8 +49,9 @@ module API
end
desc 'Create an agent token' do
- detail 'This feature was introduced in GitLab 15.0.'
+ detail 'This feature was introduced in GitLab 15.0. Creates a new token for an agent.'
success Entities::Clusters::AgentTokenWithToken
+ tags %w[cluster_agents]
end
params do
requires :name, type: String, desc: 'The name for the token'
@@ -71,7 +74,8 @@ module API
end
desc 'Revoke an agent token' do
- detail 'This feature was introduced in GitLab 15.0.'
+ detail 'This feature was introduced in GitLab 15.0. Revokes an agent token.'
+ tags %w[cluster_agents]
end
params do
requires :token_id, type: Integer, desc: 'The ID of the agent token'
diff --git a/lib/api/clusters/agents.rb b/lib/api/clusters/agents.rb
index 2affd9680b6..b93ad2a946b 100644
--- a/lib/api/clusters/agents.rb
+++ b/lib/api/clusters/agents.rb
@@ -14,9 +14,10 @@ module API
requires :id, type: String, desc: 'The ID of a project'
end
resource :projects, requirements: API::NAMESPACE_OR_PROJECT_REQUIREMENTS do
- desc 'List agents' do
- detail 'This feature was introduced in GitLab 14.10.'
+ desc 'List the agents for a project' do
+ detail 'This feature was introduced in GitLab 14.10. Returns the list of agents registered for the project.'
success Entities::Clusters::Agent
+ tags %w[cluster_agents]
end
params do
use :pagination
@@ -29,9 +30,10 @@ module API
present paginate(agents), with: Entities::Clusters::Agent
end
- desc 'Get single agent' do
- detail 'This feature was introduced in GitLab 14.10.'
+ desc 'Get details about an agent' do
+ detail 'This feature was introduced in GitLab 14.10. Gets a single agent details.'
success Entities::Clusters::Agent
+ tags %w[cluster_agents]
end
params do
requires :agent_id, type: Integer, desc: 'The ID of an agent'
@@ -42,9 +44,10 @@ module API
present agent, with: Entities::Clusters::Agent
end
- desc 'Add an agent to a project' do
- detail 'This feature was introduced in GitLab 14.10.'
+ desc 'Register an agent with a project' do
+ detail 'This feature was introduced in GitLab 14.10. Registers an agent to the project.'
success Entities::Clusters::Agent
+ tags %w[cluster_agents]
end
params do
requires :name, type: String, desc: 'The name of the agent'
@@ -61,8 +64,9 @@ module API
present result[:cluster_agent], with: Entities::Clusters::Agent
end
- desc 'Delete an agent' do
- detail 'This feature was introduced in GitLab 14.10.'
+ desc 'Delete a registered agent' do
+ detail 'This feature was introduced in GitLab 14.10. Deletes an existing agent registration.'
+ tags %w[cluster_agents]
end
params do
requires :agent_id, type: Integer, desc: 'The ID of an agent'
diff --git a/lib/api/entities/entity_helpers.rb b/lib/api/entities/entity_helpers.rb
index 3a68044ad35..6fb04bb8ad6 100644
--- a/lib/api/entities/entity_helpers.rb
+++ b/lib/api/entities/entity_helpers.rb
@@ -11,8 +11,8 @@ module API
->(obj, opts) { Ability.allowed?(opts[:user], "destroy_#{attr}".to_sym, yield(obj)) }
end
- def expose_restricted(attr, &block)
- expose attr, if: can_read(attr, &block)
+ def expose_restricted(attr, documentation: {}, &block)
+ expose attr, documentation: documentation, if: can_read(attr, &block)
end
end
end