diff options
author | Angelo Lakra <alakra@comverge.com> | 2013-10-14 13:20:52 -0600 |
---|---|---|
committer | Angelo Lakra <alakra@comverge.com> | 2013-10-14 13:20:52 -0600 |
commit | e7c5a6ecb75106516096965ff1d8b25007c8b62b (patch) | |
tree | ac12d593819c46ab7fe08336edcd377ea0b974d0 /lib/api | |
parent | c01896523ccb172cfe4b5e851f2d1e137b4963ed (diff) | |
download | gitlab-ci-e7c5a6ecb75106516096965ff1d8b25007c8b62b.tar.gz |
Extending Runners API to include GET /runners call
* The GET /runners call retrieves a list of all runners registered
on the Gitlab CI instance.
Diffstat (limited to 'lib/api')
-rw-r--r-- | lib/api/runners.rb | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/lib/api/runners.rb b/lib/api/runners.rb index 8bf2370..2df6d6a 100644 --- a/lib/api/runners.rb +++ b/lib/api/runners.rb @@ -2,10 +2,26 @@ module API # Runners API class Runners < Grape::API resource :runners do - before { authenticate_runners! } + # Get list of all available runners + # + # Example Request: + # GET /runners + get do + authenticate! + runners = Runner.all + + if runners.present? + present runners, with: Entities::Runner + else + not_found! + end + end # Register a new runner # + # Note: This is an "internal" API called when setting up + # runners, so it is authenticated differently. + # # Parameters: # token (required) - The unique token of runner # public_key (required) - Deploy key used to get projects @@ -13,6 +29,7 @@ module API # Example Request: # POST /runners/register post "register" do + authenticate_runners! required_attributes! [:token, :public_key] runner = Runner.create(public_key: params[:public_key]) |