Commit f4393ced authored by Ash McKenzie's avatar Ash McKenzie

Merge branch 'mk/fix-param-requirements' into 'master'

Geo: Make primary and internal_url params optional

See merge request gitlab-org/gitlab!23130
parents ae6d9a50 52e8ca14
......@@ -11,6 +11,13 @@ Creates a new Geo node.
POST /geo_nodes
```
```bash
curl --header "PRIVATE-TOKEN: <your_access_token>" https://primary.example.com/api/v4/geo_nodes \
--request POST \
-d "name=himynameissomething" \
-d "url=https://another-node.example.com/"
```
| Attribute | Type | Required | Description |
| ----------------------------| ------- | -------- | -----------------------------------------------------------------|
| `primary` | boolean | no | Specifying whether this node will be primary. Defaults to false. |
......
......@@ -17,11 +17,11 @@ module API
success EE::API::Entities::GeoNode
end
params do
requires :primary, type: Boolean, desc: 'Specifying whether this node will be primary. Defaults to false.'
optional :primary, type: Boolean, desc: 'Specifying whether this node will be primary. Defaults to false.'
optional :enabled, type: Boolean, desc: 'Specifying whether this node will be enabled. Defaults to true.'
requires :name, type: String, desc: 'The unique identifier for the Geo node. Must match `geo_node_name` if it is set in `gitlab.rb`, otherwise it must match `external_url`'
requires :url, type: String, desc: 'The user-facing URL for the Geo node'
requires :internal_url, type: String, desc: 'The URL defined on the primary node that secondary nodes should use to contact it. Returns `url` if not set.'
optional :internal_url, type: String, desc: 'The URL defined on the primary node that secondary nodes should use to contact it. Returns `url` if not set.'
optional :files_max_capacity, type: Integer, desc: 'Control the maximum concurrency of LFS/attachment backfill for this secondary node. Defaults to 10.'
optional :repos_max_capacity, type: Integer, desc: 'Control the maximum concurrency of repository backfill for this secondary node. Defaults to 25.'
optional :verification_max_capacity, type: Integer, desc: 'Control the maximum concurrency of repository verification for this node. Defaults to 100.'
......
......@@ -31,9 +31,7 @@ describe API::GeoNodes, :geo, :prometheus, api: true do
it 'delegates the creation of the Geo node to Geo::NodeCreateService' do
geo_node_params = {
name: 'Test Node 1',
url: 'http://example.com',
internal_url: 'http://internal.example.com',
primary: false
url: 'http://example.com'
}
expect_any_instance_of(Geo::NodeCreateService).to receive(:execute).once.and_call_original
post api('/geo_nodes', admin), params: geo_node_params
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment