Skip to content

Commit 13b9b5f

Browse files
author
Shinya Maeda
committed
Improve API arguments as String
1 parent 1024718 commit 13b9b5f

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

doc/api/runners.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ Example response:
139139
"mysql"
140140
],
141141
"version": null,
142-
"access_level": 0
142+
"access_level": "ref_protected"
143143
}
144144
```
145145

@@ -159,7 +159,7 @@ PUT /runners/:id
159159
| `tag_list` | array | no | The list of tags for a runner; put array of tags, that should be finally assigned to a runner |
160160
| `run_untagged` | boolean | no | Flag indicating the runner can execute untagged jobs |
161161
| `locked` | boolean | no | Flag indicating the runner is locked |
162-
| `access_level` | integer | no | The access_level of the runner; `not_protected`: 0, `ref_protected`: 1 |
162+
| `access_level` | integer | no | The access_level of the runner; `not_protected` or `ref_protected` |
163163

164164
```
165165
curl --request PUT --header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" "https://gitlab.example.com/api/v4/runners/6" --form "description=test-1-20150125-test" --form "tag_list=ruby,mysql,tag1,tag2"
@@ -195,7 +195,7 @@ Example response:
195195
"tag2"
196196
],
197197
"version": null,
198-
"access_level": 0
198+
"access_level": "ref_protected"
199199
}
200200
```
201201

lib/api/runners.rb

+2-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ class Runners < Grape::API
5555
optional :tag_list, type: Array[String], desc: 'The list of tags for a runner'
5656
optional :run_untagged, type: Boolean, desc: 'Flag indicating the runner can execute untagged jobs'
5757
optional :locked, type: Boolean, desc: 'Flag indicating the runner is locked'
58-
optional :access_level, type: Integer, desc: 'The access_level of the runner'
58+
optional :access_level, type: String, values: Ci::Runner.access_levels.keys,
59+
desc: 'The access_level of the runner'
5960
at_least_one_of :description, :active, :tag_list, :run_untagged, :locked, :access_level
6061
end
6162
put ':id' do

spec/requests/api/runners_spec.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@
192192
tag_list: ['ruby2.1', 'pgsql', 'mysql'],
193193
run_untagged: 'false',
194194
locked: 'true',
195-
access_level: Ci::Runner.access_levels['ref_protected'])
195+
access_level: 'ref_protected')
196196
shared_runner.reload
197197

198198
expect(response).to have_http_status(200)

0 commit comments

Comments
 (0)