summaryrefslogtreecommitdiff
path: root/lib/api/project_clusters.rb
diff options
context:
space:
mode:
authorToon Claes <toon@gitlab.com>2019-02-28 19:57:34 +0100
committerToon Claes <toon@gitlab.com>2019-02-28 19:57:34 +0100
commit62d7990b9bb30cf33ed87017c5c633d1cccc75c2 (patch)
treec3e1b69c58a412ba1c6f50a0337a23d9f9d6e1a4 /lib/api/project_clusters.rb
parentf6453eca992a9c142268e78ac782cef98110d183 (diff)
downloadgitlab-ce-tc-standard-gem.tar.gz
Ran standardrb --fix on the whole codebasetc-standard-gem
Inspired by https://twitter.com/searls/status/1101137953743613952 I decided to try https://github.com/testdouble/standard on our codebase. It's opinionated, but at least it's a _standard_.
Diffstat (limited to 'lib/api/project_clusters.rb')
-rw-r--r--lib/api/project_clusters.rb70
1 files changed, 35 insertions, 35 deletions
diff --git a/lib/api/project_clusters.rb b/lib/api/project_clusters.rb
index c96261a7b57..5bcbb095584 100644
--- a/lib/api/project_clusters.rb
+++ b/lib/api/project_clusters.rb
@@ -17,53 +17,53 @@ module API
end
params do
- requires :id, type: String, desc: 'The ID of the project'
+ requires :id, type: String, desc: "The ID of the project"
end
resource :projects, requirements: API::NAMESPACE_OR_PROJECT_REQUIREMENTS do
- desc 'Get all clusters from the project' do
- detail 'This feature was introduced in GitLab 11.7.'
+ desc "Get all clusters from the project" do
+ detail "This feature was introduced in GitLab 11.7."
success Entities::Cluster
end
params do
use :pagination
end
- get ':id/clusters' do
+ get ":id/clusters" do
authorize! :read_cluster, user_project
present paginate(clusters_for_current_user), with: Entities::Cluster
end
- desc 'Get specific cluster for the project' do
- detail 'This feature was introduced in GitLab 11.7.'
+ desc "Get specific cluster for the project" do
+ detail "This feature was introduced in GitLab 11.7."
success Entities::ClusterProject
end
params do
- requires :cluster_id, type: Integer, desc: 'The cluster ID'
+ requires :cluster_id, type: Integer, desc: "The cluster ID"
end
- get ':id/clusters/:cluster_id' do
+ get ":id/clusters/:cluster_id" do
authorize! :read_cluster, cluster
present cluster, with: Entities::ClusterProject
end
- desc 'Adds an existing cluster' do
- detail 'This feature was introduced in GitLab 11.7.'
+ desc "Adds an existing cluster" do
+ detail "This feature was introduced in GitLab 11.7."
success Entities::ClusterProject
end
params do
- requires :name, type: String, desc: 'Cluster name'
- optional :enabled, type: Boolean, default: true, desc: 'Determines if cluster is active or not, defaults to true'
- requires :platform_kubernetes_attributes, type: Hash, desc: %q(Platform Kubernetes data) do
- requires :api_url, type: String, allow_blank: false, desc: 'URL to access the Kubernetes API'
- requires :token, type: String, desc: 'Token to authenticate against Kubernetes'
- optional :ca_cert, type: String, desc: 'TLS certificate (needed if API is using a self-signed TLS certificate)'
- optional :namespace, type: String, desc: 'Unique namespace related to Project'
- optional :authorization_type, type: String, values: Clusters::Platforms::Kubernetes.authorization_types.keys, default: 'rbac', desc: 'Cluster authorization type, defaults to RBAC'
+ requires :name, type: String, desc: "Cluster name"
+ optional :enabled, type: Boolean, default: true, desc: "Determines if cluster is active or not, defaults to true"
+ requires :platform_kubernetes_attributes, type: Hash, desc: "Platform Kubernetes data" do
+ requires :api_url, type: String, allow_blank: false, desc: "URL to access the Kubernetes API"
+ requires :token, type: String, desc: "Token to authenticate against Kubernetes"
+ optional :ca_cert, type: String, desc: "TLS certificate (needed if API is using a self-signed TLS certificate)"
+ optional :namespace, type: String, desc: "Unique namespace related to Project"
+ optional :authorization_type, type: String, values: Clusters::Platforms::Kubernetes.authorization_types.keys, default: "rbac", desc: "Cluster authorization type, defaults to RBAC"
end
use :create_params_ee
end
- post ':id/clusters/user' do
- authorize! :add_cluster, user_project, 'Instance does not support multiple Kubernetes clusters'
+ post ":id/clusters/user" do
+ authorize! :add_cluster, user_project, "Instance does not support multiple Kubernetes clusters"
user_cluster = ::Clusters::CreateService
.new(current_user, create_cluster_user_params)
@@ -76,22 +76,22 @@ module API
end
end
- desc 'Update an existing cluster' do
- detail 'This feature was introduced in GitLab 11.7.'
+ desc "Update an existing cluster" do
+ detail "This feature was introduced in GitLab 11.7."
success Entities::ClusterProject
end
params do
- requires :cluster_id, type: Integer, desc: 'The cluster ID'
- optional :name, type: String, desc: 'Cluster name'
- optional :platform_kubernetes_attributes, type: Hash, desc: %q(Platform Kubernetes data) do
- optional :api_url, type: String, desc: 'URL to access the Kubernetes API'
- optional :token, type: String, desc: 'Token to authenticate against Kubernetes'
- optional :ca_cert, type: String, desc: 'TLS certificate (needed if API is using a self-signed TLS certificate)'
- optional :namespace, type: String, desc: 'Unique namespace related to Project'
+ requires :cluster_id, type: Integer, desc: "The cluster ID"
+ optional :name, type: String, desc: "Cluster name"
+ optional :platform_kubernetes_attributes, type: Hash, desc: "Platform Kubernetes data" do
+ optional :api_url, type: String, desc: "URL to access the Kubernetes API"
+ optional :token, type: String, desc: "Token to authenticate against Kubernetes"
+ optional :ca_cert, type: String, desc: "TLS certificate (needed if API is using a self-signed TLS certificate)"
+ optional :namespace, type: String, desc: "Unique namespace related to Project"
end
use :update_params_ee
end
- put ':id/clusters/:cluster_id' do
+ put ":id/clusters/:cluster_id" do
authorize! :update_cluster, cluster
update_service = Clusters::UpdateService.new(current_user, update_cluster_params)
@@ -103,14 +103,14 @@ module API
end
end
- desc 'Remove a cluster' do
- detail 'This feature was introduced in GitLab 11.7.'
+ desc "Remove a cluster" do
+ detail "This feature was introduced in GitLab 11.7."
success Entities::ClusterProject
end
params do
- requires :cluster_id, type: Integer, desc: 'The Cluster ID'
+ requires :cluster_id, type: Integer, desc: "The Cluster ID"
end
- delete ':id/clusters/:cluster_id' do
+ delete ":id/clusters/:cluster_id" do
authorize! :admin_cluster, cluster
destroy_conditionally!(cluster)
@@ -130,7 +130,7 @@ module API
declared_params.merge({
provider_type: :user,
platform_type: :kubernetes,
- clusterable: user_project
+ clusterable: user_project,
})
end