File tree Expand file tree Collapse file tree 4 files changed +30
-7
lines changed
lib/cloud_controller/config_schemas/base
spec/unit/controllers/runtime Expand file tree Collapse file tree 4 files changed +30
-7
lines changed Original file line number Diff line number Diff line change @@ -15,13 +15,6 @@ def read
15
15
href : api_url_builder . build_url
16
16
} ,
17
17
18
- cloud_controller_v2 : {
19
- href : api_url_builder . build_url ( path : '/v2' ) ,
20
- meta : {
21
- version : VCAP ::CloudController ::Constants ::API_VERSION
22
- }
23
- } ,
24
-
25
18
cloud_controller_v3 : {
26
19
href : api_url_builder . build_url ( path : '/v3' ) ,
27
20
meta : {
@@ -71,6 +64,8 @@ def read
71
64
}
72
65
}
73
66
67
+ response [ :links ] . merge! ( cloud_controller_v2 ( api_url_builder ) ) if config . get ( :temporary_enable_v2 )
68
+
74
69
[ 200 , Oj . dump ( response , mode : :compat ) ]
75
70
end
76
71
@@ -91,5 +86,17 @@ def routing_link
91
86
92
87
{ href : config . get ( :routing_api , :url ) }
93
88
end
89
+
90
+ def cloud_controller_v2 ( api_url_builder )
91
+ {
92
+ cloud_controller_v2 :
93
+ {
94
+ href : api_url_builder . build_url ( path : '/v2' ) ,
95
+ meta : {
96
+ version : VCAP ::CloudController ::Constants ::API_VERSION
97
+ }
98
+ }
99
+ }
100
+ end
94
101
end
95
102
end
Original file line number Diff line number Diff line change @@ -279,6 +279,8 @@ rate_limiter_v2_api:
279
279
global_admin_limit : 20000
280
280
reset_interval_in_minutes : 60
281
281
282
+ temporary_enable_v2 : true
283
+
282
284
max_concurrent_service_broker_requests : 0
283
285
284
286
diego :
Original file line number Diff line number Diff line change @@ -322,6 +322,8 @@ class ApiSchema < VCAP::Config
322
322
reset_interval_in_minutes : Integer
323
323
} ,
324
324
325
+ optional ( :temporary_enable_v2 ) => bool ,
326
+
325
327
allow_app_ssh_access : bool ,
326
328
327
329
optional ( :external_host ) => String ,
Original file line number Diff line number Diff line change @@ -26,6 +26,18 @@ module VCAP::CloudController
26
26
)
27
27
end
28
28
29
+ context 'temporary_enable_v2 is false' do
30
+ before do
31
+ TestConfig . override ( temporary_enable_v2 : false )
32
+ end
33
+
34
+ it 'returns no cloud controller v2 link with metadata' do
35
+ get '/'
36
+ hash = Oj . load ( last_response . body )
37
+ expect ( hash [ 'links' ] [ 'cloud_controller_v2' ] ) . to be_nil
38
+ end
39
+ end
40
+
29
41
it 'returns a cloud controller v3 link with metadata' do
30
42
get '/'
31
43
hash = Oj . load ( last_response . body )
You can’t perform that action at this time.
0 commit comments