Skip to content

Commit 4c308e2

Browse files
committed
Rename 'file-based-service-bindings' feature to 'service-binding-k8s'
1 parent 1ca9162 commit 4c308e2

File tree

10 files changed

+57
-57
lines changed

10 files changed

+57
-57
lines changed

app/actions/app_feature_update.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ def self.update(feature_name, app, message)
66
app.update(enable_ssh: message.enabled)
77
when 'revisions'
88
app.update(revisions_enabled: message.enabled)
9-
when 'file-based-service-bindings'
10-
app.update(file_based_service_bindings_enabled: message.enabled)
9+
when 'service-binding-k8s'
10+
app.update(service_binding_k8s_enabled: message.enabled)
1111
end
1212
end
1313
end

app/controllers/v3/app_features_controller.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
require 'controllers/v3/mixins/app_sub_resource'
33
require 'presenters/v3/app_ssh_feature_presenter'
44
require 'presenters/v3/app_revisions_feature_presenter'
5-
require 'presenters/v3/app_file_based_service_bindings_feature_presenter'
5+
require 'presenters/v3/app_service_binding_k8s_feature_presenter'
66
require 'presenters/v3/app_ssh_status_presenter'
77
require 'actions/app_feature_update'
88

@@ -11,9 +11,9 @@ class AppFeaturesController < ApplicationController
1111

1212
SSH_FEATURE = 'ssh'.freeze
1313
REVISIONS_FEATURE = 'revisions'.freeze
14-
FILE_BASED_SERVICE_BINDINGS_FEATURE = 'file-based-service-bindings'.freeze
14+
SERVICE_BINDING_K8S_FEATURE = 'service-binding-k8s'.freeze
1515

16-
TRUSTED_APP_FEATURES = [SSH_FEATURE, FILE_BASED_SERVICE_BINDINGS_FEATURE].freeze
16+
TRUSTED_APP_FEATURES = [SSH_FEATURE, SERVICE_BINDING_K8S_FEATURE].freeze
1717
UNTRUSTED_APP_FEATURES = [REVISIONS_FEATURE].freeze
1818
APP_FEATURES = (TRUSTED_APP_FEATURES + UNTRUSTED_APP_FEATURES).freeze
1919

@@ -83,7 +83,7 @@ def feature_presenter_for(feature_name, app)
8383
presenters = {
8484
SSH_FEATURE => Presenters::V3::AppSshFeaturePresenter,
8585
REVISIONS_FEATURE => Presenters::V3::AppRevisionsFeaturePresenter,
86-
FILE_BASED_SERVICE_BINDINGS_FEATURE => Presenters::V3::AppFileBasedServiceBindingsFeaturePresenter
86+
SERVICE_BINDING_K8S_FEATURE => Presenters::V3::AppServiceBindingK8sFeaturePresenter
8787
}
8888
presenters[feature_name].new(app)
8989
end
@@ -92,7 +92,7 @@ def presented_app_features(app)
9292
[
9393
Presenters::V3::AppSshFeaturePresenter.new(app),
9494
Presenters::V3::AppRevisionsFeaturePresenter.new(app),
95-
Presenters::V3::AppFileBasedServiceBindingsFeaturePresenter.new(app)
95+
Presenters::V3::AppServiceBindingK8sFeaturePresenter.new(app)
9696
]
9797
end
9898
end

app/presenters/v3/app_file_based_service_bindings_feature_presenter.rb

Lines changed: 0 additions & 19 deletions
This file was deleted.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
require 'presenters/v3/base_presenter'
2+
3+
module VCAP::CloudController::Presenters::V3
4+
class AppServiceBindingK8sFeaturePresenter < BasePresenter
5+
def to_hash
6+
{
7+
name: 'service-binding-k8s',
8+
description: 'Enable k8s service bindings for the app',
9+
enabled: app.service_binding_k8s_enabled
10+
}
11+
end
12+
13+
private
14+
15+
def app
16+
@resource
17+
end
18+
end
19+
end

docs/v3/source/includes/api_resources/_app_features.erb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
"enabled": false
2121
},
2222
{
23-
"name": "file-based-service-bindings",
24-
"description": "Enable file-based service bindings for the app",
23+
"name": "service-binding-k8s",
24+
"description": "Enable k8s service bindings for the app",
2525
"enabled": false
2626
}
2727
],

docs/v3/source/includes/resources/app_features/_supported_features.md.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ Name | Description
66
---- | -----------
77
**ssh** | Enable SSHing into the app
88
**revisions** | Enable [versioning](#revisions) of an application
9-
**file-based-service-bindings** | Enable file-based service bindings for the app (experimental)
9+
**service-binding-k8s** | Enable k8s service bindings for the app (experimental)

spec/request/app_features_spec.rb

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
let(:admin_header) { admin_headers_for(user) }
88
let(:org) { VCAP::CloudController::Organization.make(created_at: 3.days.ago) }
99
let(:space) { VCAP::CloudController::Space.make(organization: org) }
10-
let(:app_model) { VCAP::CloudController::AppModel.make(space: space, enable_ssh: true, file_based_service_bindings_enabled: true) }
10+
let(:app_model) { VCAP::CloudController::AppModel.make(space: space, enable_ssh: true, service_binding_k8s_enabled: true) }
1111

1212
describe 'GET /v3/apps/:guid/features' do
1313
context 'getting a list of available features for the app' do
@@ -26,8 +26,8 @@
2626
'enabled' => true
2727
},
2828
{
29-
'name' => 'file-based-service-bindings',
30-
'description' => 'Enable file-based service bindings for the app',
29+
'name' => 'service-binding-k8s',
30+
'description' => 'Enable k8s service bindings for the app',
3131
'enabled' => true
3232
}
3333
],
@@ -100,12 +100,12 @@
100100
it_behaves_like 'permissions for single object endpoint', ALL_PERMISSIONS
101101
end
102102

103-
context 'file-based-service-bindings app feature' do
104-
let(:api_call) { ->(user_headers) { get "/v3/apps/#{app_model.guid}/features/file-based-service-bindings", nil, user_headers } }
103+
context 'service-binding-k8s app feature' do
104+
let(:api_call) { ->(user_headers) { get "/v3/apps/#{app_model.guid}/features/service-binding-k8s", nil, user_headers } }
105105
let(:feature_response_object) do
106106
{
107-
'name' => 'file-based-service-bindings',
108-
'description' => 'Enable file-based service bindings for the app',
107+
'name' => 'service-binding-k8s',
108+
'description' => 'Enable k8s service bindings for the app',
109109
'enabled' => true
110110
}
111111
end
@@ -191,12 +191,12 @@
191191
end
192192
end
193193

194-
context 'file-based-service-bindings app feature' do
195-
let(:api_call) { ->(user_headers) { patch "/v3/apps/#{app_model.guid}/features/file-based-service-bindings", request_body.to_json, user_headers } }
194+
context 'service-binding-k8s app feature' do
195+
let(:api_call) { ->(user_headers) { patch "/v3/apps/#{app_model.guid}/features/service-binding-k8s", request_body.to_json, user_headers } }
196196
let(:feature_response_object) do
197197
{
198-
'name' => 'file-based-service-bindings',
199-
'description' => 'Enable file-based service bindings for the app',
198+
'name' => 'service-binding-k8s',
199+
'description' => 'Enable k8s service bindings for the app',
200200
'enabled' => false
201201
}
202202
end

spec/unit/actions/app_feature_update_spec.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@ module VCAP::CloudController
2525
end
2626
end
2727

28-
context 'when the feature name is file-based-service-bindings' do
29-
it 'updates the file_based_service_bindings_enabled column on the app' do
28+
context 'when the feature name is service-binding-k8s' do
29+
it 'updates the service_binding_k8s_enabled column on the app' do
3030
expect do
31-
AppFeatureUpdate.update('file-based-service-bindings', app, message)
32-
end.to change { app.reload.file_based_service_bindings_enabled }.to(true)
31+
AppFeatureUpdate.update('service-binding-k8s', app, message)
32+
end.to change { app.reload.service_binding_k8s_enabled }.to(true)
3333
end
3434
end
3535
end

spec/unit/controllers/v3/app_features_controller_spec.rb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44
## NOTICE: Prefer request specs over controller specs as per ADR #0003 ##
55

66
RSpec.describe AppFeaturesController, type: :controller do
7-
let(:app_model) { VCAP::CloudController::AppModel.make(enable_ssh: true, file_based_service_bindings_enabled: true) }
7+
let(:app_model) { VCAP::CloudController::AppModel.make(enable_ssh: true, service_binding_k8s_enabled: true) }
88
let(:space) { app_model.space }
99
let(:org) { space.organization }
1010
let(:user) { VCAP::CloudController::User.make }
1111
let(:app_feature_ssh_response) { { 'name' => 'ssh', 'description' => 'Enable SSHing into the app.', 'enabled' => true } }
1212
let(:app_feature_revisions_response) { { 'name' => 'revisions', 'description' => 'Enable versioning of an application', 'enabled' => true } }
13-
let(:app_feature_file_based_service_bindings_response) do
14-
{ 'name' => 'file-based-service-bindings', 'description' => 'Enable file-based service bindings for the app', 'enabled' => true }
13+
let(:app_feature_service_binding_k8s_response) do
14+
{ 'name' => 'service-binding-k8s', 'description' => 'Enable k8s service bindings for the app', 'enabled' => true }
1515
end
1616

1717
before do
@@ -42,7 +42,7 @@
4242
it 'returns app features' do
4343
get :index, params: { app_guid: app_model.guid }
4444
expect(parsed_body).to eq(
45-
'resources' => [app_feature_ssh_response, app_feature_revisions_response, app_feature_file_based_service_bindings_response],
45+
'resources' => [app_feature_ssh_response, app_feature_revisions_response, app_feature_service_binding_k8s_response],
4646
'pagination' => pagination_hash
4747
)
4848
end
@@ -70,9 +70,9 @@
7070
expect(parsed_body).to eq(app_feature_revisions_response)
7171
end
7272

73-
it 'returns the file-based-service-bindings app feature' do
74-
get :show, params: { app_guid: app_model.guid, name: 'file-based-service-bindings' }
75-
expect(parsed_body).to eq(app_feature_file_based_service_bindings_response)
73+
it 'returns the service-binding-k8s app feature' do
74+
get :show, params: { app_guid: app_model.guid, name: 'service-binding-k8s' }
75+
expect(parsed_body).to eq(app_feature_service_binding_k8s_response)
7676
end
7777

7878
it 'throws 404 for a non-existent feature' do

spec/unit/presenters/v3/app_feature_presenter_spec.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
require 'spec_helper'
22
require 'presenters/v3/app_ssh_feature_presenter'
3-
require 'presenters/v3/app_file_based_service_bindings_feature_presenter'
3+
require 'presenters/v3/app_service_binding_k8s_feature_presenter'
44

55
module VCAP::CloudController::Presenters::V3
66
RSpec.describe AppSshFeaturePresenter do
@@ -16,15 +16,15 @@ module VCAP::CloudController::Presenters::V3
1616
end
1717
end
1818

19-
RSpec.describe AppFileBasedServiceBindingsFeaturePresenter do
19+
RSpec.describe AppServiceBindingK8sFeaturePresenter do
2020
let(:app) { VCAP::CloudController::AppModel.make }
2121

2222
describe '#to_hash' do
2323
it 'presents the app feature as json' do
24-
result = AppFileBasedServiceBindingsFeaturePresenter.new(app).to_hash
25-
expect(result[:name]).to eq('file-based-service-bindings')
26-
expect(result[:description]).to eq('Enable file-based service bindings for the app')
27-
expect(result[:enabled]).to eq(app.file_based_service_bindings_enabled)
24+
result = AppServiceBindingK8sFeaturePresenter.new(app).to_hash
25+
expect(result[:name]).to eq('service-binding-k8s')
26+
expect(result[:description]).to eq('Enable k8s service bindings for the app')
27+
expect(result[:enabled]).to eq(app.service_binding_k8s_enabled)
2828
end
2929
end
3030
end

0 commit comments

Comments
 (0)