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. ...@@ -11,6 +11,13 @@ Creates a new Geo node.
POST /geo_nodes 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 | | Attribute | Type | Required | Description |
| ----------------------------| ------- | -------- | -----------------------------------------------------------------| | ----------------------------| ------- | -------- | -----------------------------------------------------------------|
| `primary` | boolean | no | Specifying whether this node will be primary. Defaults to false. | | `primary` | boolean | no | Specifying whether this node will be primary. Defaults to false. |
......
...@@ -17,11 +17,11 @@ module API ...@@ -17,11 +17,11 @@ module API
success EE::API::Entities::GeoNode success EE::API::Entities::GeoNode
end end
params do 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.' 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 :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 :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 :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 :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.' 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 ...@@ -31,9 +31,7 @@ describe API::GeoNodes, :geo, :prometheus, api: true do
it 'delegates the creation of the Geo node to Geo::NodeCreateService' do it 'delegates the creation of the Geo node to Geo::NodeCreateService' do
geo_node_params = { geo_node_params = {
name: 'Test Node 1', name: 'Test Node 1',
url: 'http://example.com', url: 'http://example.com'
internal_url: 'http://internal.example.com',
primary: false
} }
expect_any_instance_of(Geo::NodeCreateService).to receive(:execute).once.and_call_original expect_any_instance_of(Geo::NodeCreateService).to receive(:execute).once.and_call_original
post api('/geo_nodes', admin), params: geo_node_params 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