summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShinya Maeda <shinya@gitlab.com>2017-08-29 16:09:30 +0900
committerShinya Maeda <shinya@gitlab.com>2017-09-03 23:49:10 +0900
commit13b9b5f11a556b2841aabbf46516d1acab79aa0d (patch)
treecad36554f682546915249aa4a8c9fc415cb3a808
parent1024718e9fddbb0d61d3f64f44303964641fcdd8 (diff)
downloadgitlab-ce-13b9b5f11a556b2841aabbf46516d1acab79aa0d.tar.gz
Improve API arguments as String
-rw-r--r--doc/api/runners.md6
-rw-r--r--lib/api/runners.rb3
-rw-r--r--spec/requests/api/runners_spec.rb2
3 files changed, 6 insertions, 5 deletions
diff --git a/doc/api/runners.md b/doc/api/runners.md
index df458af77bb..8146a7e0647 100644
--- a/doc/api/runners.md
+++ b/doc/api/runners.md
@@ -139,7 +139,7 @@ Example response:
"mysql"
],
"version": null,
- "access_level": 0
+ "access_level": "ref_protected"
}
```
@@ -159,7 +159,7 @@ PUT /runners/:id
| `tag_list` | array | no | The list of tags for a runner; put array of tags, that should be finally assigned to a runner |
| `run_untagged` | boolean | no | Flag indicating the runner can execute untagged jobs |
| `locked` | boolean | no | Flag indicating the runner is locked |
-| `access_level` | integer | no | The access_level of the runner; `not_protected`: 0, `ref_protected`: 1 |
+| `access_level` | integer | no | The access_level of the runner; `not_protected` or `ref_protected` |
```
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:
"tag2"
],
"version": null,
- "access_level": 0
+ "access_level": "ref_protected"
}
```
diff --git a/lib/api/runners.rb b/lib/api/runners.rb
index d8fc44e5790..d3559ef71be 100644
--- a/lib/api/runners.rb
+++ b/lib/api/runners.rb
@@ -55,7 +55,8 @@ module API
optional :tag_list, type: Array[String], desc: 'The list of tags for a runner'
optional :run_untagged, type: Boolean, desc: 'Flag indicating the runner can execute untagged jobs'
optional :locked, type: Boolean, desc: 'Flag indicating the runner is locked'
- optional :access_level, type: Integer, desc: 'The access_level of the runner'
+ optional :access_level, type: String, values: Ci::Runner.access_levels.keys,
+ desc: 'The access_level of the runner'
at_least_one_of :description, :active, :tag_list, :run_untagged, :locked, :access_level
end
put ':id' do
diff --git a/spec/requests/api/runners_spec.rb b/spec/requests/api/runners_spec.rb
index abaa6eb4f6d..67907579225 100644
--- a/spec/requests/api/runners_spec.rb
+++ b/spec/requests/api/runners_spec.rb
@@ -192,7 +192,7 @@ describe API::Runners do
tag_list: ['ruby2.1', 'pgsql', 'mysql'],
run_untagged: 'false',
locked: 'true',
- access_level: Ci::Runner.access_levels['ref_protected'])
+ access_level: 'ref_protected')
shared_runner.reload
expect(response).to have_http_status(200)