Skip to content

Commit f8d3161

Browse files
committed
Revert "[v8] Add "--strategy" parameter to "bind-service" command (cloudfoundry#3654)"
This reverts commit 5f38fd4.
1 parent 453db8f commit f8d3161

10 files changed

Lines changed: 8 additions & 183 deletions

actor/v7action/service_app_binding.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ type CreateServiceAppBindingParams struct {
1515
AppName string
1616
BindingName string
1717
Parameters types.OptionalObject
18-
Strategy resources.BindingStrategyType
1918
}
2019

2120
type DeleteServiceAppBindingParams struct {
@@ -42,7 +41,7 @@ func (actor Actor) CreateServiceAppBinding(params CreateServiceAppBindingParams)
4241
return
4342
},
4443
func() (warnings ccv3.Warnings, err error) {
45-
jobURL, warnings, err = actor.createServiceAppBinding(serviceInstance.GUID, app.GUID, params.BindingName, params.Parameters, params.Strategy)
44+
jobURL, warnings, err = actor.createServiceAppBinding(serviceInstance.GUID, app.GUID, params.BindingName, params.Parameters)
4645
return
4746
},
4847
func() (warnings ccv3.Warnings, err error) {
@@ -103,14 +102,13 @@ func (actor Actor) DeleteServiceAppBinding(params DeleteServiceAppBindingParams)
103102
}
104103
}
105104

106-
func (actor Actor) createServiceAppBinding(serviceInstanceGUID, appGUID, bindingName string, parameters types.OptionalObject, strategy resources.BindingStrategyType) (ccv3.JobURL, ccv3.Warnings, error) {
105+
func (actor Actor) createServiceAppBinding(serviceInstanceGUID, appGUID, bindingName string, parameters types.OptionalObject) (ccv3.JobURL, ccv3.Warnings, error) {
107106
jobURL, warnings, err := actor.CloudControllerClient.CreateServiceCredentialBinding(resources.ServiceCredentialBinding{
108107
Type: resources.AppBinding,
109108
Name: bindingName,
110109
ServiceInstanceGUID: serviceInstanceGUID,
111110
AppGUID: appGUID,
112111
Parameters: parameters,
113-
Strategy: strategy,
114112
})
115113
switch err.(type) {
116114
case nil:

actor/v7action/service_app_binding_test.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ var _ = Describe("Service App Binding Action", func() {
3535
bindingName = "fake-binding-name"
3636
spaceGUID = "fake-space-guid"
3737
fakeJobURL = ccv3.JobURL("fake-job-url")
38-
strategy = "single"
3938
)
4039

4140
var (
@@ -88,7 +87,6 @@ var _ = Describe("Service App Binding Action", func() {
8887
Parameters: types.NewOptionalObject(map[string]interface{}{
8988
"foo": "bar",
9089
}),
91-
Strategy: resources.SingleBindingStrategy,
9290
}
9391
})
9492

@@ -204,7 +202,6 @@ var _ = Describe("Service App Binding Action", func() {
204202
Parameters: types.NewOptionalObject(map[string]interface{}{
205203
"foo": "bar",
206204
}),
207-
Strategy: strategy,
208205
}))
209206
})
210207

api/cloudcontroller/ccversion/minimum_version.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,5 @@ const (
2323

2424
MinVersionCanarySteps = "3.189.0"
2525

26-
MinVersionServiceBindingStrategy = "3.205.0"
27-
2826
MinVersionUpdateStack = "3.211.0"
2927
)

command/flag/service_binding_strategy.go

Lines changed: 0 additions & 32 deletions
This file was deleted.

command/flag/service_binding_strategy_test.go

Lines changed: 0 additions & 68 deletions
This file was deleted.

command/v7/bind_service_command.go

Lines changed: 6 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ package v7
33
import (
44
"code.cloudfoundry.org/cli/v8/actor/actionerror"
55
"code.cloudfoundry.org/cli/v8/actor/v7action"
6-
"code.cloudfoundry.org/cli/v8/api/cloudcontroller/ccversion"
7-
"code.cloudfoundry.org/cli/v8/command"
86
"code.cloudfoundry.org/cli/v8/command/flag"
97
"code.cloudfoundry.org/cli/v8/command/v7/shared"
108
"code.cloudfoundry.org/cli/v8/types"
@@ -13,26 +11,18 @@ import (
1311
type BindServiceCommand struct {
1412
BaseCommand
1513

16-
RequiredArgs flag.BindServiceArgs `positional-args:"yes"`
17-
BindingName flag.BindingName `long:"binding-name" description:"Name to expose service instance to app process with (Default: service instance name)"`
18-
ParametersAsJSON flag.JSONOrFileWithValidation `short:"c" description:"Valid JSON object containing service-specific configuration parameters, provided either in-line or in a file. For a list of supported configuration parameters, see documentation for the particular service offering."`
19-
ServiceBindingStrategy flag.ServiceBindingStrategy `long:"strategy" description:"Service binding strategy. Valid values are 'single' (default) and 'multiple'."`
20-
Wait bool `short:"w" long:"wait" description:"Wait for the operation to complete"`
21-
relatedCommands interface{} `related_commands:"services"`
14+
RequiredArgs flag.BindServiceArgs `positional-args:"yes"`
15+
BindingName flag.BindingName `long:"binding-name" description:"Name to expose service instance to app process with (Default: service instance name)"`
16+
ParametersAsJSON flag.JSONOrFileWithValidation `short:"c" description:"Valid JSON object containing service-specific configuration parameters, provided either in-line or in a file. For a list of supported configuration parameters, see documentation for the particular service offering."`
17+
Wait bool `short:"w" long:"wait" description:"Wait for the operation to complete"`
18+
relatedCommands interface{} `related_commands:"services"`
2219
}
2320

2421
func (cmd BindServiceCommand) Execute(args []string) error {
2522
if err := cmd.SharedActor.CheckTarget(true, true); err != nil {
2623
return err
2724
}
2825

29-
if cmd.ServiceBindingStrategy.IsSet {
30-
err := command.MinimumCCAPIVersionCheck(cmd.Config.APIVersion(), ccversion.MinVersionServiceBindingStrategy, "--strategy")
31-
if err != nil {
32-
return err
33-
}
34-
}
35-
3626
if err := cmd.displayIntro(); err != nil {
3727
return err
3828
}
@@ -43,7 +33,6 @@ func (cmd BindServiceCommand) Execute(args []string) error {
4333
AppName: cmd.RequiredArgs.AppName,
4434
BindingName: cmd.BindingName.Value,
4535
Parameters: types.OptionalObject(cmd.ParametersAsJSON),
46-
Strategy: cmd.ServiceBindingStrategy.Strategy,
4736
})
4837
cmd.UI.DisplayWarnings(warnings)
4938

@@ -93,12 +82,7 @@ Example of valid JSON object:
9382
9483
Optionally provide a binding name for the association between an app and a service instance:
9584
96-
CF_NAME bind-service APP_NAME SERVICE_INSTANCE --binding-name BINDING_NAME
97-
98-
Optionally provide the binding strategy type. Valid options are 'single' (default) and 'multiple'. The 'multiple' strategy allows multiple bindings between the same app and service instance.
99-
This is useful for credential rotation scenarios.
100-
101-
CF_NAME bind-service APP_NAME SERVICE_INSTANCE --strategy multiple`
85+
CF_NAME bind-service APP_NAME SERVICE_INSTANCE --binding-name BINDING_NAME`
10286
}
10387

10488
func (cmd BindServiceCommand) Examples() string {

command/v7/bind_service_command_test.go

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,8 @@ import (
66
"code.cloudfoundry.org/cli/v8/actor/actionerror"
77
"code.cloudfoundry.org/cli/v8/actor/v7action"
88
"code.cloudfoundry.org/cli/v8/command/commandfakes"
9-
"code.cloudfoundry.org/cli/v8/command/translatableerror"
109
v7 "code.cloudfoundry.org/cli/v8/command/v7"
1110
"code.cloudfoundry.org/cli/v8/command/v7/v7fakes"
12-
"code.cloudfoundry.org/cli/v8/resources"
1311
"code.cloudfoundry.org/cli/v8/types"
1412
"code.cloudfoundry.org/cli/v8/util/configv3"
1513
"code.cloudfoundry.org/cli/v8/util/ui"
@@ -41,7 +39,6 @@ var _ = Describe("bind-service Command", func() {
4139
BeforeEach(func() {
4240
testUI = ui.NewTestUI(NewBuffer(), NewBuffer(), NewBuffer())
4341
fakeConfig = new(commandfakes.FakeConfig)
44-
fakeConfig.APIVersionReturns("3.205.0")
4542
fakeSharedActor = new(commandfakes.FakeSharedActor)
4643
fakeActor = new(v7fakes.FakeActor)
4744

@@ -113,30 +110,6 @@ var _ = Describe("bind-service Command", func() {
113110
})
114111
})
115112

116-
When("strategy flag is set", func() {
117-
BeforeEach(func() {
118-
setFlag(&cmd, "--strategy", "multiple")
119-
})
120-
121-
It("passes the strategy to the actor", func() {
122-
Expect(executeErr).NotTo(HaveOccurred())
123-
Expect(fakeActor.CreateServiceAppBindingCallCount()).To(Equal(1))
124-
Expect(fakeActor.CreateServiceAppBindingArgsForCall(0).Strategy).
125-
To(Equal(resources.MultipleBindingStrategy))
126-
})
127-
128-
It("fails when the cc version is below the minimum", func() {
129-
fakeConfig.APIVersionReturns("3.204.0")
130-
executeErr = cmd.Execute(nil)
131-
132-
Expect(executeErr).To(MatchError(translatableerror.MinimumCFAPIVersionNotMetError{
133-
Command: "--strategy",
134-
CurrentVersion: "3.204.0",
135-
MinimumVersion: "3.205.0",
136-
}))
137-
})
138-
})
139-
140113
When("binding already exists", func() {
141114
BeforeEach(func() {
142115
fakeActor.CreateServiceAppBindingReturns(

integration/v7/isolated/bind_service_command_test.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,6 @@ var _ = Describe("bind-service command", func() {
4141
Say(`\n`),
4242
Say(`\s+cf bind-service APP_NAME SERVICE_INSTANCE --binding-name BINDING_NAME\n`),
4343
Say(`\n`),
44-
Say(`\s+Optionally provide the binding strategy type. Valid options are 'single' \(default\) and 'multiple'. The 'multiple' strategy allows multiple bindings between the same app and service instance.\n`),
45-
Say(`\s+This is useful for credential rotation scenarios.\n`),
46-
Say(`\n`),
47-
Say(`\s+cf bind-service APP_NAME SERVICE_INSTANCE --strategy multiple\n`),
4844
Say(`EXAMPLES:\n`),
4945
Say(`\s+Linux/Mac:\n`),
5046
Say(`\s+cf bind-service myapp mydb -c '\{"permissions":"read-only"\}'\n`),
@@ -63,7 +59,6 @@ var _ = Describe("bind-service command", func() {
6359
Say(`OPTIONS:\n`),
6460
Say(`\s+--binding-name\s+Name to expose service instance to app process with \(Default: service instance name\)\n`),
6561
Say(`\s+-c\s+Valid JSON object containing service-specific configuration parameters, provided either in-line or in a file. For a list of supported configuration parameters, see documentation for the particular service offering.\n`),
66-
Say(`\s+--strategy\s+Service binding strategy. Valid values are 'single' \(default\) and 'multiple'.\n`),
6762
Say(`\s+--wait, -w\s+Wait for the operation to complete\n`),
6863
Say(`\n`),
6964
Say(`SEE ALSO:\n`),

resources/service_credential_binding_resource.go

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,6 @@ const (
1212
KeyBinding ServiceCredentialBindingType = "key"
1313
)
1414

15-
type BindingStrategyType string
16-
17-
const (
18-
SingleBindingStrategy BindingStrategyType = "single"
19-
MultipleBindingStrategy BindingStrategyType = "multiple"
20-
)
21-
2215
type ServiceCredentialBinding struct {
2316
// Type is either "app" or "key"
2417
Type ServiceCredentialBindingType `jsonry:"type,omitempty"`
@@ -38,8 +31,6 @@ type ServiceCredentialBinding struct {
3831
LastOperation LastOperation `jsonry:"last_operation"`
3932
// Parameters can be specified when creating a binding
4033
Parameters types.OptionalObject `jsonry:"parameters"`
41-
// Strategy can be "single" or "multiple" (if empty, "single" is set as default by backend)
42-
Strategy BindingStrategyType `jsonry:"strategy,omitempty"`
4334
// CreatedAt timestamp when the binding was created (useful for distinguishing multiple bindings)
4435
CreatedAt string `json:"created_at,omitempty"`
4536
}

resources/service_credential_binding_resource_test.go

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -61,15 +61,6 @@ var _ = Describe("service credential binding resource", func() {
6161
}`,
6262
),
6363
Entry("created_at", ServiceCredentialBinding{CreatedAt: "fake-created-at"}, `{"created_at": "fake-created-at"}`),
64-
Entry(
65-
"strategy",
66-
ServiceCredentialBinding{
67-
Strategy: SingleBindingStrategy,
68-
},
69-
`{
70-
"strategy": "single"
71-
}`,
72-
),
7364
Entry(
7465
"everything",
7566
ServiceCredentialBinding{
@@ -81,7 +72,6 @@ var _ = Describe("service credential binding resource", func() {
8172
Parameters: types.NewOptionalObject(map[string]interface{}{
8273
"foo": "bar",
8374
}),
84-
Strategy: MultipleBindingStrategy,
8575
CreatedAt: "fake-created-at",
8676
},
8777
`{
@@ -103,7 +93,6 @@ var _ = Describe("service credential binding resource", func() {
10393
"parameters": {
10494
"foo": "bar"
10595
},
106-
"strategy": "multiple",
10796
"created_at": "fake-created-at"
10897
}`,
10998
),

0 commit comments

Comments
 (0)