diff --git a/cf/api/fakes/fake_service_binding_repo.go b/cf/api/fakes/fake_service_binding_repo.go index 02cfedb12fe..b37c9b81c08 100644 --- a/cf/api/fakes/fake_service_binding_repo.go +++ b/cf/api/fakes/fake_service_binding_repo.go @@ -9,6 +9,7 @@ type FakeServiceBindingRepo struct { CreateServiceInstanceGuid string CreateApplicationGuid string CreateErrorCode string + CreateParams map[string]interface{} DeleteServiceInstance models.ServiceInstance DeleteApplicationGuid string @@ -16,9 +17,11 @@ type FakeServiceBindingRepo struct { CreateNonHttpErrCode string } -func (repo *FakeServiceBindingRepo) Create(instanceGuid, appGuid string) (apiErr error) { +func (repo *FakeServiceBindingRepo) Create(instanceGuid, appGuid string, paramsMap map[string]interface{}) (apiErr error) { repo.CreateServiceInstanceGuid = instanceGuid repo.CreateApplicationGuid = appGuid + repo.CreateParams = paramsMap + if repo.CreateNonHttpErrCode != "" { apiErr = errors.New(repo.CreateNonHttpErrCode) return diff --git a/cf/api/fakes/fake_service_key_repo.go b/cf/api/fakes/fake_service_key_repo.go index 00f639f6a1b..efc8a1cd629 100644 --- a/cf/api/fakes/fake_service_key_repo.go +++ b/cf/api/fakes/fake_service_key_repo.go @@ -14,6 +14,7 @@ type FakeServiceKeyRepo struct { type CreateServiceKeyType struct { InstanceGuid string KeyName string + Params map[string]interface{} Error error } @@ -48,9 +49,10 @@ func NewFakeServiceKeyRepo() *FakeServiceKeyRepo { } } -func (f *FakeServiceKeyRepo) CreateServiceKey(instanceGuid string, serviceKeyName string) error { +func (f *FakeServiceKeyRepo) CreateServiceKey(instanceGuid string, serviceKeyName string, params map[string]interface{}) error { f.CreateServiceKeyMethod.InstanceGuid = instanceGuid f.CreateServiceKeyMethod.KeyName = serviceKeyName + f.CreateServiceKeyMethod.Params = params return f.CreateServiceKeyMethod.Error } diff --git a/cf/api/fakes/fake_service_repo.go b/cf/api/fakes/fake_service_repo.go index 3d09896b4a5..6c3bf6d3854 100644 --- a/cf/api/fakes/fake_service_repo.go +++ b/cf/api/fakes/fake_service_repo.go @@ -48,6 +48,7 @@ type FakeServiceRepo struct { UpdateServiceInstanceArgs struct { InstanceGuid string PlanGuid string + Params map[string]interface{} } UpdateServiceInstanceReturnsErr bool @@ -149,13 +150,14 @@ func (repo *FakeServiceRepo) CreateServiceInstance(name, planGuid string, params return repo.CreateServiceInstanceReturns.Error } -func (repo *FakeServiceRepo) UpdateServiceInstance(instanceGuid, planGuid string) (apiErr error) { +func (repo *FakeServiceRepo) UpdateServiceInstance(instanceGuid, planGuid string, params map[string]interface{}) (apiErr error) { if repo.UpdateServiceInstanceReturnsErr { apiErr = errors.New("Error updating service instance") } else { repo.UpdateServiceInstanceArgs.InstanceGuid = instanceGuid repo.UpdateServiceInstanceArgs.PlanGuid = planGuid + repo.UpdateServiceInstanceArgs.Params = params } return diff --git a/cf/api/service_bindings.go b/cf/api/service_bindings.go index 86f81c262e3..145342dde76 100644 --- a/cf/api/service_bindings.go +++ b/cf/api/service_bindings.go @@ -1,8 +1,8 @@ package api import ( - "fmt" - "strings" + "bytes" + "encoding/json" "github.com/cloudfoundry/cli/cf/configuration/core_config" "github.com/cloudfoundry/cli/cf/models" @@ -10,7 +10,7 @@ import ( ) type ServiceBindingRepository interface { - Create(instanceGuid, appGuid string) (apiErr error) + Create(instanceGuid, appGuid string, paramsMap map[string]interface{}) (apiErr error) Delete(instance models.ServiceInstance, appGuid string) (found bool, apiErr error) } @@ -25,13 +25,20 @@ func NewCloudControllerServiceBindingRepository(config core_config.Reader, gatew return } -func (repo CloudControllerServiceBindingRepository) Create(instanceGuid, appGuid string) (apiErr error) { +func (repo CloudControllerServiceBindingRepository) Create(instanceGuid, appGuid string, paramsMap map[string]interface{}) (apiErr error) { path := "/v2/service_bindings" - body := fmt.Sprintf( - `{"app_guid":"%s","service_instance_guid":"%s","async":true}`, - appGuid, instanceGuid, - ) - return repo.gateway.CreateResource(repo.config.ApiEndpoint(), path, strings.NewReader(body)) + request := models.ServiceBindingRequest{ + AppGuid: appGuid, + ServiceInstanceGuid: instanceGuid, + Params: paramsMap, + } + + jsonBytes, err := json.Marshal(request) + if err != nil { + return err + } + + return repo.gateway.CreateResource(repo.config.ApiEndpoint(), path, bytes.NewReader(jsonBytes)) } func (repo CloudControllerServiceBindingRepository) Delete(instance models.ServiceInstance, appGuid string) (found bool, apiErr error) { diff --git a/cf/api/service_bindings_test.go b/cf/api/service_bindings_test.go index 39c94bb69e6..fcc2eca6e6b 100644 --- a/cf/api/service_bindings_test.go +++ b/cf/api/service_bindings_test.go @@ -45,30 +45,59 @@ var _ = Describe("ServiceBindingsRepository", func() { }) Describe("Create", func() { + var requestMatcher testnet.RequestMatcher Context("when the service binding can be created", func() { BeforeEach(func() { + requestMatcher = testnet.RequestBodyMatcher(`{"app_guid":"my-app-guid","service_instance_guid":"my-service-instance-guid"}`) + }) + + JustBeforeEach(func() { setupTestServer(testapi.NewCloudControllerTestRequest(testnet.TestRequest{ Method: "POST", Path: "/v2/service_bindings", - Matcher: testnet.RequestBodyMatcher(`{"app_guid":"my-app-guid","service_instance_guid":"my-service-instance-guid","async":true}`), + Matcher: requestMatcher, Response: testnet.TestResponse{Status: http.StatusCreated}, })) }) It("creates the service binding", func() { - apiErr := repo.Create("my-service-instance-guid", "my-app-guid") + apiErr := repo.Create("my-service-instance-guid", "my-app-guid", nil) Expect(testHandler).To(HaveAllRequestsCalled()) Expect(apiErr).NotTo(HaveOccurred()) }) + + Context("when there are arbitrary parameters", func() { + BeforeEach(func() { + requestMatcher = testnet.RequestBodyMatcher(`{"app_guid":"my-app-guid","service_instance_guid":"my-service-instance-guid", "parameters": { "foo": "bar"}}`) + }) + + It("send the parameters as part of the request body", func() { + paramsMap := map[string]interface{}{"foo": "bar"} + apiErr := repo.Create("my-service-instance-guid", "my-app-guid", paramsMap) + + Expect(testHandler).To(HaveAllRequestsCalled()) + Expect(apiErr).NotTo(HaveOccurred()) + }) + + Context("and there is a failure during serialization", func() { + It("returns the serialization error", func() { + paramsMap := make(map[string]interface{}) + paramsMap["data"] = make(chan bool) + + err := repo.Create("my-service-instance-guid", "my-app-guid", paramsMap) + Expect(err).To(MatchError("json: unsupported type: chan bool")) + }) + }) + }) }) - Context("when an error occurs", func() { + Context("when an API error occurs", func() { BeforeEach(func() { setupTestServer(testapi.NewCloudControllerTestRequest(testnet.TestRequest{ Method: "POST", Path: "/v2/service_bindings", - Matcher: testnet.RequestBodyMatcher(`{"app_guid":"my-app-guid","service_instance_guid":"my-service-instance-guid","async":true}`), + Matcher: testnet.RequestBodyMatcher(`{"app_guid":"my-app-guid","service_instance_guid":"my-service-instance-guid"}`), Response: testnet.TestResponse{ Status: http.StatusBadRequest, Body: `{"code":90003,"description":"The app space binding to service is taken: 7b959018-110a-4913-ac0a-d663e613cdea 346bf237-7eef-41a7-b892-68fb08068f09"}`, @@ -77,7 +106,7 @@ var _ = Describe("ServiceBindingsRepository", func() { }) It("returns an error", func() { - apiErr := repo.Create("my-service-instance-guid", "my-app-guid") + apiErr := repo.Create("my-service-instance-guid", "my-app-guid", nil) Expect(testHandler).To(HaveAllRequestsCalled()) Expect(apiErr).To(HaveOccurred()) diff --git a/cf/api/service_keys.go b/cf/api/service_keys.go index fb8a51f2bab..72ae3c65e49 100644 --- a/cf/api/service_keys.go +++ b/cf/api/service_keys.go @@ -1,9 +1,10 @@ package api import ( + "bytes" + "encoding/json" "fmt" "net/url" - "strings" "github.com/cloudfoundry/cli/cf/api/resources" "github.com/cloudfoundry/cli/cf/configuration/core_config" @@ -13,7 +14,7 @@ import ( ) type ServiceKeyRepository interface { - CreateServiceKey(serviceKeyGuid string, keyName string) error + CreateServiceKey(serviceKeyGuid string, keyName string, params map[string]interface{}) error ListServiceKeys(serviceKeyGuid string) ([]models.ServiceKey, error) GetServiceKey(serviceKeyGuid string, keyName string) (models.ServiceKey, error) DeleteServiceKey(serviceKeyGuid string) error @@ -31,11 +32,20 @@ func NewCloudControllerServiceKeyRepository(config core_config.Reader, gateway n } } -func (c CloudControllerServiceKeyRepository) CreateServiceKey(instanceGuid string, keyName string) error { +func (c CloudControllerServiceKeyRepository) CreateServiceKey(instanceGuid string, keyName string, params map[string]interface{}) error { path := "/v2/service_keys" - data := fmt.Sprintf(`{"service_instance_guid":"%s","name":"%s"}`, instanceGuid, keyName) - err := c.gateway.CreateResource(c.config.ApiEndpoint(), path, strings.NewReader(data)) + request := models.ServiceKeyRequest{ + Name: keyName, + ServiceInstanceGuid: instanceGuid, + Params: params, + } + jsonBytes, err := json.Marshal(request) + if err != nil { + return err + } + + err = c.gateway.CreateResource(c.config.ApiEndpoint(), path, bytes.NewReader(jsonBytes)) if httpErr, ok := err.(errors.HttpError); ok && httpErr.ErrorCode() == errors.SERVICE_KEY_NAME_TAKEN { return errors.NewModelAlreadyExistsError("Service key", keyName) diff --git a/cf/api/service_keys_test.go b/cf/api/service_keys_test.go index 6e30d0a5d29..18d695e47f8 100644 --- a/cf/api/service_keys_test.go +++ b/cf/api/service_keys_test.go @@ -52,7 +52,7 @@ var _ = Describe("Service Keys Repo", func() { Response: testnet.TestResponse{Status: http.StatusCreated}, })) - err := repo.CreateServiceKey("fake-instance-guid", "fake-key-name") + err := repo.CreateServiceKey("fake-instance-guid", "fake-key-name", nil) Expect(testHandler).To(HaveAllRequestsCalled()) Expect(err).NotTo(HaveOccurred()) }) @@ -67,7 +67,7 @@ var _ = Describe("Service Keys Repo", func() { Body: `{"code":360001,"description":"The service key name is taken: exist-service-key"}`}, })) - err := repo.CreateServiceKey("fake-instance-guid", "exist-service-key") + err := repo.CreateServiceKey("fake-instance-guid", "exist-service-key", nil) Expect(testHandler).To(HaveAllRequestsCalled()) Expect(err).To(BeAssignableToTypeOf(&errors.ModelAlreadyExistsError{})) }) @@ -82,11 +82,39 @@ var _ = Describe("Service Keys Repo", func() { Body: `{"code":10003,"description":"You are not authorized to perform the requested action"}`}, })) - err := repo.CreateServiceKey("fake-instance-guid", "fake-service-key") + err := repo.CreateServiceKey("fake-instance-guid", "fake-service-key", nil) Expect(testHandler).To(HaveAllRequestsCalled()) Expect(err).To(HaveOccurred()) Expect(err.Error()).To(ContainSubstring("You are not authorized to perform the requested action")) }) + + Context("when there are parameters", func() { + It("sends the parameters as part of the request body", func() { + setupTestServer(testapi.NewCloudControllerTestRequest(testnet.TestRequest{ + Method: "POST", + Path: "/v2/service_keys", + Matcher: testnet.RequestBodyMatcher(`{"service_instance_guid":"fake-instance-guid","name":"fake-service-key","parameters": {"data": "hello"}}`), + Response: testnet.TestResponse{Status: http.StatusCreated}, + })) + + paramsMap := make(map[string]interface{}) + paramsMap["data"] = "hello" + + err := repo.CreateServiceKey("fake-instance-guid", "fake-service-key", paramsMap) + Expect(testHandler).To(HaveAllRequestsCalled()) + Expect(err).NotTo(HaveOccurred()) + }) + + Context("and there is a failure during serialization", func() { + It("returns the serialization error", func() { + paramsMap := make(map[string]interface{}) + paramsMap["data"] = make(chan bool) + + err := repo.CreateServiceKey("instance-name", "plan-guid", paramsMap) + Expect(err).To(MatchError("json: unsupported type: chan bool")) + }) + }) + }) }) Describe("ListServiceKeys", func() { diff --git a/cf/api/services.go b/cf/api/services.go index 8c5412585cb..593261d8164 100644 --- a/cf/api/services.go +++ b/cf/api/services.go @@ -26,7 +26,7 @@ type ServiceRepository interface { GetServiceOfferingsForSpace(spaceGuid string) (offerings models.ServiceOfferings, apiErr error) FindInstanceByName(name string) (instance models.ServiceInstance, apiErr error) CreateServiceInstance(name, planGuid string, params map[string]interface{}) (apiErr error) - UpdateServiceInstance(instanceGuid, planGuid string) (apiErr error) + UpdateServiceInstance(instanceGuid, planGuid string, params map[string]interface{}) (apiErr error) RenameService(instance models.ServiceInstance, newName string) (apiErr error) DeleteService(instance models.ServiceInstance) (apiErr error) FindServicePlanByDescription(planDescription resources.ServicePlanDescription) (planGuid string, apiErr error) @@ -136,7 +136,7 @@ func (repo CloudControllerServiceRepository) FindInstanceByName(name string) (in func (repo CloudControllerServiceRepository) CreateServiceInstance(name, planGuid string, params map[string]interface{}) (err error) { path := "/v2/service_instances?accepts_incomplete=true" - request := models.ServiceInstanceRequest{ + request := models.ServiceInstanceCreateRequest{ Name: name, PlanGuid: planGuid, SpaceGuid: repo.config.SpaceFields().Guid, @@ -145,7 +145,6 @@ func (repo CloudControllerServiceRepository) CreateServiceInstance(name, planGui jsonBytes, err := json.Marshal(request) if err != nil { - fmt.Println(err.Error()) return err } @@ -162,11 +161,19 @@ func (repo CloudControllerServiceRepository) CreateServiceInstance(name, planGui return } -func (repo CloudControllerServiceRepository) UpdateServiceInstance(instanceGuid, planGuid string) (err error) { +func (repo CloudControllerServiceRepository) UpdateServiceInstance(instanceGuid, planGuid string, params map[string]interface{}) (err error) { path := fmt.Sprintf("/v2/service_instances/%s?accepts_incomplete=true", instanceGuid) - data := fmt.Sprintf(`{"service_plan_guid":"%s"}`, planGuid) + request := models.ServiceInstanceUpdateRequest{ + PlanGuid: planGuid, + Params: params, + } + + jsonBytes, err := json.Marshal(request) + if err != nil { + return err + } - err = repo.gateway.UpdateResource(repo.config.ApiEndpoint(), path, strings.NewReader(data)) + err = repo.gateway.UpdateResource(repo.config.ApiEndpoint(), path, bytes.NewReader(jsonBytes)) return } diff --git a/cf/api/services_test.go b/cf/api/services_test.go index b998daa876f..ba3986c071d 100644 --- a/cf/api/services_test.go +++ b/cf/api/services_test.go @@ -224,15 +224,15 @@ var _ = Describe("Services Repo", func() { Expect(testHandler).To(HaveAllRequestsCalled()) Expect(err).NotTo(HaveOccurred()) }) - }) - Context("and there is a failure during serialization", func() { - It("returns the serialization error", func() { - paramsMap := make(map[string]interface{}) - paramsMap["data"] = make(chan bool) + Context("and there is a failure during serialization", func() { + It("returns the serialization error", func() { + paramsMap := make(map[string]interface{}) + paramsMap["data"] = make(chan bool) - err := repo.CreateServiceInstance("instance-name", "plan-guid", paramsMap) - Expect(err).To(MatchError("json: unsupported type: chan bool")) + err := repo.CreateServiceInstance("instance-name", "plan-guid", paramsMap) + Expect(err).To(MatchError("json: unsupported type: chan bool")) + }) }) }) @@ -292,7 +292,7 @@ var _ = Describe("Services Repo", func() { Response: testnet.TestResponse{Status: http.StatusOK}, })) - err := repo.UpdateServiceInstance("instance-guid", "plan-guid") + err := repo.UpdateServiceInstance("instance-guid", "plan-guid", nil) Expect(testHandler).To(HaveAllRequestsCalled()) Expect(err).NotTo(HaveOccurred()) }) @@ -306,11 +306,38 @@ var _ = Describe("Services Repo", func() { Response: testnet.TestResponse{Status: http.StatusNotFound}, })) - err := repo.UpdateServiceInstance("instance-guid", "plan-guid") + err := repo.UpdateServiceInstance("instance-guid", "plan-guid", nil) Expect(testHandler).To(HaveAllRequestsCalled()) Expect(err).To(HaveOccurred()) }) }) + + Context("when the user passes arbitrary params", func() { + It("passes the parameters in the correct field for the request", func() { + setupTestServer(testapi.NewCloudControllerTestRequest(testnet.TestRequest{ + Method: "PUT", + Path: "/v2/service_instances/instance-guid?accepts_incomplete=true", + Matcher: testnet.RequestBodyMatcher(`{"service_plan_guid":"plan-guid", "parameters": {"foo": "bar"}}`), + Response: testnet.TestResponse{Status: http.StatusOK}, + })) + + paramsMap := map[string]interface{}{"foo": "bar"} + + err := repo.UpdateServiceInstance("instance-guid", "plan-guid", paramsMap) + Expect(testHandler).To(HaveAllRequestsCalled()) + Expect(err).NotTo(HaveOccurred()) + }) + + Context("and there is a failure during serialization", func() { + It("returns the serialization error", func() { + paramsMap := make(map[string]interface{}) + paramsMap["data"] = make(chan bool) + + err := repo.UpdateServiceInstance("instance-guid", "plan-guid", paramsMap) + Expect(err).To(MatchError("json: unsupported type: chan bool")) + }) + }) + }) }) Describe("finding service instances by name", func() { diff --git a/cf/commands/application/push.go b/cf/commands/application/push.go index 6c5cb1fc7c0..a1760a77066 100644 --- a/cf/commands/application/push.go +++ b/cf/commands/application/push.go @@ -247,7 +247,7 @@ func (cmd *Push) bindAppToServices(services []string, app models.Application) { "SpaceName": terminal.EntityNameColor(cmd.config.SpaceFields().Name), "Username": terminal.EntityNameColor(cmd.config.Username())})) - err = cmd.serviceBinder.BindApplication(app, serviceInstance) + err = cmd.serviceBinder.BindApplication(app, serviceInstance, nil) switch httpErr := err.(type) { case errors.HttpError: diff --git a/cf/commands/service/bind_service.go b/cf/commands/service/bind_service.go index 54157defb98..7f74f01a86f 100644 --- a/cf/commands/service/bind_service.go +++ b/cf/commands/service/bind_service.go @@ -6,10 +6,12 @@ import ( "github.com/cloudfoundry/cli/cf/command_metadata" "github.com/cloudfoundry/cli/cf/configuration/core_config" "github.com/cloudfoundry/cli/cf/errors" + "github.com/cloudfoundry/cli/cf/flag_helpers" . "github.com/cloudfoundry/cli/cf/i18n" "github.com/cloudfoundry/cli/cf/models" "github.com/cloudfoundry/cli/cf/requirements" "github.com/cloudfoundry/cli/cf/terminal" + "github.com/cloudfoundry/cli/json" "github.com/codegangsta/cli" ) @@ -22,7 +24,7 @@ type BindService struct { } type ServiceBinder interface { - BindApplication(app models.Application, serviceInstance models.ServiceInstance) (apiErr error) + BindApplication(app models.Application, serviceInstance models.ServiceInstance, paramsMap map[string]interface{}) (apiErr error) } func NewBindService(ui terminal.UI, config core_config.Reader, serviceBindingRepo api.ServiceBindingRepository) (cmd *BindService) { @@ -38,7 +40,36 @@ func (cmd *BindService) Metadata() command_metadata.CommandMetadata { Name: "bind-service", ShortName: "bs", Description: T("Bind a service instance to an app"), - Usage: T("CF_NAME bind-service APP_NAME SERVICE_INSTANCE"), + Usage: T(`CF_NAME bind-service APP_NAME SERVICE_INSTANCE [-c PARAMETERS_AS_JSON] + + Optionally provide service-specific configuration parameters in a valid JSON object in-line. + CF_NAME bind-service APP_NAME SERVICE_INSTANCE -c '{"name":"value","name":"value"}' + + Optionally provide a file containing service-specific configuration parameters in a valid JSON object. The path to the parameters file can be an absolute or relative path to a file. + CF_NAME bind-service APP_NAME SERVICE_INSTANCE -c PATH_TO_FILE + + Example of valid JSON object: + { + "cluster_nodes": { + "count": 5, + "memory_mb": 1024 + } + } + +EXAMPLE: + Linux/Mac: + CF_NAME bind-service myapp mydb -c '{"permissions":"read-only"}' + + Windows Command Line + CF_NAME bind-service myapp mydb -c "{\"permissions\":\"read-only\"}" + + Windows PowerShell + CF_NAME bind-service myapp mydb -c '{\"permissions\":\"read-only\"}' + + CF_NAME bind-service myapp mydb -c ~/workspace/tmp/instance_config.json`), + Flags: []cli.Flag{ + flag_helpers.NewStringFlag("c", T("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.")), + }, } } @@ -65,6 +96,12 @@ func (cmd *BindService) GetRequirements(requirementsFactory requirements.Factory func (cmd *BindService) Run(c *cli.Context) { app := cmd.appReq.GetApplication() serviceInstance := cmd.serviceInstanceReq.GetServiceInstance() + params := c.String("c") + + paramsMap, err := json.ParseJsonFromFileOrString(params) + if err != nil { + cmd.ui.Failed(T("Invalid configuration provided for -c flag. Please provide a valid JSON object or a file path containing valid JSON.")) + } cmd.ui.Say(T("Binding service {{.ServiceInstanceName}} to app {{.AppName}} in org {{.OrgName}} / space {{.SpaceName}} as {{.CurrentUser}}...", map[string]interface{}{ @@ -75,7 +112,7 @@ func (cmd *BindService) Run(c *cli.Context) { "CurrentUser": terminal.EntityNameColor(cmd.config.Username()), })) - err := cmd.BindApplication(app, serviceInstance) + err = cmd.BindApplication(app, serviceInstance, paramsMap) if err != nil { if httperr, ok := err.(errors.HttpError); ok && httperr.ErrorCode() == errors.APP_ALREADY_BOUND { cmd.ui.Ok() @@ -95,7 +132,7 @@ func (cmd *BindService) Run(c *cli.Context) { map[string]interface{}{"CFCommand": terminal.CommandColor(cf.Name() + " restage"), "AppName": app.Name})) } -func (cmd *BindService) BindApplication(app models.Application, serviceInstance models.ServiceInstance) (apiErr error) { - apiErr = cmd.serviceBindingRepo.Create(serviceInstance.Guid, app.Guid) +func (cmd *BindService) BindApplication(app models.Application, serviceInstance models.ServiceInstance, paramsMap map[string]interface{}) (apiErr error) { + apiErr = cmd.serviceBindingRepo.Create(serviceInstance.Guid, app.Guid, paramsMap) return } diff --git a/cf/commands/service/bind_service_test.go b/cf/commands/service/bind_service_test.go index 4b1128afa62..560745803d7 100644 --- a/cf/commands/service/bind_service_test.go +++ b/cf/commands/service/bind_service_test.go @@ -1,6 +1,9 @@ package service_test import ( + "io/ioutil" + "os" + "github.com/cloudfoundry/cli/cf/api" testapi "github.com/cloudfoundry/cli/cf/api/fakes" . "github.com/cloudfoundry/cli/cf/commands/service" @@ -108,6 +111,109 @@ var _ = Describe("bind-service command", func() { ui = callBindService([]string{"my-app", "my-service"}, requirementsFactory, serviceBindingRepo) Expect(ui.FailedWithUsage).To(BeFalse()) }) + + Context("when passing arbitrary params", func() { + var ( + app models.Application + serviceInstance models.ServiceInstance + ) + + BeforeEach(func() { + app = models.Application{} + app.Name = "my-app" + app.Guid = "my-app-guid" + + serviceInstance = models.ServiceInstance{} + serviceInstance.Name = "my-service" + serviceInstance.Guid = "my-service-guid" + + requirementsFactory.Application = app + requirementsFactory.ServiceInstance = serviceInstance + }) + + Context("as a json string", func() { + It("successfully creates a service and passes the params as a json string", func() { + serviceBindingRepo := &testapi.FakeServiceBindingRepo{} + ui := callBindService([]string{"my-app", "my-service", "-c", `{"foo": "bar"}`}, requirementsFactory, serviceBindingRepo) + + Expect(ui.Outputs).To(ContainSubstrings( + []string{"Binding service", "my-service", "my-app", "my-org", "my-space", "my-user"}, + []string{"OK"}, + []string{"TIP"}, + )) + Expect(serviceBindingRepo.CreateServiceInstanceGuid).To(Equal("my-service-guid")) + Expect(serviceBindingRepo.CreateApplicationGuid).To(Equal("my-app-guid")) + Expect(serviceBindingRepo.CreateParams).To(Equal(map[string]interface{}{"foo": "bar"})) + }) + + Context("that are not valid json", func() { + It("returns an error to the UI", func() { + serviceBindingRepo := &testapi.FakeServiceBindingRepo{} + ui := callBindService([]string{"my-app", "my-service", "-c", `bad-json`}, requirementsFactory, serviceBindingRepo) + + Expect(ui.Outputs).To(ContainSubstrings( + []string{"FAILED"}, + []string{"Invalid configuration provided for -c flag. Please provide a valid JSON object or a file path containing valid JSON."}, + )) + }) + }) + }) + + Context("as a file that contains json", func() { + var jsonFile *os.File + var params string + + BeforeEach(func() { + params = "{\"foo\": \"bar\"}" + }) + + AfterEach(func() { + if jsonFile != nil { + jsonFile.Close() + os.Remove(jsonFile.Name()) + } + }) + + JustBeforeEach(func() { + var err error + jsonFile, err = ioutil.TempFile("", "") + Expect(err).ToNot(HaveOccurred()) + + err = ioutil.WriteFile(jsonFile.Name(), []byte(params), os.ModePerm) + Expect(err).NotTo(HaveOccurred()) + }) + + It("successfully creates a service and passes the params as a json", func() { + serviceBindingRepo := &testapi.FakeServiceBindingRepo{} + ui := callBindService([]string{"my-app", "my-service", "-c", jsonFile.Name()}, requirementsFactory, serviceBindingRepo) + + Expect(ui.Outputs).To(ContainSubstrings( + []string{"Binding service", "my-service", "my-app", "my-org", "my-space", "my-user"}, + []string{"OK"}, + []string{"TIP"}, + )) + Expect(serviceBindingRepo.CreateServiceInstanceGuid).To(Equal("my-service-guid")) + Expect(serviceBindingRepo.CreateApplicationGuid).To(Equal("my-app-guid")) + Expect(serviceBindingRepo.CreateParams).To(Equal(map[string]interface{}{"foo": "bar"})) + }) + + Context("that are not valid json", func() { + BeforeEach(func() { + params = "bad-json" + }) + + It("returns an error to the UI", func() { + serviceBindingRepo := &testapi.FakeServiceBindingRepo{} + ui := callBindService([]string{"my-app", "my-service", "-c", jsonFile.Name()}, requirementsFactory, serviceBindingRepo) + + Expect(ui.Outputs).To(ContainSubstrings( + []string{"FAILED"}, + []string{"Invalid configuration provided for -c flag. Please provide a valid JSON object or a file path containing valid JSON."}, + )) + }) + }) + }) + }) }) }) diff --git a/cf/commands/service/create_service.go b/cf/commands/service/create_service.go index 729c19e388f..7150163c0f5 100644 --- a/cf/commands/service/create_service.go +++ b/cf/commands/service/create_service.go @@ -1,8 +1,6 @@ package service import ( - "encoding/json" - "github.com/cloudfoundry/cli/cf/actors/service_builder" "github.com/cloudfoundry/cli/cf/api" "github.com/cloudfoundry/cli/cf/command_metadata" @@ -13,7 +11,7 @@ import ( "github.com/cloudfoundry/cli/cf/models" "github.com/cloudfoundry/cli/cf/requirements" "github.com/cloudfoundry/cli/cf/terminal" - cli_json "github.com/cloudfoundry/cli/json" + "github.com/cloudfoundry/cli/json" "github.com/codegangsta/cli" ) @@ -37,10 +35,33 @@ func (cmd CreateService) Metadata() command_metadata.CommandMetadata { Name: "create-service", ShortName: "cs", Description: T("Create a service instance"), - Usage: T(`CF_NAME create-service SERVICE PLAN SERVICE_INSTANCE + Usage: T(`CF_NAME create-service SERVICE PLAN SERVICE_INSTANCE [-c PARAMETERS_AS_JSON] + + Optionally provide service-specific configuration parameters in a valid JSON object in-line: + CF_NAME create-service SERVICE PLAN SERVICE_INSTANCE -c '{"name":"value","name":"value"}' + + Optionally provide a file containing service-specific configuration parameters in a valid JSON object. The path to the parameters file can be an absolute or relative path to a file. + CF_NAME create-service SERVICE_INSTANCE -c PATH_TO_FILE + + Example of valid JSON object: + { + "cluster_nodes": { + "count": 5, + "memory_mb": 1024 + } + } EXAMPLE: - CF_NAME create-service dbaas silver mydb + Linux/Mac: + CF_NAME create-service db-service silver -c '{"ram_gb":4}' + + Windows Command Line + CF_NAME create-service db-service silver -c "{\"ram_gb\":4}" + + Windows PowerShell + CF_NAME create-service db-service silver -c '{\"ram_gb\":4}' + + CF_NAME create-service db-service silver mydb -c ~/workspace/tmp/instance_config.json TIP: Use 'CF_NAME create-user-provided-service' to make user-provided services available to cf apps`), @@ -69,10 +90,9 @@ func (cmd CreateService) Run(c *cli.Context) { serviceInstanceName := c.Args()[2] params := c.String("c") - paramsMap := make(map[string]interface{}) - paramsMap, err := cmd.parseArbitraryParams(params) - if err != nil && params != "" { - cmd.ui.Failed(T("Invalid JSON provided in -c argument")) + paramsMap, err := json.ParseJsonFromFileOrString(params) + if err != nil { + cmd.ui.Failed(T("Invalid configuration provided for -c flag. Please provide a valid JSON object or a file path containing valid JSON.")) } cmd.ui.Say(T("Creating service instance {{.ServiceName}} in org {{.OrgName}} / space {{.SpaceName}} as {{.CurrentUser}}...", @@ -125,21 +145,6 @@ func (cmd CreateService) CreateService(serviceName, planName, serviceInstanceNam return plan, apiErr } -func (cmd CreateService) parseArbitraryParams(paramsFileOrJson string) (map[string]interface{}, error) { - var paramsMap map[string]interface{} - var err error - - paramsMap, err = cli_json.ParseJsonHash(paramsFileOrJson) - if err != nil { - paramsMap = make(map[string]interface{}) - err = json.Unmarshal([]byte(paramsFileOrJson), ¶msMap) - if err != nil && paramsFileOrJson != "" { - return nil, err - } - } - return paramsMap, nil -} - func findPlanFromOfferings(offerings models.ServiceOfferings, name string) (plan models.ServicePlanFields, err error) { for _, offering := range offerings { for _, plan := range offering.Plans { diff --git a/cf/commands/service/create_service_test.go b/cf/commands/service/create_service_test.go index e62218e2754..c1709fe42d9 100644 --- a/cf/commands/service/create_service_test.go +++ b/cf/commands/service/create_service_test.go @@ -116,7 +116,7 @@ var _ = Describe("create-service command", func() { Expect(ui.Outputs).To(ContainSubstrings( []string{"FAILED"}, - []string{"Invalid JSON provided in -c argument"}, + []string{"Invalid configuration provided for -c flag. Please provide a valid JSON object or a file path containing valid JSON."}, )) }) }) @@ -146,7 +146,7 @@ var _ = Describe("create-service command", func() { Expect(err).NotTo(HaveOccurred()) }) - It("successfully creates a service and passes the params as a json string", func() { + It("successfully creates a service and passes the params as a json", func() { callCreateService([]string{"cleardb", "spark", "my-cleardb-service", "-c", jsonFile.Name()}) Expect(ui.Outputs).To(ContainSubstrings( @@ -166,7 +166,7 @@ var _ = Describe("create-service command", func() { Expect(ui.Outputs).To(ContainSubstrings( []string{"FAILED"}, - []string{"Invalid JSON provided in -c argument"}, + []string{"Invalid configuration provided for -c flag. Please provide a valid JSON object or a file path containing valid JSON."}, )) }) }) diff --git a/cf/commands/service/update_service.go b/cf/commands/service/update_service.go index b73ff707d8a..611de8e078d 100644 --- a/cf/commands/service/update_service.go +++ b/cf/commands/service/update_service.go @@ -14,6 +14,7 @@ import ( "github.com/cloudfoundry/cli/cf/models" "github.com/cloudfoundry/cli/cf/requirements" "github.com/cloudfoundry/cli/cf/terminal" + "github.com/cloudfoundry/cli/json" "github.com/codegangsta/cli" ) @@ -37,9 +38,29 @@ func (cmd *UpdateService) Metadata() command_metadata.CommandMetadata { return command_metadata.CommandMetadata{ Name: "update-service", Description: T("Update a service instance"), - Usage: T("CF_NAME update-service SERVICE [-p NEW_PLAN]"), + Usage: T(`CF_NAME update-service SERVICE_INSTANCE [-p NEW_PLAN] [-c PARAMETERS_AS_JSON] + + Optionally provide service-specific configuration parameters in a valid JSON object in-line. + cf create--service SERVICE PLAN SERVICE_INSTANCE -c '{"name":"value","name":"value"}' + + Optionally provide a file containing service-specific configuration parameters in a valid JSON object. The path to the parameters file can be an absolute or relative path to a file. + cf create-service SERVICE_INSTANCE -c PATH_TO_FILE + + Example of valid JSON object: + { + "cluster_nodes": { + "count": 5, + "memory_mb": 1024 + } + } + +EXAMPLE: + cf update-service mydb -p gold + cf update-service mydb -c '{"ram_gb":4}' + cf update-service mydb -c ~/workspace/tmp/instance_config.json`), Flags: []cli.Flag{ flag_helpers.NewStringFlag("p", T("Change service plan for a service instance")), + flag_helpers.NewStringFlag("c", T("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.")), }, } } @@ -67,6 +88,11 @@ func (cmd *UpdateService) Run(c *cli.Context) { } planName := c.String("p") + params := c.String("c") + paramsMap, err := json.ParseJsonFromFileOrString(params) + if err != nil { + cmd.ui.Failed(T("Invalid configuration provided for -c flag. Please provide a valid JSON object or a file path containing valid JSON.")) + } if planName != "" { cmd.ui.Say(T("Updating service instance {{.ServiceName}} as {{.UserName}}...", @@ -76,7 +102,7 @@ func (cmd *UpdateService) Run(c *cli.Context) { })) if cmd.config.IsMinApiVersion("2.16.0") { - err := cmd.updateServiceWithPlan(serviceInstance, planName) + err := cmd.updateServiceWithPlan(serviceInstance, planName, paramsMap) switch err.(type) { case nil: err = printSuccessMessageForServiceInstance(serviceInstanceName, cmd.serviceRepo, cmd.ui) @@ -99,7 +125,7 @@ func (cmd *UpdateService) Run(c *cli.Context) { } } -func (cmd *UpdateService) updateServiceWithPlan(serviceInstance models.ServiceInstance, planName string) (err error) { +func (cmd *UpdateService) updateServiceWithPlan(serviceInstance models.ServiceInstance, planName string, paramsMap map[string]interface{}) (err error) { plans, err := cmd.planBuilder.GetPlansForServiceForOrg(serviceInstance.ServiceOffering.Guid, cmd.config.OrganizationFields().Name) if err != nil { return @@ -107,7 +133,7 @@ func (cmd *UpdateService) updateServiceWithPlan(serviceInstance models.ServiceIn for _, plan := range plans { if plan.Name == planName { - err = cmd.serviceRepo.UpdateServiceInstance(serviceInstance.Guid, plan.Guid) + err = cmd.serviceRepo.UpdateServiceInstance(serviceInstance.Guid, plan.Guid, paramsMap) return } } diff --git a/cf/commands/service/update_service_test.go b/cf/commands/service/update_service_test.go index 2bf9f7b04fe..f8c631078da 100644 --- a/cf/commands/service/update_service_test.go +++ b/cf/commands/service/update_service_test.go @@ -2,6 +2,8 @@ package service_test import ( "errors" + "io/ioutil" + "os" testplanbuilder "github.com/cloudfoundry/cli/cf/actors/plan_builder/fakes" testapi "github.com/cloudfoundry/cli/cf/api/fakes" @@ -100,7 +102,119 @@ var _ = Describe("update-service command", func() { }) }) - Context("when service creation is asynchronous", func() { + Context("when passing arbitrary params", func() { + BeforeEach(func() { + serviceInstance := models.ServiceInstance{ + ServiceInstanceFields: models.ServiceInstanceFields{ + Name: "my-service-instance", + Guid: "my-service-instance-guid", + LastOperation: models.LastOperationFields{ + Type: "update", + State: "in progress", + Description: "fake service instance description", + }, + }, + ServiceOffering: models.ServiceOfferingFields{ + Label: "murkydb", + Guid: "murkydb-guid", + }, + } + + servicePlans := []models.ServicePlanFields{{ + Name: "spark", + Guid: "murkydb-spark-guid", + }, { + Name: "flare", + Guid: "murkydb-flare-guid", + }, + } + serviceRepo.FindInstanceByNameServiceInstance = serviceInstance + planBuilder.GetPlansForServiceForOrgReturns(servicePlans, nil) + }) + + Context("as a json string", func() { + It("successfully updates a service", func() { + callUpdateService([]string{"-p", "flare", "-c", `{"foo": "bar"}`, "my-service-instance"}) + + Expect(ui.Outputs).To(ContainSubstrings( + []string{"Updating service", "my-service", "as", "my-user", "..."}, + []string{"OK"}, + []string{"Update in progress. Use 'cf services' or 'cf service my-service-instance' to check operation status."}, + )) + Expect(serviceRepo.FindInstanceByNameName).To(Equal("my-service-instance")) + Expect(serviceRepo.UpdateServiceInstanceArgs.InstanceGuid).To(Equal("my-service-instance-guid")) + Expect(serviceRepo.UpdateServiceInstanceArgs.PlanGuid).To(Equal("murkydb-flare-guid")) + Expect(serviceRepo.UpdateServiceInstanceArgs.Params).To(Equal(map[string]interface{}{"foo": "bar"})) + }) + + Context("that are not valid json", func() { + It("returns an error to the UI", func() { + callUpdateService([]string{"-p", "flare", "-c", `bad-json`, "my-service-instance"}) + + Expect(ui.Outputs).To(ContainSubstrings( + []string{"FAILED"}, + []string{"Invalid configuration provided for -c flag. Please provide a valid JSON object or a file path containing valid JSON."}, + )) + }) + }) + }) + + Context("as a file that contains json", func() { + var jsonFile *os.File + var params string + + BeforeEach(func() { + params = "{\"foo\": \"bar\"}" + }) + + AfterEach(func() { + if jsonFile != nil { + jsonFile.Close() + os.Remove(jsonFile.Name()) + } + }) + + JustBeforeEach(func() { + var err error + jsonFile, err = ioutil.TempFile("", "") + Expect(err).ToNot(HaveOccurred()) + + err = ioutil.WriteFile(jsonFile.Name(), []byte(params), os.ModePerm) + Expect(err).NotTo(HaveOccurred()) + }) + + It("successfully updates a service and passes the params as a json", func() { + callUpdateService([]string{"-p", "flare", "-c", jsonFile.Name(), "my-service-instance"}) + + Expect(ui.Outputs).To(ContainSubstrings( + []string{"Updating service", "my-service", "as", "my-user", "..."}, + []string{"OK"}, + []string{"Update in progress. Use 'cf services' or 'cf service my-service-instance' to check operation status."}, + )) + Expect(serviceRepo.FindInstanceByNameName).To(Equal("my-service-instance")) + Expect(serviceRepo.UpdateServiceInstanceArgs.InstanceGuid).To(Equal("my-service-instance-guid")) + Expect(serviceRepo.UpdateServiceInstanceArgs.PlanGuid).To(Equal("murkydb-flare-guid")) + Expect(serviceRepo.UpdateServiceInstanceArgs.Params).To(Equal(map[string]interface{}{"foo": "bar"})) + }) + + Context("that are not valid json", func() { + BeforeEach(func() { + params = "bad-json" + }) + + It("returns an error to the UI", func() { + callUpdateService([]string{"-p", "flare", "-c", jsonFile.Name(), "my-service-instance"}) + + Expect(ui.Outputs).To(ContainSubstrings( + []string{"FAILED"}, + []string{"Invalid configuration provided for -c flag. Please provide a valid JSON object or a file path containing valid JSON."}, + )) + }) + }) + }) + }) + + Context("when service update is asynchronous", func() { Context("when the plan flag is passed", func() { BeforeEach(func() { serviceInstance := models.ServiceInstance{ @@ -226,7 +340,7 @@ var _ = Describe("update-service command", func() { }) }) - Context("when service creation is synchronous", func() { + Context("when service update is synchronous", func() { Context("when the plan flag is passed", func() { BeforeEach(func() { serviceInstance := models.ServiceInstance{ diff --git a/cf/commands/servicekey/create_service_key.go b/cf/commands/servicekey/create_service_key.go index 221fb79db04..1c59c08eab0 100644 --- a/cf/commands/servicekey/create_service_key.go +++ b/cf/commands/servicekey/create_service_key.go @@ -5,8 +5,10 @@ import ( "github.com/cloudfoundry/cli/cf/command_metadata" "github.com/cloudfoundry/cli/cf/configuration/core_config" "github.com/cloudfoundry/cli/cf/errors" + "github.com/cloudfoundry/cli/cf/flag_helpers" "github.com/cloudfoundry/cli/cf/requirements" "github.com/cloudfoundry/cli/cf/terminal" + "github.com/cloudfoundry/cli/json" "github.com/codegangsta/cli" . "github.com/cloudfoundry/cli/cf/i18n" @@ -33,10 +35,25 @@ func (cmd CreateServiceKey) Metadata() command_metadata.CommandMetadata { Name: "create-service-key", ShortName: "csk", Description: T("Create key for a service instance"), - Usage: T(`CF_NAME create-service-key SERVICE_INSTANCE SERVICE_KEY + Usage: T(`CF_NAME create-service-key SERVICE_INSTANCE SERVICE_KEY [-c PARAMETERS_AS_JSON] + + Optionally provide service-specific configuration parameters in a valid JSON object in-line. + CF_NAME create-service-key SERVICE_INSTANCE SERVICE_KEY -c '{"name":"value","name":"value"}' + + Optionally provide a file containing service-specific configuration parameters in a valid JSON object. The path to the parameters file can be an absolute or relative path to a file. + CF_NAME create-service-key SERVICE_INSTANCE SERVICE_KEY -c PATH_TO_FILE + + Example of valid JSON object: + { + "permissions": "read-only" + } EXAMPLE: - CF_NAME create-service-key mydb mykey`), + CF_NAME create-service-key mydb mykey -c '{"permissions":"read-only"}' + CF_NAME create-service-key mydb mykey -c ~/workspace/tmp/instance_config.json`), + Flags: []cli.Flag{ + flag_helpers.NewStringFlag("c", T("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.")), + }, } } @@ -57,6 +74,12 @@ func (cmd CreateServiceKey) GetRequirements(requirementsFactory requirements.Fac func (cmd CreateServiceKey) Run(c *cli.Context) { serviceInstanceName := c.Args()[0] serviceKeyName := c.Args()[1] + params := c.String("c") + + paramsMap, err := json.ParseJsonFromFileOrString(params) + if err != nil { + cmd.ui.Failed(T("Invalid configuration provided for -c flag. Please provide a valid JSON object or a file path containing valid JSON.")) + } cmd.ui.Say(T("Creating service key {{.ServiceKeyName}} for service instance {{.ServiceInstanceName}} as {{.CurrentUser}}...", map[string]interface{}{ @@ -71,7 +94,7 @@ func (cmd CreateServiceKey) Run(c *cli.Context) { return } - err = cmd.serviceKeyRepo.CreateServiceKey(serviceInstance.Guid, serviceKeyName) + err = cmd.serviceKeyRepo.CreateServiceKey(serviceInstance.Guid, serviceKeyName, paramsMap) switch err.(type) { case nil: cmd.ui.Ok() diff --git a/cf/commands/servicekey/create_service_key_test.go b/cf/commands/servicekey/create_service_key_test.go index ee1b9fc89f2..0b9d94236f3 100644 --- a/cf/commands/servicekey/create_service_key_test.go +++ b/cf/commands/servicekey/create_service_key_test.go @@ -1,6 +1,9 @@ package servicekey_test import ( + "io/ioutil" + "os" + "github.com/cloudfoundry/cli/cf/configuration/core_config" "github.com/cloudfoundry/cli/cf/errors" "github.com/cloudfoundry/cli/cf/models" @@ -102,4 +105,80 @@ var _ = Describe("create-service-key command", func() { []string{"This service doesn't support creation of keys."})) }) }) + + Context("when passing arbitrary params", func() { + Context("as a json string", func() { + It("successfully creates a service key and passes the params as a json string", func() { + callCreateService([]string{"fake-service-instance", "fake-service-key", "-c", `{"foo": "bar"}`}) + + Expect(ui.Outputs).To(ContainSubstrings( + []string{"Creating service key", "fake-service-key", "for service instance", "fake-service-instance", "as", "my-user"}, + []string{"OK"}, + )) + Expect(serviceKeyRepo.CreateServiceKeyMethod.InstanceGuid).To(Equal("fake-instance-guid")) + Expect(serviceKeyRepo.CreateServiceKeyMethod.KeyName).To(Equal("fake-service-key")) + Expect(serviceKeyRepo.CreateServiceKeyMethod.Params).To(Equal(map[string]interface{}{"foo": "bar"})) + }) + }) + + Context("that are not valid json", func() { + It("returns an error to the UI", func() { + callCreateService([]string{"fake-service-instance", "fake-service-key", "-c", `bad-json`}) + + Expect(ui.Outputs).To(ContainSubstrings( + []string{"FAILED"}, + []string{"Invalid configuration provided for -c flag. Please provide a valid JSON object or a file path containing valid JSON."}, + )) + }) + }) + Context("as a file that contains json", func() { + var jsonFile *os.File + var params string + + BeforeEach(func() { + params = "{\"foo\": \"bar\"}" + }) + + AfterEach(func() { + if jsonFile != nil { + jsonFile.Close() + os.Remove(jsonFile.Name()) + } + }) + + JustBeforeEach(func() { + var err error + jsonFile, err = ioutil.TempFile("", "") + Expect(err).ToNot(HaveOccurred()) + + err = ioutil.WriteFile(jsonFile.Name(), []byte(params), os.ModePerm) + Expect(err).NotTo(HaveOccurred()) + }) + + It("successfully creates a service key and passes the params as a json", func() { + callCreateService([]string{"fake-service-instance", "fake-service-key", "-c", jsonFile.Name()}) + + Expect(ui.Outputs).To(ContainSubstrings( + []string{"Creating service key", "fake-service-key", "for service instance", "fake-service-instance", "as", "my-user"}, + []string{"OK"}, + )) + Expect(serviceKeyRepo.CreateServiceKeyMethod.Params).To(Equal(map[string]interface{}{"foo": "bar"})) + }) + + Context("that are not valid json", func() { + BeforeEach(func() { + params = "bad-json" + }) + + It("returns an error to the UI", func() { + callCreateService([]string{"fake-service-instance", "fake-service-key", "-c", jsonFile.Name()}) + + Expect(ui.Outputs).To(ContainSubstrings( + []string{"FAILED"}, + []string{"Invalid configuration provided for -c flag. Please provide a valid JSON object or a file path containing valid JSON."}, + )) + }) + }) + }) + }) }) diff --git a/cf/i18n/resources/de_DE.all.json b/cf/i18n/resources/de_DE.all.json index 8f6a3e359ef..e2e7a213102 100644 --- a/cf/i18n/resources/de_DE.all.json +++ b/cf/i18n/resources/de_DE.all.json @@ -580,9 +580,9 @@ "modified": false }, { - "id": "CF_NAME bind-service APP_NAME SERVICE_INSTANCE", - "translation": "CF_NAME bind-service APP SERVICE_INSTANCE", - "modified": true + "id": "CF_NAME bind-service APP_NAME SERVICE_INSTANCE [-c PARAMETERS_AS_JSON]\n\n Optionally provide service-specific configuration parameters in a valid JSON object in-line.\n CF_NAME bind-service APP_NAME SERVICE_INSTANCE -c '{\"name\":\"value\",\"name\":\"value\"}'\n\n Optionally provide a file containing service-specific configuration parameters in a valid JSON object. The path to the parameters file can be an absolute or relative path to a file.\n CF_NAME bind-service APP_NAME SERVICE_INSTANCE -c PATH_TO_FILE\n\n Example of valid JSON object:\n {\n \"cluster_nodes\": {\n \"count\": 5,\n \"memory_mb\": 1024\n }\n }\n\nEXAMPLE:\n\tLinux/Mac:\n\t\tCF_NAME bind-service myapp mydb -c '{\"permissions\":\"read-only\"}'\n\n\tWindows Command Line\n\t\tCF_NAME bind-service myapp mydb -c \"{\\\"permissions\\\":\\\"read-only\\\"}\"\n\n\tWindows PowerShell\n\t\tCF_NAME bind-service myapp mydb -c '{\\\"permissions\\\":\\\"read-only\\\"}'\n\t\n\tCF_NAME bind-service myapp mydb -c ~/workspace/tmp/instance_config.json", + "translation": "CF_NAME bind-service APP_NAME SERVICE_INSTANCE [-c PARAMETERS_AS_JSON]\n\n Optionally provide service-specific configuration parameters in a valid JSON object in-line.\n CF_NAME bind-service APP_NAME SERVICE_INSTANCE -c '{\"name\":\"value\",\"name\":\"value\"}'\n\n Optionally provide a file containing service-specific configuration parameters in a valid JSON object. The path to the parameters file can be an absolute or relative path to a file.\n CF_NAME bind-service APP_NAME SERVICE_INSTANCE -c PATH_TO_FILE\n\n Example of valid JSON object:\n {\n \"cluster_nodes\": {\n \"count\": 5,\n \"memory_mb\": 1024\n }\n }\n\nEXAMPLE:\n\tLinux/Mac:\n\t\tCF_NAME bind-service myapp mydb -c '{\"permissions\":\"read-only\"}'\n\n\tWindows Command Line\n\t\tCF_NAME bind-service myapp mydb -c \"{\\\"permissions\\\":\\\"read-only\\\"}\"\n\n\tWindows PowerShell\n\t\tCF_NAME bind-service myapp mydb -c '{\\\"permissions\\\":\\\"read-only\\\"}'\n\t\n\tCF_NAME bind-service myapp mydb -c ~/workspace/tmp/instance_config.json", + "modified": false }, { "id": "CF_NAME bind-staging-security-group SECURITY_GROUP", @@ -640,9 +640,9 @@ "modified": false }, { - "id": "CF_NAME create-service SERVICE PLAN SERVICE_INSTANCE\n\nEXAMPLE:\n CF_NAME create-service dbaas silver mydb\n\nTIP:\n Use 'CF_NAME create-user-provided-service' to make user-provided services available to cf apps", - "translation": "CF_NAME create-service SERVICE PLAN SERVICE_INSTANCE\n\nEXAMPLE:\n CF_NAME create-service cleardb spark clear-db-mine\n\nTIP:\n Use 'CF_NAME create-user-provided-service' to make user-provided services available to cf apps", - "modified": true + "id": "CF_NAME create-service SERVICE PLAN SERVICE_INSTANCE [-c PARAMETERS_AS_JSON]\n\n Optionally provide service-specific configuration parameters in a valid JSON object in-line:\n CF_NAME create-service SERVICE PLAN SERVICE_INSTANCE -c '{\"name\":\"value\",\"name\":\"value\"}'\n\n Optionally provide a file containing service-specific configuration parameters in a valid JSON object. The path to the parameters file can be an absolute or relative path to a file.\n CF_NAME create-service SERVICE_INSTANCE -c PATH_TO_FILE\n\n\tExample of valid JSON object:\n {\n \"cluster_nodes\": {\n \"count\": 5,\n \"memory_mb\": 1024\n }\n }\n\nEXAMPLE:\n\tLinux/Mac:\n\t\tCF_NAME create-service db-service silver -c '{\"ram_gb\":4}'\n\n\tWindows Command Line\n\t\tCF_NAME create-service db-service silver -c \"{\\\"ram_gb\\\":4}\"\n\n\tWindows PowerShell\n\t\tCF_NAME create-service db-service silver -c '{\\\"ram_gb\\\":4}'\n\n\tCF_NAME create-service db-service silver mydb -c ~/workspace/tmp/instance_config.json\n\nTIP:\n Use 'CF_NAME create-user-provided-service' to make user-provided services available to cf apps", + "translation": "CF_NAME create-service SERVICE PLAN SERVICE_INSTANCE [-c PARAMETERS_AS_JSON]\n\n Optionally provide service-specific configuration parameters in a valid JSON object in-line:\n CF_NAME create-service SERVICE PLAN SERVICE_INSTANCE -c '{\"name\":\"value\",\"name\":\"value\"}'\n\n Optionally provide a file containing service-specific configuration parameters in a valid JSON object. The path to the parameters file can be an absolute or relative path to a file.\n CF_NAME create-service SERVICE_INSTANCE -c PATH_TO_FILE\n\n\tExample of valid JSON object:\n {\n \"cluster_nodes\": {\n \"count\": 5,\n \"memory_mb\": 1024\n }\n }\n\nEXAMPLE:\n\tLinux/Mac:\n\t\tCF_NAME create-service db-service silver -c '{\"ram_gb\":4}'\n\n\tWindows Command Line\n\t\tCF_NAME create-service db-service silver -c \"{\\\"ram_gb\\\":4}\"\n\n\tWindows PowerShell\n\t\tCF_NAME create-service db-service silver -c '{\\\"ram_gb\\\":4}'\n\n\tCF_NAME create-service db-service silver mydb -c ~/workspace/tmp/instance_config.json\n\nTIP:\n Use 'CF_NAME create-user-provided-service' to make user-provided services available to cf apps", + "modified": false }, { "id": "CF_NAME create-service-auth-token LABEL PROVIDER TOKEN", @@ -655,8 +655,8 @@ "modified": false }, { - "id": "CF_NAME create-service-key SERVICE_INSTANCE SERVICE_KEY\n\nEXAMPLE:\n CF_NAME create-service-key mydb mykey", - "translation": "CF_NAME create-service-key SERVICE_INSTANCE SERVICE_KEY\n\nEXAMPLE:\n CF_NAME create-service-key mydb mykey", + "id": "CF_NAME create-service-key SERVICE_INSTANCE SERVICE_KEY [-c PARAMETERS_AS_JSON]\n\n Optionally provide service-specific configuration parameters in a valid JSON object in-line.\n CF_NAME create-service-key SERVICE_INSTANCE SERVICE_KEY -c '{\"name\":\"value\",\"name\":\"value\"}'\n\n Optionally provide a file containing service-specific configuration parameters in a valid JSON object. The path to the parameters file can be an absolute or relative path to a file.\n CF_NAME create-service-key SERVICE_INSTANCE SERVICE_KEY -c PATH_TO_FILE\n\n Example of valid JSON object:\n {\n \"permissions\": \"read-only\"\n }\n\nEXAMPLE:\n CF_NAME create-service-key mydb mykey -c '{\"permissions\":\"read-only\"}'\n CF_NAME create-service-key mydb mykey -c ~/workspace/tmp/instance_config.json", + "translation": "CF_NAME create-service-key SERVICE_INSTANCE SERVICE_KEY [-c PARAMETERS_AS_JSON]\n\n Optionally provide service-specific configuration parameters in a valid JSON object in-line.\n CF_NAME create-service-key SERVICE_INSTANCE SERVICE_KEY -c '{\"name\":\"value\",\"name\":\"value\"}'\n\n Optionally provide a file containing service-specific configuration parameters in a valid JSON object. The path to the parameters file can be an absolute or relative path to a file.\n CF_NAME create-service-key SERVICE_INSTANCE SERVICE_KEY -c PATH_TO_FILE\n\n Example of valid JSON object:\n {\n \"permissions\": \"read-only\"\n }\n\nEXAMPLE:\n CF_NAME create-service-key mydb mykey -c '{\"permissions\":\"read-only\"}'\n CF_NAME create-service-key mydb mykey -c ~/workspace/tmp/instance_config.json", "modified": false }, { @@ -1135,8 +1135,8 @@ "modified": false }, { - "id": "CF_NAME update-service SERVICE [-p NEW_PLAN]", - "translation": "CF_NAME update-service SERVICE [-p NEW_PLAN]", + "id": "CF_NAME update-service SERVICE_INSTANCE [-p NEW_PLAN] [-c PARAMETERS_AS_JSON]\n\n Optionally provide service-specific configuration parameters in a valid JSON object in-line.\n cf create--service SERVICE PLAN SERVICE_INSTANCE -c '{\"name\":\"value\",\"name\":\"value\"}'\n\n Optionally provide a file containing service-specific configuration parameters in a valid JSON object. The path to the parameters file can be an absolute or relative path to a file.\n cf create-service SERVICE_INSTANCE -c PATH_TO_FILE\n\n Example of valid JSON object:\n {\n \"cluster_nodes\": {\n \"count\": 5,\n \"memory_mb\": 1024\n }\n }\n\nEXAMPLE:\n cf update-service mydb -p gold\n cf update-service mydb -c '{\"ram_gb\":4}'\n cf update-service mydb -c ~/workspace/tmp/instance_config.json", + "translation": "CF_NAME update-service SERVICE_INSTANCE [-p NEW_PLAN] [-c PARAMETERS_AS_JSON]\n\n Optionally provide service-specific configuration parameters in a valid JSON object in-line.\n cf create--service SERVICE PLAN SERVICE_INSTANCE -c '{\"name\":\"value\",\"name\":\"value\"}'\n\n Optionally provide a file containing service-specific configuration parameters in a valid JSON object. The path to the parameters file can be an absolute or relative path to a file.\n cf create-service SERVICE_INSTANCE -c PATH_TO_FILE\n\n Example of valid JSON object:\n {\n \"cluster_nodes\": {\n \"count\": 5,\n \"memory_mb\": 1024\n }\n }\n\nEXAMPLE:\n cf update-service mydb -p gold\n cf update-service mydb -c '{\"ram_gb\":4}'\n cf update-service mydb -c ~/workspace/tmp/instance_config.json", "modified": false }, { @@ -2609,11 +2609,6 @@ "translation": "Instance must be a non-negative integer", "modified": false }, - { - "id": "Invalid JSON provided in -c argument", - "translation": "Invalid JSON provided in -c argument", - "modified": false - }, { "id": "Invalid JSON response from server", "translation": "Invalid JSON response from server", @@ -2639,6 +2634,11 @@ "translation": "Invalid auth token: ", "modified": false }, + { + "id": "Invalid configuration provided for -c flag. Please provide a valid JSON object or a file path containing valid JSON.", + "translation": "Invalid configuration provided for -c flag. Please provide a valid JSON object or a file path containing valid JSON.", + "modified": false + }, { "id": "Invalid data from '{{.repoName}}' - plugin data does not exist", "translation": "Invalid data from '{{.repoName}}' - plugin data does not exist", diff --git a/cf/i18n/resources/en_US.all.json b/cf/i18n/resources/en_US.all.json index d40cb0b869e..a13a4545ff3 100644 --- a/cf/i18n/resources/en_US.all.json +++ b/cf/i18n/resources/en_US.all.json @@ -580,8 +580,8 @@ "modified": false }, { - "id": "CF_NAME bind-service APP_NAME SERVICE_INSTANCE", - "translation": "CF_NAME bind-service APP_NAME SERVICE_INSTANCE", + "id": "CF_NAME bind-service APP_NAME SERVICE_INSTANCE [-c PARAMETERS_AS_JSON]\n\n Optionally provide service-specific configuration parameters in a valid JSON object in-line.\n CF_NAME bind-service APP_NAME SERVICE_INSTANCE -c '{\"name\":\"value\",\"name\":\"value\"}'\n\n Optionally provide a file containing service-specific configuration parameters in a valid JSON object. The path to the parameters file can be an absolute or relative path to a file.\n CF_NAME bind-service APP_NAME SERVICE_INSTANCE -c PATH_TO_FILE\n\n Example of valid JSON object:\n {\n \"cluster_nodes\": {\n \"count\": 5,\n \"memory_mb\": 1024\n }\n }\n\nEXAMPLE:\n\tLinux/Mac:\n\t\tCF_NAME bind-service myapp mydb -c '{\"permissions\":\"read-only\"}'\n\n\tWindows Command Line\n\t\tCF_NAME bind-service myapp mydb -c \"{\\\"permissions\\\":\\\"read-only\\\"}\"\n\n\tWindows PowerShell\n\t\tCF_NAME bind-service myapp mydb -c '{\\\"permissions\\\":\\\"read-only\\\"}'\n\t\n\tCF_NAME bind-service myapp mydb -c ~/workspace/tmp/instance_config.json", + "translation": "CF_NAME bind-service APP_NAME SERVICE_INSTANCE [-c PARAMETERS_AS_JSON]\n\n Optionally provide service-specific configuration parameters in a valid JSON object in-line.\n CF_NAME bind-service APP_NAME SERVICE_INSTANCE -c '{\"name\":\"value\",\"name\":\"value\"}'\n\n Optionally provide a file containing service-specific configuration parameters in a valid JSON object. The path to the parameters file can be an absolute or relative path to a file.\n CF_NAME bind-service APP_NAME SERVICE_INSTANCE -c PATH_TO_FILE\n\n Example of valid JSON object:\n {\n \"cluster_nodes\": {\n \"count\": 5,\n \"memory_mb\": 1024\n }\n }\n\nEXAMPLE:\n\tLinux/Mac:\n\t\tCF_NAME bind-service myapp mydb -c '{\"permissions\":\"read-only\"}'\n\n\tWindows Command Line\n\t\tCF_NAME bind-service myapp mydb -c \"{\\\"permissions\\\":\\\"read-only\\\"}\"\n\n\tWindows PowerShell\n\t\tCF_NAME bind-service myapp mydb -c '{\\\"permissions\\\":\\\"read-only\\\"}'\n\t\n\tCF_NAME bind-service myapp mydb -c ~/workspace/tmp/instance_config.json", "modified": false }, { @@ -640,8 +640,8 @@ "modified": false }, { - "id": "CF_NAME create-service SERVICE PLAN SERVICE_INSTANCE\n\nEXAMPLE:\n CF_NAME create-service dbaas silver mydb\n\nTIP:\n Use 'CF_NAME create-user-provided-service' to make user-provided services available to cf apps", - "translation": "CF_NAME create-service SERVICE PLAN SERVICE_INSTANCE\n\nEXAMPLE:\n CF_NAME create-service dbaas silver mydb\n\nTIP:\n Use 'CF_NAME create-user-provided-service' to make user-provided services available to cf apps", + "id": "CF_NAME create-service SERVICE PLAN SERVICE_INSTANCE [-c PARAMETERS_AS_JSON]\n\n Optionally provide service-specific configuration parameters in a valid JSON object in-line:\n CF_NAME create-service SERVICE PLAN SERVICE_INSTANCE -c '{\"name\":\"value\",\"name\":\"value\"}'\n\n Optionally provide a file containing service-specific configuration parameters in a valid JSON object. The path to the parameters file can be an absolute or relative path to a file.\n CF_NAME create-service SERVICE_INSTANCE -c PATH_TO_FILE\n\n\tExample of valid JSON object:\n {\n \"cluster_nodes\": {\n \"count\": 5,\n \"memory_mb\": 1024\n }\n }\n\nEXAMPLE:\n\tLinux/Mac:\n\t\tCF_NAME create-service db-service silver -c '{\"ram_gb\":4}'\n\n\tWindows Command Line\n\t\tCF_NAME create-service db-service silver -c \"{\\\"ram_gb\\\":4}\"\n\n\tWindows PowerShell\n\t\tCF_NAME create-service db-service silver -c '{\\\"ram_gb\\\":4}'\n\n\tCF_NAME create-service db-service silver mydb -c ~/workspace/tmp/instance_config.json\n\nTIP:\n Use 'CF_NAME create-user-provided-service' to make user-provided services available to cf apps", + "translation": "CF_NAME create-service SERVICE PLAN SERVICE_INSTANCE [-c PARAMETERS_AS_JSON]\n\n Optionally provide service-specific configuration parameters in a valid JSON object in-line:\n CF_NAME create-service SERVICE PLAN SERVICE_INSTANCE -c '{\"name\":\"value\",\"name\":\"value\"}'\n\n Optionally provide a file containing service-specific configuration parameters in a valid JSON object. The path to the parameters file can be an absolute or relative path to a file.\n CF_NAME create-service SERVICE_INSTANCE -c PATH_TO_FILE\n\n\tExample of valid JSON object:\n {\n \"cluster_nodes\": {\n \"count\": 5,\n \"memory_mb\": 1024\n }\n }\n\nEXAMPLE:\n\tLinux/Mac:\n\t\tCF_NAME create-service db-service silver -c '{\"ram_gb\":4}'\n\n\tWindows Command Line\n\t\tCF_NAME create-service db-service silver -c \"{\\\"ram_gb\\\":4}\"\n\n\tWindows PowerShell\n\t\tCF_NAME create-service db-service silver -c '{\\\"ram_gb\\\":4}'\n\n\tCF_NAME create-service db-service silver mydb -c ~/workspace/tmp/instance_config.json\n\nTIP:\n Use 'CF_NAME create-user-provided-service' to make user-provided services available to cf apps", "modified": false }, { @@ -655,8 +655,8 @@ "modified": false }, { - "id": "CF_NAME create-service-key SERVICE_INSTANCE SERVICE_KEY\n\nEXAMPLE:\n CF_NAME create-service-key mydb mykey", - "translation": "CF_NAME create-service-key SERVICE_INSTANCE SERVICE_KEY\n\nEXAMPLE:\n CF_NAME create-service-key mydb mykey", + "id": "CF_NAME create-service-key SERVICE_INSTANCE SERVICE_KEY [-c PARAMETERS_AS_JSON]\n\n Optionally provide service-specific configuration parameters in a valid JSON object in-line.\n CF_NAME create-service-key SERVICE_INSTANCE SERVICE_KEY -c '{\"name\":\"value\",\"name\":\"value\"}'\n\n Optionally provide a file containing service-specific configuration parameters in a valid JSON object. The path to the parameters file can be an absolute or relative path to a file.\n CF_NAME create-service-key SERVICE_INSTANCE SERVICE_KEY -c PATH_TO_FILE\n\n Example of valid JSON object:\n {\n \"permissions\": \"read-only\"\n }\n\nEXAMPLE:\n CF_NAME create-service-key mydb mykey -c '{\"permissions\":\"read-only\"}'\n CF_NAME create-service-key mydb mykey -c ~/workspace/tmp/instance_config.json", + "translation": "CF_NAME create-service-key SERVICE_INSTANCE SERVICE_KEY [-c PARAMETERS_AS_JSON]\n\n Optionally provide service-specific configuration parameters in a valid JSON object in-line.\n CF_NAME create-service-key SERVICE_INSTANCE SERVICE_KEY -c '{\"name\":\"value\",\"name\":\"value\"}'\n\n Optionally provide a file containing service-specific configuration parameters in a valid JSON object. The path to the parameters file can be an absolute or relative path to a file.\n CF_NAME create-service-key SERVICE_INSTANCE SERVICE_KEY -c PATH_TO_FILE\n\n Example of valid JSON object:\n {\n \"permissions\": \"read-only\"\n }\n\nEXAMPLE:\n CF_NAME create-service-key mydb mykey -c '{\"permissions\":\"read-only\"}'\n CF_NAME create-service-key mydb mykey -c ~/workspace/tmp/instance_config.json", "modified": false }, { @@ -1135,8 +1135,8 @@ "modified": false }, { - "id": "CF_NAME update-service SERVICE [-p NEW_PLAN]", - "translation": "CF_NAME update-service SERVICE [-p NEW_PLAN]", + "id": "CF_NAME update-service SERVICE_INSTANCE [-p NEW_PLAN] [-c PARAMETERS_AS_JSON]\n\n Optionally provide service-specific configuration parameters in a valid JSON object in-line.\n cf create--service SERVICE PLAN SERVICE_INSTANCE -c '{\"name\":\"value\",\"name\":\"value\"}'\n\n Optionally provide a file containing service-specific configuration parameters in a valid JSON object. The path to the parameters file can be an absolute or relative path to a file.\n cf create-service SERVICE_INSTANCE -c PATH_TO_FILE\n\n Example of valid JSON object:\n {\n \"cluster_nodes\": {\n \"count\": 5,\n \"memory_mb\": 1024\n }\n }\n\nEXAMPLE:\n cf update-service mydb -p gold\n cf update-service mydb -c '{\"ram_gb\":4}'\n cf update-service mydb -c ~/workspace/tmp/instance_config.json", + "translation": "CF_NAME update-service SERVICE_INSTANCE [-p NEW_PLAN] [-c PARAMETERS_AS_JSON]\n\n Optionally provide service-specific configuration parameters in a valid JSON object in-line.\n cf create--service SERVICE PLAN SERVICE_INSTANCE -c '{\"name\":\"value\",\"name\":\"value\"}'\n\n Optionally provide a file containing service-specific configuration parameters in a valid JSON object. The path to the parameters file can be an absolute or relative path to a file.\n cf create-service SERVICE_INSTANCE -c PATH_TO_FILE\n\n Example of valid JSON object:\n {\n \"cluster_nodes\": {\n \"count\": 5,\n \"memory_mb\": 1024\n }\n }\n\nEXAMPLE:\n cf update-service mydb -p gold\n cf update-service mydb -c '{\"ram_gb\":4}'\n cf update-service mydb -c ~/workspace/tmp/instance_config.json", "modified": false }, { @@ -2609,11 +2609,6 @@ "translation": "Instance must be a non-negative integer", "modified": false }, - { - "id": "Invalid JSON provided in -c argument", - "translation": "Invalid JSON provided in -c argument", - "modified": false - }, { "id": "Invalid JSON response from server", "translation": "Invalid JSON response from server", @@ -2639,6 +2634,11 @@ "translation": "Invalid auth token: ", "modified": false }, + { + "id": "Invalid configuration provided for -c flag. Please provide a valid JSON object or a file path containing valid JSON.", + "translation": "Invalid configuration provided for -c flag. Please provide a valid JSON object or a file path containing valid JSON.", + "modified": false + }, { "id": "Invalid data from '{{.repoName}}' - plugin data does not exist", "translation": "Invalid data from '{{.repoName}}' - plugin data does not exist", diff --git a/cf/i18n/resources/es_ES.all.json b/cf/i18n/resources/es_ES.all.json index c8f18969847..dc1baafa8de 100644 --- a/cf/i18n/resources/es_ES.all.json +++ b/cf/i18n/resources/es_ES.all.json @@ -580,9 +580,9 @@ "modified": false }, { - "id": "CF_NAME bind-service APP_NAME SERVICE_INSTANCE", - "translation": "CF_NAME bind-service APP SERVICE_INSTANCE", - "modified": true + "id": "CF_NAME bind-service APP_NAME SERVICE_INSTANCE [-c PARAMETERS_AS_JSON]\n\n Optionally provide service-specific configuration parameters in a valid JSON object in-line.\n CF_NAME bind-service APP_NAME SERVICE_INSTANCE -c '{\"name\":\"value\",\"name\":\"value\"}'\n\n Optionally provide a file containing service-specific configuration parameters in a valid JSON object. The path to the parameters file can be an absolute or relative path to a file.\n CF_NAME bind-service APP_NAME SERVICE_INSTANCE -c PATH_TO_FILE\n\n Example of valid JSON object:\n {\n \"cluster_nodes\": {\n \"count\": 5,\n \"memory_mb\": 1024\n }\n }\n\nEXAMPLE:\n\tLinux/Mac:\n\t\tCF_NAME bind-service myapp mydb -c '{\"permissions\":\"read-only\"}'\n\n\tWindows Command Line\n\t\tCF_NAME bind-service myapp mydb -c \"{\\\"permissions\\\":\\\"read-only\\\"}\"\n\n\tWindows PowerShell\n\t\tCF_NAME bind-service myapp mydb -c '{\\\"permissions\\\":\\\"read-only\\\"}'\n\t\n\tCF_NAME bind-service myapp mydb -c ~/workspace/tmp/instance_config.json", + "translation": "CF_NAME bind-service APP_NAME SERVICE_INSTANCE [-c PARAMETERS_AS_JSON]\n\n Optionally provide service-specific configuration parameters in a valid JSON object in-line.\n CF_NAME bind-service APP_NAME SERVICE_INSTANCE -c '{\"name\":\"value\",\"name\":\"value\"}'\n\n Optionally provide a file containing service-specific configuration parameters in a valid JSON object. The path to the parameters file can be an absolute or relative path to a file.\n CF_NAME bind-service APP_NAME SERVICE_INSTANCE -c PATH_TO_FILE\n\n Example of valid JSON object:\n {\n \"cluster_nodes\": {\n \"count\": 5,\n \"memory_mb\": 1024\n }\n }\n\nEXAMPLE:\n\tLinux/Mac:\n\t\tCF_NAME bind-service myapp mydb -c '{\"permissions\":\"read-only\"}'\n\n\tWindows Command Line\n\t\tCF_NAME bind-service myapp mydb -c \"{\\\"permissions\\\":\\\"read-only\\\"}\"\n\n\tWindows PowerShell\n\t\tCF_NAME bind-service myapp mydb -c '{\\\"permissions\\\":\\\"read-only\\\"}'\n\t\n\tCF_NAME bind-service myapp mydb -c ~/workspace/tmp/instance_config.json", + "modified": false }, { "id": "CF_NAME bind-staging-security-group SECURITY_GROUP", @@ -640,9 +640,9 @@ "modified": false }, { - "id": "CF_NAME create-service SERVICE PLAN SERVICE_INSTANCE\n\nEXAMPLE:\n CF_NAME create-service dbaas silver mydb\n\nTIP:\n Use 'CF_NAME create-user-provided-service' to make user-provided services available to cf apps", - "translation": "CF_NAME create-service SERVICE PLAN SERVICE_INSTANCE\n\nEXAMPLE:\n CF_NAME create-service cleardb spark clear-db-mine\n\nTIP:\n Use 'CF_NAME create-user-provided-service' to make user-provided services available to cf apps", - "modified": true + "id": "CF_NAME create-service SERVICE PLAN SERVICE_INSTANCE [-c PARAMETERS_AS_JSON]\n\n Optionally provide service-specific configuration parameters in a valid JSON object in-line:\n CF_NAME create-service SERVICE PLAN SERVICE_INSTANCE -c '{\"name\":\"value\",\"name\":\"value\"}'\n\n Optionally provide a file containing service-specific configuration parameters in a valid JSON object. The path to the parameters file can be an absolute or relative path to a file.\n CF_NAME create-service SERVICE_INSTANCE -c PATH_TO_FILE\n\n\tExample of valid JSON object:\n {\n \"cluster_nodes\": {\n \"count\": 5,\n \"memory_mb\": 1024\n }\n }\n\nEXAMPLE:\n\tLinux/Mac:\n\t\tCF_NAME create-service db-service silver -c '{\"ram_gb\":4}'\n\n\tWindows Command Line\n\t\tCF_NAME create-service db-service silver -c \"{\\\"ram_gb\\\":4}\"\n\n\tWindows PowerShell\n\t\tCF_NAME create-service db-service silver -c '{\\\"ram_gb\\\":4}'\n\n\tCF_NAME create-service db-service silver mydb -c ~/workspace/tmp/instance_config.json\n\nTIP:\n Use 'CF_NAME create-user-provided-service' to make user-provided services available to cf apps", + "translation": "CF_NAME create-service SERVICE PLAN SERVICE_INSTANCE [-c PARAMETERS_AS_JSON]\n\n Optionally provide service-specific configuration parameters in a valid JSON object in-line:\n CF_NAME create-service SERVICE PLAN SERVICE_INSTANCE -c '{\"name\":\"value\",\"name\":\"value\"}'\n\n Optionally provide a file containing service-specific configuration parameters in a valid JSON object. The path to the parameters file can be an absolute or relative path to a file.\n CF_NAME create-service SERVICE_INSTANCE -c PATH_TO_FILE\n\n\tExample of valid JSON object:\n {\n \"cluster_nodes\": {\n \"count\": 5,\n \"memory_mb\": 1024\n }\n }\n\nEXAMPLE:\n\tLinux/Mac:\n\t\tCF_NAME create-service db-service silver -c '{\"ram_gb\":4}'\n\n\tWindows Command Line\n\t\tCF_NAME create-service db-service silver -c \"{\\\"ram_gb\\\":4}\"\n\n\tWindows PowerShell\n\t\tCF_NAME create-service db-service silver -c '{\\\"ram_gb\\\":4}'\n\n\tCF_NAME create-service db-service silver mydb -c ~/workspace/tmp/instance_config.json\n\nTIP:\n Use 'CF_NAME create-user-provided-service' to make user-provided services available to cf apps", + "modified": false }, { "id": "CF_NAME create-service-auth-token LABEL PROVIDER TOKEN", @@ -655,8 +655,8 @@ "modified": false }, { - "id": "CF_NAME create-service-key SERVICE_INSTANCE SERVICE_KEY\n\nEXAMPLE:\n CF_NAME create-service-key mydb mykey", - "translation": "CF_NAME create-service-key SERVICE_INSTANCE SERVICE_KEY\n\nEXAMPLE:\n CF_NAME create-service-key mydb mykey", + "id": "CF_NAME create-service-key SERVICE_INSTANCE SERVICE_KEY [-c PARAMETERS_AS_JSON]\n\n Optionally provide service-specific configuration parameters in a valid JSON object in-line.\n CF_NAME create-service-key SERVICE_INSTANCE SERVICE_KEY -c '{\"name\":\"value\",\"name\":\"value\"}'\n\n Optionally provide a file containing service-specific configuration parameters in a valid JSON object. The path to the parameters file can be an absolute or relative path to a file.\n CF_NAME create-service-key SERVICE_INSTANCE SERVICE_KEY -c PATH_TO_FILE\n\n Example of valid JSON object:\n {\n \"permissions\": \"read-only\"\n }\n\nEXAMPLE:\n CF_NAME create-service-key mydb mykey -c '{\"permissions\":\"read-only\"}'\n CF_NAME create-service-key mydb mykey -c ~/workspace/tmp/instance_config.json", + "translation": "CF_NAME create-service-key SERVICE_INSTANCE SERVICE_KEY [-c PARAMETERS_AS_JSON]\n\n Optionally provide service-specific configuration parameters in a valid JSON object in-line.\n CF_NAME create-service-key SERVICE_INSTANCE SERVICE_KEY -c '{\"name\":\"value\",\"name\":\"value\"}'\n\n Optionally provide a file containing service-specific configuration parameters in a valid JSON object. The path to the parameters file can be an absolute or relative path to a file.\n CF_NAME create-service-key SERVICE_INSTANCE SERVICE_KEY -c PATH_TO_FILE\n\n Example of valid JSON object:\n {\n \"permissions\": \"read-only\"\n }\n\nEXAMPLE:\n CF_NAME create-service-key mydb mykey -c '{\"permissions\":\"read-only\"}'\n CF_NAME create-service-key mydb mykey -c ~/workspace/tmp/instance_config.json", "modified": false }, { @@ -1135,8 +1135,8 @@ "modified": false }, { - "id": "CF_NAME update-service SERVICE [-p NEW_PLAN]", - "translation": "CF_NAME update-service SERVICE [-p NEW_PLAN]", + "id": "CF_NAME update-service SERVICE_INSTANCE [-p NEW_PLAN] [-c PARAMETERS_AS_JSON]\n\n Optionally provide service-specific configuration parameters in a valid JSON object in-line.\n cf create--service SERVICE PLAN SERVICE_INSTANCE -c '{\"name\":\"value\",\"name\":\"value\"}'\n\n Optionally provide a file containing service-specific configuration parameters in a valid JSON object. The path to the parameters file can be an absolute or relative path to a file.\n cf create-service SERVICE_INSTANCE -c PATH_TO_FILE\n\n Example of valid JSON object:\n {\n \"cluster_nodes\": {\n \"count\": 5,\n \"memory_mb\": 1024\n }\n }\n\nEXAMPLE:\n cf update-service mydb -p gold\n cf update-service mydb -c '{\"ram_gb\":4}'\n cf update-service mydb -c ~/workspace/tmp/instance_config.json", + "translation": "CF_NAME update-service SERVICE_INSTANCE [-p NEW_PLAN] [-c PARAMETERS_AS_JSON]\n\n Optionally provide service-specific configuration parameters in a valid JSON object in-line.\n cf create--service SERVICE PLAN SERVICE_INSTANCE -c '{\"name\":\"value\",\"name\":\"value\"}'\n\n Optionally provide a file containing service-specific configuration parameters in a valid JSON object. The path to the parameters file can be an absolute or relative path to a file.\n cf create-service SERVICE_INSTANCE -c PATH_TO_FILE\n\n Example of valid JSON object:\n {\n \"cluster_nodes\": {\n \"count\": 5,\n \"memory_mb\": 1024\n }\n }\n\nEXAMPLE:\n cf update-service mydb -p gold\n cf update-service mydb -c '{\"ram_gb\":4}'\n cf update-service mydb -c ~/workspace/tmp/instance_config.json", "modified": false }, { @@ -2609,11 +2609,6 @@ "translation": "Instance must be a non-negative integer", "modified": false }, - { - "id": "Invalid JSON provided in -c argument", - "translation": "Invalid JSON provided in -c argument", - "modified": false - }, { "id": "Invalid JSON response from server", "translation": "Respuesta JSON invalida del servidor", @@ -2639,6 +2634,11 @@ "translation": "Token de autenticacion inválido: ", "modified": false }, + { + "id": "Invalid configuration provided for -c flag. Please provide a valid JSON object or a file path containing valid JSON.", + "translation": "Invalid configuration provided for -c flag. Please provide a valid JSON object or a file path containing valid JSON.", + "modified": false + }, { "id": "Invalid data from '{{.repoName}}' - plugin data does not exist", "translation": "Invalid data from '{{.repoName}}' - plugin data does not exist", diff --git a/cf/i18n/resources/fr_FR.all.json b/cf/i18n/resources/fr_FR.all.json index 7e95d873896..2683a6c850e 100644 --- a/cf/i18n/resources/fr_FR.all.json +++ b/cf/i18n/resources/fr_FR.all.json @@ -580,9 +580,9 @@ "modified": false }, { - "id": "CF_NAME bind-service APP_NAME SERVICE_INSTANCE", - "translation": "CF_NAME bind service APP INSTANCE_SERVICE", - "modified": true + "id": "CF_NAME bind-service APP_NAME SERVICE_INSTANCE [-c PARAMETERS_AS_JSON]\n\n Optionally provide service-specific configuration parameters in a valid JSON object in-line.\n CF_NAME bind-service APP_NAME SERVICE_INSTANCE -c '{\"name\":\"value\",\"name\":\"value\"}'\n\n Optionally provide a file containing service-specific configuration parameters in a valid JSON object. The path to the parameters file can be an absolute or relative path to a file.\n CF_NAME bind-service APP_NAME SERVICE_INSTANCE -c PATH_TO_FILE\n\n Example of valid JSON object:\n {\n \"cluster_nodes\": {\n \"count\": 5,\n \"memory_mb\": 1024\n }\n }\n\nEXAMPLE:\n\tLinux/Mac:\n\t\tCF_NAME bind-service myapp mydb -c '{\"permissions\":\"read-only\"}'\n\n\tWindows Command Line\n\t\tCF_NAME bind-service myapp mydb -c \"{\\\"permissions\\\":\\\"read-only\\\"}\"\n\n\tWindows PowerShell\n\t\tCF_NAME bind-service myapp mydb -c '{\\\"permissions\\\":\\\"read-only\\\"}'\n\t\n\tCF_NAME bind-service myapp mydb -c ~/workspace/tmp/instance_config.json", + "translation": "CF_NAME bind-service APP_NAME SERVICE_INSTANCE [-c PARAMETERS_AS_JSON]\n\n Optionally provide service-specific configuration parameters in a valid JSON object in-line.\n CF_NAME bind-service APP_NAME SERVICE_INSTANCE -c '{\"name\":\"value\",\"name\":\"value\"}'\n\n Optionally provide a file containing service-specific configuration parameters in a valid JSON object. The path to the parameters file can be an absolute or relative path to a file.\n CF_NAME bind-service APP_NAME SERVICE_INSTANCE -c PATH_TO_FILE\n\n Example of valid JSON object:\n {\n \"cluster_nodes\": {\n \"count\": 5,\n \"memory_mb\": 1024\n }\n }\n\nEXAMPLE:\n\tLinux/Mac:\n\t\tCF_NAME bind-service myapp mydb -c '{\"permissions\":\"read-only\"}'\n\n\tWindows Command Line\n\t\tCF_NAME bind-service myapp mydb -c \"{\\\"permissions\\\":\\\"read-only\\\"}\"\n\n\tWindows PowerShell\n\t\tCF_NAME bind-service myapp mydb -c '{\\\"permissions\\\":\\\"read-only\\\"}'\n\t\n\tCF_NAME bind-service myapp mydb -c ~/workspace/tmp/instance_config.json", + "modified": false }, { "id": "CF_NAME bind-staging-security-group SECURITY_GROUP", @@ -640,9 +640,9 @@ "modified": false }, { - "id": "CF_NAME create-service SERVICE PLAN SERVICE_INSTANCE\n\nEXAMPLE:\n CF_NAME create-service dbaas silver mydb\n\nTIP:\n Use 'CF_NAME create-user-provided-service' to make user-provided services available to cf apps", - "translation": "CF_NAME create-service SERVICE PLAN INSTANCE_DE_SERVICE\n\nExemple: CF_NAME create-service cleardb spark clear-db-mine\n\n:CONSEIL:\n Utilisez 'CF_NAME create-user-provided-service' pour rendre disponibles aux applications cf, les services fournis par l'utilisateur", - "modified": true + "id": "CF_NAME create-service SERVICE PLAN SERVICE_INSTANCE [-c PARAMETERS_AS_JSON]\n\n Optionally provide service-specific configuration parameters in a valid JSON object in-line:\n CF_NAME create-service SERVICE PLAN SERVICE_INSTANCE -c '{\"name\":\"value\",\"name\":\"value\"}'\n\n Optionally provide a file containing service-specific configuration parameters in a valid JSON object. The path to the parameters file can be an absolute or relative path to a file.\n CF_NAME create-service SERVICE_INSTANCE -c PATH_TO_FILE\n\n\tExample of valid JSON object:\n {\n \"cluster_nodes\": {\n \"count\": 5,\n \"memory_mb\": 1024\n }\n }\n\nEXAMPLE:\n\tLinux/Mac:\n\t\tCF_NAME create-service db-service silver -c '{\"ram_gb\":4}'\n\n\tWindows Command Line\n\t\tCF_NAME create-service db-service silver -c \"{\\\"ram_gb\\\":4}\"\n\n\tWindows PowerShell\n\t\tCF_NAME create-service db-service silver -c '{\\\"ram_gb\\\":4}'\n\n\tCF_NAME create-service db-service silver mydb -c ~/workspace/tmp/instance_config.json\n\nTIP:\n Use 'CF_NAME create-user-provided-service' to make user-provided services available to cf apps", + "translation": "CF_NAME create-service SERVICE PLAN SERVICE_INSTANCE [-c PARAMETERS_AS_JSON]\n\n Optionally provide service-specific configuration parameters in a valid JSON object in-line:\n CF_NAME create-service SERVICE PLAN SERVICE_INSTANCE -c '{\"name\":\"value\",\"name\":\"value\"}'\n\n Optionally provide a file containing service-specific configuration parameters in a valid JSON object. The path to the parameters file can be an absolute or relative path to a file.\n CF_NAME create-service SERVICE_INSTANCE -c PATH_TO_FILE\n\n\tExample of valid JSON object:\n {\n \"cluster_nodes\": {\n \"count\": 5,\n \"memory_mb\": 1024\n }\n }\n\nEXAMPLE:\n\tLinux/Mac:\n\t\tCF_NAME create-service db-service silver -c '{\"ram_gb\":4}'\n\n\tWindows Command Line\n\t\tCF_NAME create-service db-service silver -c \"{\\\"ram_gb\\\":4}\"\n\n\tWindows PowerShell\n\t\tCF_NAME create-service db-service silver -c '{\\\"ram_gb\\\":4}'\n\n\tCF_NAME create-service db-service silver mydb -c ~/workspace/tmp/instance_config.json\n\nTIP:\n Use 'CF_NAME create-user-provided-service' to make user-provided services available to cf apps", + "modified": false }, { "id": "CF_NAME create-service-auth-token LABEL PROVIDER TOKEN", @@ -655,8 +655,8 @@ "modified": false }, { - "id": "CF_NAME create-service-key SERVICE_INSTANCE SERVICE_KEY\n\nEXAMPLE:\n CF_NAME create-service-key mydb mykey", - "translation": "CF_NAME create-service-key SERVICE_INSTANCE SERVICE_KEY\n\nEXAMPLE:\n CF_NAME create-service-key mydb mykey", + "id": "CF_NAME create-service-key SERVICE_INSTANCE SERVICE_KEY [-c PARAMETERS_AS_JSON]\n\n Optionally provide service-specific configuration parameters in a valid JSON object in-line.\n CF_NAME create-service-key SERVICE_INSTANCE SERVICE_KEY -c '{\"name\":\"value\",\"name\":\"value\"}'\n\n Optionally provide a file containing service-specific configuration parameters in a valid JSON object. The path to the parameters file can be an absolute or relative path to a file.\n CF_NAME create-service-key SERVICE_INSTANCE SERVICE_KEY -c PATH_TO_FILE\n\n Example of valid JSON object:\n {\n \"permissions\": \"read-only\"\n }\n\nEXAMPLE:\n CF_NAME create-service-key mydb mykey -c '{\"permissions\":\"read-only\"}'\n CF_NAME create-service-key mydb mykey -c ~/workspace/tmp/instance_config.json", + "translation": "CF_NAME create-service-key SERVICE_INSTANCE SERVICE_KEY [-c PARAMETERS_AS_JSON]\n\n Optionally provide service-specific configuration parameters in a valid JSON object in-line.\n CF_NAME create-service-key SERVICE_INSTANCE SERVICE_KEY -c '{\"name\":\"value\",\"name\":\"value\"}'\n\n Optionally provide a file containing service-specific configuration parameters in a valid JSON object. The path to the parameters file can be an absolute or relative path to a file.\n CF_NAME create-service-key SERVICE_INSTANCE SERVICE_KEY -c PATH_TO_FILE\n\n Example of valid JSON object:\n {\n \"permissions\": \"read-only\"\n }\n\nEXAMPLE:\n CF_NAME create-service-key mydb mykey -c '{\"permissions\":\"read-only\"}'\n CF_NAME create-service-key mydb mykey -c ~/workspace/tmp/instance_config.json", "modified": false }, { @@ -1135,8 +1135,8 @@ "modified": false }, { - "id": "CF_NAME update-service SERVICE [-p NEW_PLAN]", - "translation": "CF_NAME update-service SERVICE [-p NEW_PLAN]", + "id": "CF_NAME update-service SERVICE_INSTANCE [-p NEW_PLAN] [-c PARAMETERS_AS_JSON]\n\n Optionally provide service-specific configuration parameters in a valid JSON object in-line.\n cf create--service SERVICE PLAN SERVICE_INSTANCE -c '{\"name\":\"value\",\"name\":\"value\"}'\n\n Optionally provide a file containing service-specific configuration parameters in a valid JSON object. The path to the parameters file can be an absolute or relative path to a file.\n cf create-service SERVICE_INSTANCE -c PATH_TO_FILE\n\n Example of valid JSON object:\n {\n \"cluster_nodes\": {\n \"count\": 5,\n \"memory_mb\": 1024\n }\n }\n\nEXAMPLE:\n cf update-service mydb -p gold\n cf update-service mydb -c '{\"ram_gb\":4}'\n cf update-service mydb -c ~/workspace/tmp/instance_config.json", + "translation": "CF_NAME update-service SERVICE_INSTANCE [-p NEW_PLAN] [-c PARAMETERS_AS_JSON]\n\n Optionally provide service-specific configuration parameters in a valid JSON object in-line.\n cf create--service SERVICE PLAN SERVICE_INSTANCE -c '{\"name\":\"value\",\"name\":\"value\"}'\n\n Optionally provide a file containing service-specific configuration parameters in a valid JSON object. The path to the parameters file can be an absolute or relative path to a file.\n cf create-service SERVICE_INSTANCE -c PATH_TO_FILE\n\n Example of valid JSON object:\n {\n \"cluster_nodes\": {\n \"count\": 5,\n \"memory_mb\": 1024\n }\n }\n\nEXAMPLE:\n cf update-service mydb -p gold\n cf update-service mydb -c '{\"ram_gb\":4}'\n cf update-service mydb -c ~/workspace/tmp/instance_config.json", "modified": false }, { @@ -2609,11 +2609,6 @@ "translation": "Instance must be a non-negative integer", "modified": false }, - { - "id": "Invalid JSON provided in -c argument", - "translation": "Invalid JSON provided in -c argument", - "modified": false - }, { "id": "Invalid JSON response from server", "translation": "Serveur JSON réponse invalide", @@ -2639,6 +2634,11 @@ "translation": "Jeton auth invalide: ", "modified": false }, + { + "id": "Invalid configuration provided for -c flag. Please provide a valid JSON object or a file path containing valid JSON.", + "translation": "Invalid configuration provided for -c flag. Please provide a valid JSON object or a file path containing valid JSON.", + "modified": false + }, { "id": "Invalid data from '{{.repoName}}' - plugin data does not exist", "translation": "Invalid data from '{{.repoName}}' - plugin data does not exist", diff --git a/cf/i18n/resources/it_IT.all.json b/cf/i18n/resources/it_IT.all.json index 2818c1ae6c2..75a9e8bab54 100644 --- a/cf/i18n/resources/it_IT.all.json +++ b/cf/i18n/resources/it_IT.all.json @@ -580,9 +580,9 @@ "modified": false }, { - "id": "CF_NAME bind-service APP_NAME SERVICE_INSTANCE", - "translation": "CF_NAME bind-service APP SERVICE_INSTANCE", - "modified": true + "id": "CF_NAME bind-service APP_NAME SERVICE_INSTANCE [-c PARAMETERS_AS_JSON]\n\n Optionally provide service-specific configuration parameters in a valid JSON object in-line.\n CF_NAME bind-service APP_NAME SERVICE_INSTANCE -c '{\"name\":\"value\",\"name\":\"value\"}'\n\n Optionally provide a file containing service-specific configuration parameters in a valid JSON object. The path to the parameters file can be an absolute or relative path to a file.\n CF_NAME bind-service APP_NAME SERVICE_INSTANCE -c PATH_TO_FILE\n\n Example of valid JSON object:\n {\n \"cluster_nodes\": {\n \"count\": 5,\n \"memory_mb\": 1024\n }\n }\n\nEXAMPLE:\n\tLinux/Mac:\n\t\tCF_NAME bind-service myapp mydb -c '{\"permissions\":\"read-only\"}'\n\n\tWindows Command Line\n\t\tCF_NAME bind-service myapp mydb -c \"{\\\"permissions\\\":\\\"read-only\\\"}\"\n\n\tWindows PowerShell\n\t\tCF_NAME bind-service myapp mydb -c '{\\\"permissions\\\":\\\"read-only\\\"}'\n\t\n\tCF_NAME bind-service myapp mydb -c ~/workspace/tmp/instance_config.json", + "translation": "CF_NAME bind-service APP_NAME SERVICE_INSTANCE [-c PARAMETERS_AS_JSON]\n\n Optionally provide service-specific configuration parameters in a valid JSON object in-line.\n CF_NAME bind-service APP_NAME SERVICE_INSTANCE -c '{\"name\":\"value\",\"name\":\"value\"}'\n\n Optionally provide a file containing service-specific configuration parameters in a valid JSON object. The path to the parameters file can be an absolute or relative path to a file.\n CF_NAME bind-service APP_NAME SERVICE_INSTANCE -c PATH_TO_FILE\n\n Example of valid JSON object:\n {\n \"cluster_nodes\": {\n \"count\": 5,\n \"memory_mb\": 1024\n }\n }\n\nEXAMPLE:\n\tLinux/Mac:\n\t\tCF_NAME bind-service myapp mydb -c '{\"permissions\":\"read-only\"}'\n\n\tWindows Command Line\n\t\tCF_NAME bind-service myapp mydb -c \"{\\\"permissions\\\":\\\"read-only\\\"}\"\n\n\tWindows PowerShell\n\t\tCF_NAME bind-service myapp mydb -c '{\\\"permissions\\\":\\\"read-only\\\"}'\n\t\n\tCF_NAME bind-service myapp mydb -c ~/workspace/tmp/instance_config.json", + "modified": false }, { "id": "CF_NAME bind-staging-security-group SECURITY_GROUP", @@ -640,9 +640,9 @@ "modified": false }, { - "id": "CF_NAME create-service SERVICE PLAN SERVICE_INSTANCE\n\nEXAMPLE:\n CF_NAME create-service dbaas silver mydb\n\nTIP:\n Use 'CF_NAME create-user-provided-service' to make user-provided services available to cf apps", - "translation": "CF_NAME create-service SERVICE PLAN SERVICE_INSTANCE\n\nEXAMPLE:\n CF_NAME create-service cleardb spark clear-db-mine\n\nTIP:\n Use 'CF_NAME create-user-provided-service' to make user-provided services available to cf apps", - "modified": true + "id": "CF_NAME create-service SERVICE PLAN SERVICE_INSTANCE [-c PARAMETERS_AS_JSON]\n\n Optionally provide service-specific configuration parameters in a valid JSON object in-line:\n CF_NAME create-service SERVICE PLAN SERVICE_INSTANCE -c '{\"name\":\"value\",\"name\":\"value\"}'\n\n Optionally provide a file containing service-specific configuration parameters in a valid JSON object. The path to the parameters file can be an absolute or relative path to a file.\n CF_NAME create-service SERVICE_INSTANCE -c PATH_TO_FILE\n\n\tExample of valid JSON object:\n {\n \"cluster_nodes\": {\n \"count\": 5,\n \"memory_mb\": 1024\n }\n }\n\nEXAMPLE:\n\tLinux/Mac:\n\t\tCF_NAME create-service db-service silver -c '{\"ram_gb\":4}'\n\n\tWindows Command Line\n\t\tCF_NAME create-service db-service silver -c \"{\\\"ram_gb\\\":4}\"\n\n\tWindows PowerShell\n\t\tCF_NAME create-service db-service silver -c '{\\\"ram_gb\\\":4}'\n\n\tCF_NAME create-service db-service silver mydb -c ~/workspace/tmp/instance_config.json\n\nTIP:\n Use 'CF_NAME create-user-provided-service' to make user-provided services available to cf apps", + "translation": "CF_NAME create-service SERVICE PLAN SERVICE_INSTANCE [-c PARAMETERS_AS_JSON]\n\n Optionally provide service-specific configuration parameters in a valid JSON object in-line:\n CF_NAME create-service SERVICE PLAN SERVICE_INSTANCE -c '{\"name\":\"value\",\"name\":\"value\"}'\n\n Optionally provide a file containing service-specific configuration parameters in a valid JSON object. The path to the parameters file can be an absolute or relative path to a file.\n CF_NAME create-service SERVICE_INSTANCE -c PATH_TO_FILE\n\n\tExample of valid JSON object:\n {\n \"cluster_nodes\": {\n \"count\": 5,\n \"memory_mb\": 1024\n }\n }\n\nEXAMPLE:\n\tLinux/Mac:\n\t\tCF_NAME create-service db-service silver -c '{\"ram_gb\":4}'\n\n\tWindows Command Line\n\t\tCF_NAME create-service db-service silver -c \"{\\\"ram_gb\\\":4}\"\n\n\tWindows PowerShell\n\t\tCF_NAME create-service db-service silver -c '{\\\"ram_gb\\\":4}'\n\n\tCF_NAME create-service db-service silver mydb -c ~/workspace/tmp/instance_config.json\n\nTIP:\n Use 'CF_NAME create-user-provided-service' to make user-provided services available to cf apps", + "modified": false }, { "id": "CF_NAME create-service-auth-token LABEL PROVIDER TOKEN", @@ -655,8 +655,8 @@ "modified": false }, { - "id": "CF_NAME create-service-key SERVICE_INSTANCE SERVICE_KEY\n\nEXAMPLE:\n CF_NAME create-service-key mydb mykey", - "translation": "CF_NAME create-service-key SERVICE_INSTANCE SERVICE_KEY\n\nEXAMPLE:\n CF_NAME create-service-key mydb mykey", + "id": "CF_NAME create-service-key SERVICE_INSTANCE SERVICE_KEY [-c PARAMETERS_AS_JSON]\n\n Optionally provide service-specific configuration parameters in a valid JSON object in-line.\n CF_NAME create-service-key SERVICE_INSTANCE SERVICE_KEY -c '{\"name\":\"value\",\"name\":\"value\"}'\n\n Optionally provide a file containing service-specific configuration parameters in a valid JSON object. The path to the parameters file can be an absolute or relative path to a file.\n CF_NAME create-service-key SERVICE_INSTANCE SERVICE_KEY -c PATH_TO_FILE\n\n Example of valid JSON object:\n {\n \"permissions\": \"read-only\"\n }\n\nEXAMPLE:\n CF_NAME create-service-key mydb mykey -c '{\"permissions\":\"read-only\"}'\n CF_NAME create-service-key mydb mykey -c ~/workspace/tmp/instance_config.json", + "translation": "CF_NAME create-service-key SERVICE_INSTANCE SERVICE_KEY [-c PARAMETERS_AS_JSON]\n\n Optionally provide service-specific configuration parameters in a valid JSON object in-line.\n CF_NAME create-service-key SERVICE_INSTANCE SERVICE_KEY -c '{\"name\":\"value\",\"name\":\"value\"}'\n\n Optionally provide a file containing service-specific configuration parameters in a valid JSON object. The path to the parameters file can be an absolute or relative path to a file.\n CF_NAME create-service-key SERVICE_INSTANCE SERVICE_KEY -c PATH_TO_FILE\n\n Example of valid JSON object:\n {\n \"permissions\": \"read-only\"\n }\n\nEXAMPLE:\n CF_NAME create-service-key mydb mykey -c '{\"permissions\":\"read-only\"}'\n CF_NAME create-service-key mydb mykey -c ~/workspace/tmp/instance_config.json", "modified": false }, { @@ -1135,8 +1135,8 @@ "modified": false }, { - "id": "CF_NAME update-service SERVICE [-p NEW_PLAN]", - "translation": "CF_NAME update-service SERVICE [-p NEW_PLAN]", + "id": "CF_NAME update-service SERVICE_INSTANCE [-p NEW_PLAN] [-c PARAMETERS_AS_JSON]\n\n Optionally provide service-specific configuration parameters in a valid JSON object in-line.\n cf create--service SERVICE PLAN SERVICE_INSTANCE -c '{\"name\":\"value\",\"name\":\"value\"}'\n\n Optionally provide a file containing service-specific configuration parameters in a valid JSON object. The path to the parameters file can be an absolute or relative path to a file.\n cf create-service SERVICE_INSTANCE -c PATH_TO_FILE\n\n Example of valid JSON object:\n {\n \"cluster_nodes\": {\n \"count\": 5,\n \"memory_mb\": 1024\n }\n }\n\nEXAMPLE:\n cf update-service mydb -p gold\n cf update-service mydb -c '{\"ram_gb\":4}'\n cf update-service mydb -c ~/workspace/tmp/instance_config.json", + "translation": "CF_NAME update-service SERVICE_INSTANCE [-p NEW_PLAN] [-c PARAMETERS_AS_JSON]\n\n Optionally provide service-specific configuration parameters in a valid JSON object in-line.\n cf create--service SERVICE PLAN SERVICE_INSTANCE -c '{\"name\":\"value\",\"name\":\"value\"}'\n\n Optionally provide a file containing service-specific configuration parameters in a valid JSON object. The path to the parameters file can be an absolute or relative path to a file.\n cf create-service SERVICE_INSTANCE -c PATH_TO_FILE\n\n Example of valid JSON object:\n {\n \"cluster_nodes\": {\n \"count\": 5,\n \"memory_mb\": 1024\n }\n }\n\nEXAMPLE:\n cf update-service mydb -p gold\n cf update-service mydb -c '{\"ram_gb\":4}'\n cf update-service mydb -c ~/workspace/tmp/instance_config.json", "modified": false }, { @@ -2609,11 +2609,6 @@ "translation": "Instance must be a non-negative integer", "modified": false }, - { - "id": "Invalid JSON provided in -c argument", - "translation": "Invalid JSON provided in -c argument", - "modified": false - }, { "id": "Invalid JSON response from server", "translation": "Invalid JSON response from server", @@ -2639,6 +2634,11 @@ "translation": "Invalid auth token: ", "modified": false }, + { + "id": "Invalid configuration provided for -c flag. Please provide a valid JSON object or a file path containing valid JSON.", + "translation": "Invalid configuration provided for -c flag. Please provide a valid JSON object or a file path containing valid JSON.", + "modified": false + }, { "id": "Invalid data from '{{.repoName}}' - plugin data does not exist", "translation": "Invalid data from '{{.repoName}}' - plugin data does not exist", diff --git a/cf/i18n/resources/ja_JA.all.json b/cf/i18n/resources/ja_JA.all.json index 2818c1ae6c2..75a9e8bab54 100644 --- a/cf/i18n/resources/ja_JA.all.json +++ b/cf/i18n/resources/ja_JA.all.json @@ -580,9 +580,9 @@ "modified": false }, { - "id": "CF_NAME bind-service APP_NAME SERVICE_INSTANCE", - "translation": "CF_NAME bind-service APP SERVICE_INSTANCE", - "modified": true + "id": "CF_NAME bind-service APP_NAME SERVICE_INSTANCE [-c PARAMETERS_AS_JSON]\n\n Optionally provide service-specific configuration parameters in a valid JSON object in-line.\n CF_NAME bind-service APP_NAME SERVICE_INSTANCE -c '{\"name\":\"value\",\"name\":\"value\"}'\n\n Optionally provide a file containing service-specific configuration parameters in a valid JSON object. The path to the parameters file can be an absolute or relative path to a file.\n CF_NAME bind-service APP_NAME SERVICE_INSTANCE -c PATH_TO_FILE\n\n Example of valid JSON object:\n {\n \"cluster_nodes\": {\n \"count\": 5,\n \"memory_mb\": 1024\n }\n }\n\nEXAMPLE:\n\tLinux/Mac:\n\t\tCF_NAME bind-service myapp mydb -c '{\"permissions\":\"read-only\"}'\n\n\tWindows Command Line\n\t\tCF_NAME bind-service myapp mydb -c \"{\\\"permissions\\\":\\\"read-only\\\"}\"\n\n\tWindows PowerShell\n\t\tCF_NAME bind-service myapp mydb -c '{\\\"permissions\\\":\\\"read-only\\\"}'\n\t\n\tCF_NAME bind-service myapp mydb -c ~/workspace/tmp/instance_config.json", + "translation": "CF_NAME bind-service APP_NAME SERVICE_INSTANCE [-c PARAMETERS_AS_JSON]\n\n Optionally provide service-specific configuration parameters in a valid JSON object in-line.\n CF_NAME bind-service APP_NAME SERVICE_INSTANCE -c '{\"name\":\"value\",\"name\":\"value\"}'\n\n Optionally provide a file containing service-specific configuration parameters in a valid JSON object. The path to the parameters file can be an absolute or relative path to a file.\n CF_NAME bind-service APP_NAME SERVICE_INSTANCE -c PATH_TO_FILE\n\n Example of valid JSON object:\n {\n \"cluster_nodes\": {\n \"count\": 5,\n \"memory_mb\": 1024\n }\n }\n\nEXAMPLE:\n\tLinux/Mac:\n\t\tCF_NAME bind-service myapp mydb -c '{\"permissions\":\"read-only\"}'\n\n\tWindows Command Line\n\t\tCF_NAME bind-service myapp mydb -c \"{\\\"permissions\\\":\\\"read-only\\\"}\"\n\n\tWindows PowerShell\n\t\tCF_NAME bind-service myapp mydb -c '{\\\"permissions\\\":\\\"read-only\\\"}'\n\t\n\tCF_NAME bind-service myapp mydb -c ~/workspace/tmp/instance_config.json", + "modified": false }, { "id": "CF_NAME bind-staging-security-group SECURITY_GROUP", @@ -640,9 +640,9 @@ "modified": false }, { - "id": "CF_NAME create-service SERVICE PLAN SERVICE_INSTANCE\n\nEXAMPLE:\n CF_NAME create-service dbaas silver mydb\n\nTIP:\n Use 'CF_NAME create-user-provided-service' to make user-provided services available to cf apps", - "translation": "CF_NAME create-service SERVICE PLAN SERVICE_INSTANCE\n\nEXAMPLE:\n CF_NAME create-service cleardb spark clear-db-mine\n\nTIP:\n Use 'CF_NAME create-user-provided-service' to make user-provided services available to cf apps", - "modified": true + "id": "CF_NAME create-service SERVICE PLAN SERVICE_INSTANCE [-c PARAMETERS_AS_JSON]\n\n Optionally provide service-specific configuration parameters in a valid JSON object in-line:\n CF_NAME create-service SERVICE PLAN SERVICE_INSTANCE -c '{\"name\":\"value\",\"name\":\"value\"}'\n\n Optionally provide a file containing service-specific configuration parameters in a valid JSON object. The path to the parameters file can be an absolute or relative path to a file.\n CF_NAME create-service SERVICE_INSTANCE -c PATH_TO_FILE\n\n\tExample of valid JSON object:\n {\n \"cluster_nodes\": {\n \"count\": 5,\n \"memory_mb\": 1024\n }\n }\n\nEXAMPLE:\n\tLinux/Mac:\n\t\tCF_NAME create-service db-service silver -c '{\"ram_gb\":4}'\n\n\tWindows Command Line\n\t\tCF_NAME create-service db-service silver -c \"{\\\"ram_gb\\\":4}\"\n\n\tWindows PowerShell\n\t\tCF_NAME create-service db-service silver -c '{\\\"ram_gb\\\":4}'\n\n\tCF_NAME create-service db-service silver mydb -c ~/workspace/tmp/instance_config.json\n\nTIP:\n Use 'CF_NAME create-user-provided-service' to make user-provided services available to cf apps", + "translation": "CF_NAME create-service SERVICE PLAN SERVICE_INSTANCE [-c PARAMETERS_AS_JSON]\n\n Optionally provide service-specific configuration parameters in a valid JSON object in-line:\n CF_NAME create-service SERVICE PLAN SERVICE_INSTANCE -c '{\"name\":\"value\",\"name\":\"value\"}'\n\n Optionally provide a file containing service-specific configuration parameters in a valid JSON object. The path to the parameters file can be an absolute or relative path to a file.\n CF_NAME create-service SERVICE_INSTANCE -c PATH_TO_FILE\n\n\tExample of valid JSON object:\n {\n \"cluster_nodes\": {\n \"count\": 5,\n \"memory_mb\": 1024\n }\n }\n\nEXAMPLE:\n\tLinux/Mac:\n\t\tCF_NAME create-service db-service silver -c '{\"ram_gb\":4}'\n\n\tWindows Command Line\n\t\tCF_NAME create-service db-service silver -c \"{\\\"ram_gb\\\":4}\"\n\n\tWindows PowerShell\n\t\tCF_NAME create-service db-service silver -c '{\\\"ram_gb\\\":4}'\n\n\tCF_NAME create-service db-service silver mydb -c ~/workspace/tmp/instance_config.json\n\nTIP:\n Use 'CF_NAME create-user-provided-service' to make user-provided services available to cf apps", + "modified": false }, { "id": "CF_NAME create-service-auth-token LABEL PROVIDER TOKEN", @@ -655,8 +655,8 @@ "modified": false }, { - "id": "CF_NAME create-service-key SERVICE_INSTANCE SERVICE_KEY\n\nEXAMPLE:\n CF_NAME create-service-key mydb mykey", - "translation": "CF_NAME create-service-key SERVICE_INSTANCE SERVICE_KEY\n\nEXAMPLE:\n CF_NAME create-service-key mydb mykey", + "id": "CF_NAME create-service-key SERVICE_INSTANCE SERVICE_KEY [-c PARAMETERS_AS_JSON]\n\n Optionally provide service-specific configuration parameters in a valid JSON object in-line.\n CF_NAME create-service-key SERVICE_INSTANCE SERVICE_KEY -c '{\"name\":\"value\",\"name\":\"value\"}'\n\n Optionally provide a file containing service-specific configuration parameters in a valid JSON object. The path to the parameters file can be an absolute or relative path to a file.\n CF_NAME create-service-key SERVICE_INSTANCE SERVICE_KEY -c PATH_TO_FILE\n\n Example of valid JSON object:\n {\n \"permissions\": \"read-only\"\n }\n\nEXAMPLE:\n CF_NAME create-service-key mydb mykey -c '{\"permissions\":\"read-only\"}'\n CF_NAME create-service-key mydb mykey -c ~/workspace/tmp/instance_config.json", + "translation": "CF_NAME create-service-key SERVICE_INSTANCE SERVICE_KEY [-c PARAMETERS_AS_JSON]\n\n Optionally provide service-specific configuration parameters in a valid JSON object in-line.\n CF_NAME create-service-key SERVICE_INSTANCE SERVICE_KEY -c '{\"name\":\"value\",\"name\":\"value\"}'\n\n Optionally provide a file containing service-specific configuration parameters in a valid JSON object. The path to the parameters file can be an absolute or relative path to a file.\n CF_NAME create-service-key SERVICE_INSTANCE SERVICE_KEY -c PATH_TO_FILE\n\n Example of valid JSON object:\n {\n \"permissions\": \"read-only\"\n }\n\nEXAMPLE:\n CF_NAME create-service-key mydb mykey -c '{\"permissions\":\"read-only\"}'\n CF_NAME create-service-key mydb mykey -c ~/workspace/tmp/instance_config.json", "modified": false }, { @@ -1135,8 +1135,8 @@ "modified": false }, { - "id": "CF_NAME update-service SERVICE [-p NEW_PLAN]", - "translation": "CF_NAME update-service SERVICE [-p NEW_PLAN]", + "id": "CF_NAME update-service SERVICE_INSTANCE [-p NEW_PLAN] [-c PARAMETERS_AS_JSON]\n\n Optionally provide service-specific configuration parameters in a valid JSON object in-line.\n cf create--service SERVICE PLAN SERVICE_INSTANCE -c '{\"name\":\"value\",\"name\":\"value\"}'\n\n Optionally provide a file containing service-specific configuration parameters in a valid JSON object. The path to the parameters file can be an absolute or relative path to a file.\n cf create-service SERVICE_INSTANCE -c PATH_TO_FILE\n\n Example of valid JSON object:\n {\n \"cluster_nodes\": {\n \"count\": 5,\n \"memory_mb\": 1024\n }\n }\n\nEXAMPLE:\n cf update-service mydb -p gold\n cf update-service mydb -c '{\"ram_gb\":4}'\n cf update-service mydb -c ~/workspace/tmp/instance_config.json", + "translation": "CF_NAME update-service SERVICE_INSTANCE [-p NEW_PLAN] [-c PARAMETERS_AS_JSON]\n\n Optionally provide service-specific configuration parameters in a valid JSON object in-line.\n cf create--service SERVICE PLAN SERVICE_INSTANCE -c '{\"name\":\"value\",\"name\":\"value\"}'\n\n Optionally provide a file containing service-specific configuration parameters in a valid JSON object. The path to the parameters file can be an absolute or relative path to a file.\n cf create-service SERVICE_INSTANCE -c PATH_TO_FILE\n\n Example of valid JSON object:\n {\n \"cluster_nodes\": {\n \"count\": 5,\n \"memory_mb\": 1024\n }\n }\n\nEXAMPLE:\n cf update-service mydb -p gold\n cf update-service mydb -c '{\"ram_gb\":4}'\n cf update-service mydb -c ~/workspace/tmp/instance_config.json", "modified": false }, { @@ -2609,11 +2609,6 @@ "translation": "Instance must be a non-negative integer", "modified": false }, - { - "id": "Invalid JSON provided in -c argument", - "translation": "Invalid JSON provided in -c argument", - "modified": false - }, { "id": "Invalid JSON response from server", "translation": "Invalid JSON response from server", @@ -2639,6 +2634,11 @@ "translation": "Invalid auth token: ", "modified": false }, + { + "id": "Invalid configuration provided for -c flag. Please provide a valid JSON object or a file path containing valid JSON.", + "translation": "Invalid configuration provided for -c flag. Please provide a valid JSON object or a file path containing valid JSON.", + "modified": false + }, { "id": "Invalid data from '{{.repoName}}' - plugin data does not exist", "translation": "Invalid data from '{{.repoName}}' - plugin data does not exist", diff --git a/cf/i18n/resources/pt_BR.all.json b/cf/i18n/resources/pt_BR.all.json index c21881baa8a..fe038c61e6c 100644 --- a/cf/i18n/resources/pt_BR.all.json +++ b/cf/i18n/resources/pt_BR.all.json @@ -580,9 +580,9 @@ "modified": false }, { - "id": "CF_NAME bind-service APP_NAME SERVICE_INSTANCE", - "translation": "CF_NAME bind-service APP INSTÂNCIA_DE_SERVIÇO", - "modified": true + "id": "CF_NAME bind-service APP_NAME SERVICE_INSTANCE [-c PARAMETERS_AS_JSON]\n\n Optionally provide service-specific configuration parameters in a valid JSON object in-line.\n CF_NAME bind-service APP_NAME SERVICE_INSTANCE -c '{\"name\":\"value\",\"name\":\"value\"}'\n\n Optionally provide a file containing service-specific configuration parameters in a valid JSON object. The path to the parameters file can be an absolute or relative path to a file.\n CF_NAME bind-service APP_NAME SERVICE_INSTANCE -c PATH_TO_FILE\n\n Example of valid JSON object:\n {\n \"cluster_nodes\": {\n \"count\": 5,\n \"memory_mb\": 1024\n }\n }\n\nEXAMPLE:\n\tLinux/Mac:\n\t\tCF_NAME bind-service myapp mydb -c '{\"permissions\":\"read-only\"}'\n\n\tWindows Command Line\n\t\tCF_NAME bind-service myapp mydb -c \"{\\\"permissions\\\":\\\"read-only\\\"}\"\n\n\tWindows PowerShell\n\t\tCF_NAME bind-service myapp mydb -c '{\\\"permissions\\\":\\\"read-only\\\"}'\n\t\n\tCF_NAME bind-service myapp mydb -c ~/workspace/tmp/instance_config.json", + "translation": "CF_NAME bind-service APP_NAME SERVICE_INSTANCE [-c PARAMETERS_AS_JSON]\n\n Optionally provide service-specific configuration parameters in a valid JSON object in-line.\n CF_NAME bind-service APP_NAME SERVICE_INSTANCE -c '{\"name\":\"value\",\"name\":\"value\"}'\n\n Optionally provide a file containing service-specific configuration parameters in a valid JSON object. The path to the parameters file can be an absolute or relative path to a file.\n CF_NAME bind-service APP_NAME SERVICE_INSTANCE -c PATH_TO_FILE\n\n Example of valid JSON object:\n {\n \"cluster_nodes\": {\n \"count\": 5,\n \"memory_mb\": 1024\n }\n }\n\nEXAMPLE:\n\tLinux/Mac:\n\t\tCF_NAME bind-service myapp mydb -c '{\"permissions\":\"read-only\"}'\n\n\tWindows Command Line\n\t\tCF_NAME bind-service myapp mydb -c \"{\\\"permissions\\\":\\\"read-only\\\"}\"\n\n\tWindows PowerShell\n\t\tCF_NAME bind-service myapp mydb -c '{\\\"permissions\\\":\\\"read-only\\\"}'\n\t\n\tCF_NAME bind-service myapp mydb -c ~/workspace/tmp/instance_config.json", + "modified": false }, { "id": "CF_NAME bind-staging-security-group SECURITY_GROUP", @@ -640,9 +640,9 @@ "modified": false }, { - "id": "CF_NAME create-service SERVICE PLAN SERVICE_INSTANCE\n\nEXAMPLE:\n CF_NAME create-service dbaas silver mydb\n\nTIP:\n Use 'CF_NAME create-user-provided-service' to make user-provided services available to cf apps", - "translation": "CF_NAME create-service SERVIÇO PLANO SERVICE_INSTANCE\n\nEXEMPLO:\n CF_NAME create-service cleardb spark clear-db-mine\n\nDICA:\n Utilize 'CF_NAME create-user-provided-service' para fazer com que serviços fornecidos pelo usuário sejam disponíveis para apps", - "modified": true + "id": "CF_NAME create-service SERVICE PLAN SERVICE_INSTANCE [-c PARAMETERS_AS_JSON]\n\n Optionally provide service-specific configuration parameters in a valid JSON object in-line:\n CF_NAME create-service SERVICE PLAN SERVICE_INSTANCE -c '{\"name\":\"value\",\"name\":\"value\"}'\n\n Optionally provide a file containing service-specific configuration parameters in a valid JSON object. The path to the parameters file can be an absolute or relative path to a file.\n CF_NAME create-service SERVICE_INSTANCE -c PATH_TO_FILE\n\n\tExample of valid JSON object:\n {\n \"cluster_nodes\": {\n \"count\": 5,\n \"memory_mb\": 1024\n }\n }\n\nEXAMPLE:\n\tLinux/Mac:\n\t\tCF_NAME create-service db-service silver -c '{\"ram_gb\":4}'\n\n\tWindows Command Line\n\t\tCF_NAME create-service db-service silver -c \"{\\\"ram_gb\\\":4}\"\n\n\tWindows PowerShell\n\t\tCF_NAME create-service db-service silver -c '{\\\"ram_gb\\\":4}'\n\n\tCF_NAME create-service db-service silver mydb -c ~/workspace/tmp/instance_config.json\n\nTIP:\n Use 'CF_NAME create-user-provided-service' to make user-provided services available to cf apps", + "translation": "CF_NAME create-service SERVICE PLAN SERVICE_INSTANCE [-c PARAMETERS_AS_JSON]\n\n Optionally provide service-specific configuration parameters in a valid JSON object in-line:\n CF_NAME create-service SERVICE PLAN SERVICE_INSTANCE -c '{\"name\":\"value\",\"name\":\"value\"}'\n\n Optionally provide a file containing service-specific configuration parameters in a valid JSON object. The path to the parameters file can be an absolute or relative path to a file.\n CF_NAME create-service SERVICE_INSTANCE -c PATH_TO_FILE\n\n\tExample of valid JSON object:\n {\n \"cluster_nodes\": {\n \"count\": 5,\n \"memory_mb\": 1024\n }\n }\n\nEXAMPLE:\n\tLinux/Mac:\n\t\tCF_NAME create-service db-service silver -c '{\"ram_gb\":4}'\n\n\tWindows Command Line\n\t\tCF_NAME create-service db-service silver -c \"{\\\"ram_gb\\\":4}\"\n\n\tWindows PowerShell\n\t\tCF_NAME create-service db-service silver -c '{\\\"ram_gb\\\":4}'\n\n\tCF_NAME create-service db-service silver mydb -c ~/workspace/tmp/instance_config.json\n\nTIP:\n Use 'CF_NAME create-user-provided-service' to make user-provided services available to cf apps", + "modified": false }, { "id": "CF_NAME create-service-auth-token LABEL PROVIDER TOKEN", @@ -655,8 +655,8 @@ "modified": false }, { - "id": "CF_NAME create-service-key SERVICE_INSTANCE SERVICE_KEY\n\nEXAMPLE:\n CF_NAME create-service-key mydb mykey", - "translation": "CF_NAME create-service-key SERVICE_INSTANCE SERVICE_KEY\n\nEXAMPLE:\n CF_NAME create-service-key mydb mykey", + "id": "CF_NAME create-service-key SERVICE_INSTANCE SERVICE_KEY [-c PARAMETERS_AS_JSON]\n\n Optionally provide service-specific configuration parameters in a valid JSON object in-line.\n CF_NAME create-service-key SERVICE_INSTANCE SERVICE_KEY -c '{\"name\":\"value\",\"name\":\"value\"}'\n\n Optionally provide a file containing service-specific configuration parameters in a valid JSON object. The path to the parameters file can be an absolute or relative path to a file.\n CF_NAME create-service-key SERVICE_INSTANCE SERVICE_KEY -c PATH_TO_FILE\n\n Example of valid JSON object:\n {\n \"permissions\": \"read-only\"\n }\n\nEXAMPLE:\n CF_NAME create-service-key mydb mykey -c '{\"permissions\":\"read-only\"}'\n CF_NAME create-service-key mydb mykey -c ~/workspace/tmp/instance_config.json", + "translation": "CF_NAME create-service-key SERVICE_INSTANCE SERVICE_KEY [-c PARAMETERS_AS_JSON]\n\n Optionally provide service-specific configuration parameters in a valid JSON object in-line.\n CF_NAME create-service-key SERVICE_INSTANCE SERVICE_KEY -c '{\"name\":\"value\",\"name\":\"value\"}'\n\n Optionally provide a file containing service-specific configuration parameters in a valid JSON object. The path to the parameters file can be an absolute or relative path to a file.\n CF_NAME create-service-key SERVICE_INSTANCE SERVICE_KEY -c PATH_TO_FILE\n\n Example of valid JSON object:\n {\n \"permissions\": \"read-only\"\n }\n\nEXAMPLE:\n CF_NAME create-service-key mydb mykey -c '{\"permissions\":\"read-only\"}'\n CF_NAME create-service-key mydb mykey -c ~/workspace/tmp/instance_config.json", "modified": false }, { @@ -1135,8 +1135,8 @@ "modified": false }, { - "id": "CF_NAME update-service SERVICE [-p NEW_PLAN]", - "translation": "CF_NAME update-service SERVICE [-p NEW_PLAN]", + "id": "CF_NAME update-service SERVICE_INSTANCE [-p NEW_PLAN] [-c PARAMETERS_AS_JSON]\n\n Optionally provide service-specific configuration parameters in a valid JSON object in-line.\n cf create--service SERVICE PLAN SERVICE_INSTANCE -c '{\"name\":\"value\",\"name\":\"value\"}'\n\n Optionally provide a file containing service-specific configuration parameters in a valid JSON object. The path to the parameters file can be an absolute or relative path to a file.\n cf create-service SERVICE_INSTANCE -c PATH_TO_FILE\n\n Example of valid JSON object:\n {\n \"cluster_nodes\": {\n \"count\": 5,\n \"memory_mb\": 1024\n }\n }\n\nEXAMPLE:\n cf update-service mydb -p gold\n cf update-service mydb -c '{\"ram_gb\":4}'\n cf update-service mydb -c ~/workspace/tmp/instance_config.json", + "translation": "CF_NAME update-service SERVICE_INSTANCE [-p NEW_PLAN] [-c PARAMETERS_AS_JSON]\n\n Optionally provide service-specific configuration parameters in a valid JSON object in-line.\n cf create--service SERVICE PLAN SERVICE_INSTANCE -c '{\"name\":\"value\",\"name\":\"value\"}'\n\n Optionally provide a file containing service-specific configuration parameters in a valid JSON object. The path to the parameters file can be an absolute or relative path to a file.\n cf create-service SERVICE_INSTANCE -c PATH_TO_FILE\n\n Example of valid JSON object:\n {\n \"cluster_nodes\": {\n \"count\": 5,\n \"memory_mb\": 1024\n }\n }\n\nEXAMPLE:\n cf update-service mydb -p gold\n cf update-service mydb -c '{\"ram_gb\":4}'\n cf update-service mydb -c ~/workspace/tmp/instance_config.json", "modified": false }, { @@ -2609,11 +2609,6 @@ "translation": "Instance must be a non-negative integer", "modified": false }, - { - "id": "Invalid JSON provided in -c argument", - "translation": "Invalid JSON provided in -c argument", - "modified": false - }, { "id": "Invalid JSON response from server", "translation": "Resposta JSON do servidor inválida", @@ -2639,6 +2634,11 @@ "translation": "Token de autenticação inválido: ", "modified": false }, + { + "id": "Invalid configuration provided for -c flag. Please provide a valid JSON object or a file path containing valid JSON.", + "translation": "Invalid configuration provided for -c flag. Please provide a valid JSON object or a file path containing valid JSON.", + "modified": false + }, { "id": "Invalid data from '{{.repoName}}' - plugin data does not exist", "translation": "Invalid data from '{{.repoName}}' - plugin data does not exist", diff --git a/cf/i18n/resources/zh_Hans.all.json b/cf/i18n/resources/zh_Hans.all.json index 18f327713d2..706e7aa213c 100644 --- a/cf/i18n/resources/zh_Hans.all.json +++ b/cf/i18n/resources/zh_Hans.all.json @@ -580,9 +580,9 @@ "modified": false }, { - "id": "CF_NAME bind-service APP_NAME SERVICE_INSTANCE", - "translation": "CF_NAME bind-service 应用程序 服务实例", - "modified": true + "id": "CF_NAME bind-service APP_NAME SERVICE_INSTANCE [-c PARAMETERS_AS_JSON]\n\n Optionally provide service-specific configuration parameters in a valid JSON object in-line.\n CF_NAME bind-service APP_NAME SERVICE_INSTANCE -c '{\"name\":\"value\",\"name\":\"value\"}'\n\n Optionally provide a file containing service-specific configuration parameters in a valid JSON object. The path to the parameters file can be an absolute or relative path to a file.\n CF_NAME bind-service APP_NAME SERVICE_INSTANCE -c PATH_TO_FILE\n\n Example of valid JSON object:\n {\n \"cluster_nodes\": {\n \"count\": 5,\n \"memory_mb\": 1024\n }\n }\n\nEXAMPLE:\n\tLinux/Mac:\n\t\tCF_NAME bind-service myapp mydb -c '{\"permissions\":\"read-only\"}'\n\n\tWindows Command Line\n\t\tCF_NAME bind-service myapp mydb -c \"{\\\"permissions\\\":\\\"read-only\\\"}\"\n\n\tWindows PowerShell\n\t\tCF_NAME bind-service myapp mydb -c '{\\\"permissions\\\":\\\"read-only\\\"}'\n\t\n\tCF_NAME bind-service myapp mydb -c ~/workspace/tmp/instance_config.json", + "translation": "CF_NAME bind-service APP_NAME SERVICE_INSTANCE [-c PARAMETERS_AS_JSON]\n\n Optionally provide service-specific configuration parameters in a valid JSON object in-line.\n CF_NAME bind-service APP_NAME SERVICE_INSTANCE -c '{\"name\":\"value\",\"name\":\"value\"}'\n\n Optionally provide a file containing service-specific configuration parameters in a valid JSON object. The path to the parameters file can be an absolute or relative path to a file.\n CF_NAME bind-service APP_NAME SERVICE_INSTANCE -c PATH_TO_FILE\n\n Example of valid JSON object:\n {\n \"cluster_nodes\": {\n \"count\": 5,\n \"memory_mb\": 1024\n }\n }\n\nEXAMPLE:\n\tLinux/Mac:\n\t\tCF_NAME bind-service myapp mydb -c '{\"permissions\":\"read-only\"}'\n\n\tWindows Command Line\n\t\tCF_NAME bind-service myapp mydb -c \"{\\\"permissions\\\":\\\"read-only\\\"}\"\n\n\tWindows PowerShell\n\t\tCF_NAME bind-service myapp mydb -c '{\\\"permissions\\\":\\\"read-only\\\"}'\n\t\n\tCF_NAME bind-service myapp mydb -c ~/workspace/tmp/instance_config.json", + "modified": false }, { "id": "CF_NAME bind-staging-security-group SECURITY_GROUP", @@ -640,9 +640,9 @@ "modified": false }, { - "id": "CF_NAME create-service SERVICE PLAN SERVICE_INSTANCE\n\nEXAMPLE:\n CF_NAME create-service dbaas silver mydb\n\nTIP:\n Use 'CF_NAME create-user-provided-service' to make user-provided services available to cf apps", - "translation": "CF_NAME create-service 服务类型 服务计划 实例名称\n\n示例:\n CF_NAME create-service cleardb spark clear-db-mine\n\n小贴士:\n 使用'CF_NAME create-user-provided-service'来创建由用户提供的服务供应用使用。", - "modified": true + "id": "CF_NAME create-service SERVICE PLAN SERVICE_INSTANCE [-c PARAMETERS_AS_JSON]\n\n Optionally provide service-specific configuration parameters in a valid JSON object in-line:\n CF_NAME create-service SERVICE PLAN SERVICE_INSTANCE -c '{\"name\":\"value\",\"name\":\"value\"}'\n\n Optionally provide a file containing service-specific configuration parameters in a valid JSON object. The path to the parameters file can be an absolute or relative path to a file.\n CF_NAME create-service SERVICE_INSTANCE -c PATH_TO_FILE\n\n\tExample of valid JSON object:\n {\n \"cluster_nodes\": {\n \"count\": 5,\n \"memory_mb\": 1024\n }\n }\n\nEXAMPLE:\n\tLinux/Mac:\n\t\tCF_NAME create-service db-service silver -c '{\"ram_gb\":4}'\n\n\tWindows Command Line\n\t\tCF_NAME create-service db-service silver -c \"{\\\"ram_gb\\\":4}\"\n\n\tWindows PowerShell\n\t\tCF_NAME create-service db-service silver -c '{\\\"ram_gb\\\":4}'\n\n\tCF_NAME create-service db-service silver mydb -c ~/workspace/tmp/instance_config.json\n\nTIP:\n Use 'CF_NAME create-user-provided-service' to make user-provided services available to cf apps", + "translation": "CF_NAME create-service SERVICE PLAN SERVICE_INSTANCE [-c PARAMETERS_AS_JSON]\n\n Optionally provide service-specific configuration parameters in a valid JSON object in-line:\n CF_NAME create-service SERVICE PLAN SERVICE_INSTANCE -c '{\"name\":\"value\",\"name\":\"value\"}'\n\n Optionally provide a file containing service-specific configuration parameters in a valid JSON object. The path to the parameters file can be an absolute or relative path to a file.\n CF_NAME create-service SERVICE_INSTANCE -c PATH_TO_FILE\n\n\tExample of valid JSON object:\n {\n \"cluster_nodes\": {\n \"count\": 5,\n \"memory_mb\": 1024\n }\n }\n\nEXAMPLE:\n\tLinux/Mac:\n\t\tCF_NAME create-service db-service silver -c '{\"ram_gb\":4}'\n\n\tWindows Command Line\n\t\tCF_NAME create-service db-service silver -c \"{\\\"ram_gb\\\":4}\"\n\n\tWindows PowerShell\n\t\tCF_NAME create-service db-service silver -c '{\\\"ram_gb\\\":4}'\n\n\tCF_NAME create-service db-service silver mydb -c ~/workspace/tmp/instance_config.json\n\nTIP:\n Use 'CF_NAME create-user-provided-service' to make user-provided services available to cf apps", + "modified": false }, { "id": "CF_NAME create-service-auth-token LABEL PROVIDER TOKEN", @@ -655,8 +655,8 @@ "modified": false }, { - "id": "CF_NAME create-service-key SERVICE_INSTANCE SERVICE_KEY\n\nEXAMPLE:\n CF_NAME create-service-key mydb mykey", - "translation": "CF_NAME create-service-key SERVICE_INSTANCE SERVICE_KEY\n\n样例:\n CF_NAME create-service-key mydb mykey", + "id": "CF_NAME create-service-key SERVICE_INSTANCE SERVICE_KEY [-c PARAMETERS_AS_JSON]\n\n Optionally provide service-specific configuration parameters in a valid JSON object in-line.\n CF_NAME create-service-key SERVICE_INSTANCE SERVICE_KEY -c '{\"name\":\"value\",\"name\":\"value\"}'\n\n Optionally provide a file containing service-specific configuration parameters in a valid JSON object. The path to the parameters file can be an absolute or relative path to a file.\n CF_NAME create-service-key SERVICE_INSTANCE SERVICE_KEY -c PATH_TO_FILE\n\n Example of valid JSON object:\n {\n \"permissions\": \"read-only\"\n }\n\nEXAMPLE:\n CF_NAME create-service-key mydb mykey -c '{\"permissions\":\"read-only\"}'\n CF_NAME create-service-key mydb mykey -c ~/workspace/tmp/instance_config.json", + "translation": "CF_NAME create-service-key SERVICE_INSTANCE SERVICE_KEY [-c PARAMETERS_AS_JSON]\n\n Optionally provide service-specific configuration parameters in a valid JSON object in-line.\n CF_NAME create-service-key SERVICE_INSTANCE SERVICE_KEY -c '{\"name\":\"value\",\"name\":\"value\"}'\n\n Optionally provide a file containing service-specific configuration parameters in a valid JSON object. The path to the parameters file can be an absolute or relative path to a file.\n CF_NAME create-service-key SERVICE_INSTANCE SERVICE_KEY -c PATH_TO_FILE\n\n Example of valid JSON object:\n {\n \"permissions\": \"read-only\"\n }\n\nEXAMPLE:\n CF_NAME create-service-key mydb mykey -c '{\"permissions\":\"read-only\"}'\n CF_NAME create-service-key mydb mykey -c ~/workspace/tmp/instance_config.json", "modified": false }, { @@ -1135,8 +1135,8 @@ "modified": false }, { - "id": "CF_NAME update-service SERVICE [-p NEW_PLAN]", - "translation": "CF_NAME update-service SERVICE [-p NEW_PLAN]", + "id": "CF_NAME update-service SERVICE_INSTANCE [-p NEW_PLAN] [-c PARAMETERS_AS_JSON]\n\n Optionally provide service-specific configuration parameters in a valid JSON object in-line.\n cf create--service SERVICE PLAN SERVICE_INSTANCE -c '{\"name\":\"value\",\"name\":\"value\"}'\n\n Optionally provide a file containing service-specific configuration parameters in a valid JSON object. The path to the parameters file can be an absolute or relative path to a file.\n cf create-service SERVICE_INSTANCE -c PATH_TO_FILE\n\n Example of valid JSON object:\n {\n \"cluster_nodes\": {\n \"count\": 5,\n \"memory_mb\": 1024\n }\n }\n\nEXAMPLE:\n cf update-service mydb -p gold\n cf update-service mydb -c '{\"ram_gb\":4}'\n cf update-service mydb -c ~/workspace/tmp/instance_config.json", + "translation": "CF_NAME update-service SERVICE_INSTANCE [-p NEW_PLAN] [-c PARAMETERS_AS_JSON]\n\n Optionally provide service-specific configuration parameters in a valid JSON object in-line.\n cf create--service SERVICE PLAN SERVICE_INSTANCE -c '{\"name\":\"value\",\"name\":\"value\"}'\n\n Optionally provide a file containing service-specific configuration parameters in a valid JSON object. The path to the parameters file can be an absolute or relative path to a file.\n cf create-service SERVICE_INSTANCE -c PATH_TO_FILE\n\n Example of valid JSON object:\n {\n \"cluster_nodes\": {\n \"count\": 5,\n \"memory_mb\": 1024\n }\n }\n\nEXAMPLE:\n cf update-service mydb -p gold\n cf update-service mydb -c '{\"ram_gb\":4}'\n cf update-service mydb -c ~/workspace/tmp/instance_config.json", "modified": false }, { @@ -2609,11 +2609,6 @@ "translation": "Instance must be a non-negative integer", "modified": false }, - { - "id": "Invalid JSON provided in -c argument", - "translation": "Invalid JSON provided in -c argument", - "modified": false - }, { "id": "Invalid JSON response from server", "translation": "无效的服务器JSON响应", @@ -2639,6 +2634,11 @@ "translation": "无效的身份验证令牌: ", "modified": false }, + { + "id": "Invalid configuration provided for -c flag. Please provide a valid JSON object or a file path containing valid JSON.", + "translation": "Invalid configuration provided for -c flag. Please provide a valid JSON object or a file path containing valid JSON.", + "modified": false + }, { "id": "Invalid data from '{{.repoName}}' - plugin data does not exist", "translation": "Invalid data from '{{.repoName}}' - plugin data does not exist", diff --git a/cf/i18n/resources/zh_Hant.all.json b/cf/i18n/resources/zh_Hant.all.json index 8f6a3e359ef..e2e7a213102 100644 --- a/cf/i18n/resources/zh_Hant.all.json +++ b/cf/i18n/resources/zh_Hant.all.json @@ -580,9 +580,9 @@ "modified": false }, { - "id": "CF_NAME bind-service APP_NAME SERVICE_INSTANCE", - "translation": "CF_NAME bind-service APP SERVICE_INSTANCE", - "modified": true + "id": "CF_NAME bind-service APP_NAME SERVICE_INSTANCE [-c PARAMETERS_AS_JSON]\n\n Optionally provide service-specific configuration parameters in a valid JSON object in-line.\n CF_NAME bind-service APP_NAME SERVICE_INSTANCE -c '{\"name\":\"value\",\"name\":\"value\"}'\n\n Optionally provide a file containing service-specific configuration parameters in a valid JSON object. The path to the parameters file can be an absolute or relative path to a file.\n CF_NAME bind-service APP_NAME SERVICE_INSTANCE -c PATH_TO_FILE\n\n Example of valid JSON object:\n {\n \"cluster_nodes\": {\n \"count\": 5,\n \"memory_mb\": 1024\n }\n }\n\nEXAMPLE:\n\tLinux/Mac:\n\t\tCF_NAME bind-service myapp mydb -c '{\"permissions\":\"read-only\"}'\n\n\tWindows Command Line\n\t\tCF_NAME bind-service myapp mydb -c \"{\\\"permissions\\\":\\\"read-only\\\"}\"\n\n\tWindows PowerShell\n\t\tCF_NAME bind-service myapp mydb -c '{\\\"permissions\\\":\\\"read-only\\\"}'\n\t\n\tCF_NAME bind-service myapp mydb -c ~/workspace/tmp/instance_config.json", + "translation": "CF_NAME bind-service APP_NAME SERVICE_INSTANCE [-c PARAMETERS_AS_JSON]\n\n Optionally provide service-specific configuration parameters in a valid JSON object in-line.\n CF_NAME bind-service APP_NAME SERVICE_INSTANCE -c '{\"name\":\"value\",\"name\":\"value\"}'\n\n Optionally provide a file containing service-specific configuration parameters in a valid JSON object. The path to the parameters file can be an absolute or relative path to a file.\n CF_NAME bind-service APP_NAME SERVICE_INSTANCE -c PATH_TO_FILE\n\n Example of valid JSON object:\n {\n \"cluster_nodes\": {\n \"count\": 5,\n \"memory_mb\": 1024\n }\n }\n\nEXAMPLE:\n\tLinux/Mac:\n\t\tCF_NAME bind-service myapp mydb -c '{\"permissions\":\"read-only\"}'\n\n\tWindows Command Line\n\t\tCF_NAME bind-service myapp mydb -c \"{\\\"permissions\\\":\\\"read-only\\\"}\"\n\n\tWindows PowerShell\n\t\tCF_NAME bind-service myapp mydb -c '{\\\"permissions\\\":\\\"read-only\\\"}'\n\t\n\tCF_NAME bind-service myapp mydb -c ~/workspace/tmp/instance_config.json", + "modified": false }, { "id": "CF_NAME bind-staging-security-group SECURITY_GROUP", @@ -640,9 +640,9 @@ "modified": false }, { - "id": "CF_NAME create-service SERVICE PLAN SERVICE_INSTANCE\n\nEXAMPLE:\n CF_NAME create-service dbaas silver mydb\n\nTIP:\n Use 'CF_NAME create-user-provided-service' to make user-provided services available to cf apps", - "translation": "CF_NAME create-service SERVICE PLAN SERVICE_INSTANCE\n\nEXAMPLE:\n CF_NAME create-service cleardb spark clear-db-mine\n\nTIP:\n Use 'CF_NAME create-user-provided-service' to make user-provided services available to cf apps", - "modified": true + "id": "CF_NAME create-service SERVICE PLAN SERVICE_INSTANCE [-c PARAMETERS_AS_JSON]\n\n Optionally provide service-specific configuration parameters in a valid JSON object in-line:\n CF_NAME create-service SERVICE PLAN SERVICE_INSTANCE -c '{\"name\":\"value\",\"name\":\"value\"}'\n\n Optionally provide a file containing service-specific configuration parameters in a valid JSON object. The path to the parameters file can be an absolute or relative path to a file.\n CF_NAME create-service SERVICE_INSTANCE -c PATH_TO_FILE\n\n\tExample of valid JSON object:\n {\n \"cluster_nodes\": {\n \"count\": 5,\n \"memory_mb\": 1024\n }\n }\n\nEXAMPLE:\n\tLinux/Mac:\n\t\tCF_NAME create-service db-service silver -c '{\"ram_gb\":4}'\n\n\tWindows Command Line\n\t\tCF_NAME create-service db-service silver -c \"{\\\"ram_gb\\\":4}\"\n\n\tWindows PowerShell\n\t\tCF_NAME create-service db-service silver -c '{\\\"ram_gb\\\":4}'\n\n\tCF_NAME create-service db-service silver mydb -c ~/workspace/tmp/instance_config.json\n\nTIP:\n Use 'CF_NAME create-user-provided-service' to make user-provided services available to cf apps", + "translation": "CF_NAME create-service SERVICE PLAN SERVICE_INSTANCE [-c PARAMETERS_AS_JSON]\n\n Optionally provide service-specific configuration parameters in a valid JSON object in-line:\n CF_NAME create-service SERVICE PLAN SERVICE_INSTANCE -c '{\"name\":\"value\",\"name\":\"value\"}'\n\n Optionally provide a file containing service-specific configuration parameters in a valid JSON object. The path to the parameters file can be an absolute or relative path to a file.\n CF_NAME create-service SERVICE_INSTANCE -c PATH_TO_FILE\n\n\tExample of valid JSON object:\n {\n \"cluster_nodes\": {\n \"count\": 5,\n \"memory_mb\": 1024\n }\n }\n\nEXAMPLE:\n\tLinux/Mac:\n\t\tCF_NAME create-service db-service silver -c '{\"ram_gb\":4}'\n\n\tWindows Command Line\n\t\tCF_NAME create-service db-service silver -c \"{\\\"ram_gb\\\":4}\"\n\n\tWindows PowerShell\n\t\tCF_NAME create-service db-service silver -c '{\\\"ram_gb\\\":4}'\n\n\tCF_NAME create-service db-service silver mydb -c ~/workspace/tmp/instance_config.json\n\nTIP:\n Use 'CF_NAME create-user-provided-service' to make user-provided services available to cf apps", + "modified": false }, { "id": "CF_NAME create-service-auth-token LABEL PROVIDER TOKEN", @@ -655,8 +655,8 @@ "modified": false }, { - "id": "CF_NAME create-service-key SERVICE_INSTANCE SERVICE_KEY\n\nEXAMPLE:\n CF_NAME create-service-key mydb mykey", - "translation": "CF_NAME create-service-key SERVICE_INSTANCE SERVICE_KEY\n\nEXAMPLE:\n CF_NAME create-service-key mydb mykey", + "id": "CF_NAME create-service-key SERVICE_INSTANCE SERVICE_KEY [-c PARAMETERS_AS_JSON]\n\n Optionally provide service-specific configuration parameters in a valid JSON object in-line.\n CF_NAME create-service-key SERVICE_INSTANCE SERVICE_KEY -c '{\"name\":\"value\",\"name\":\"value\"}'\n\n Optionally provide a file containing service-specific configuration parameters in a valid JSON object. The path to the parameters file can be an absolute or relative path to a file.\n CF_NAME create-service-key SERVICE_INSTANCE SERVICE_KEY -c PATH_TO_FILE\n\n Example of valid JSON object:\n {\n \"permissions\": \"read-only\"\n }\n\nEXAMPLE:\n CF_NAME create-service-key mydb mykey -c '{\"permissions\":\"read-only\"}'\n CF_NAME create-service-key mydb mykey -c ~/workspace/tmp/instance_config.json", + "translation": "CF_NAME create-service-key SERVICE_INSTANCE SERVICE_KEY [-c PARAMETERS_AS_JSON]\n\n Optionally provide service-specific configuration parameters in a valid JSON object in-line.\n CF_NAME create-service-key SERVICE_INSTANCE SERVICE_KEY -c '{\"name\":\"value\",\"name\":\"value\"}'\n\n Optionally provide a file containing service-specific configuration parameters in a valid JSON object. The path to the parameters file can be an absolute or relative path to a file.\n CF_NAME create-service-key SERVICE_INSTANCE SERVICE_KEY -c PATH_TO_FILE\n\n Example of valid JSON object:\n {\n \"permissions\": \"read-only\"\n }\n\nEXAMPLE:\n CF_NAME create-service-key mydb mykey -c '{\"permissions\":\"read-only\"}'\n CF_NAME create-service-key mydb mykey -c ~/workspace/tmp/instance_config.json", "modified": false }, { @@ -1135,8 +1135,8 @@ "modified": false }, { - "id": "CF_NAME update-service SERVICE [-p NEW_PLAN]", - "translation": "CF_NAME update-service SERVICE [-p NEW_PLAN]", + "id": "CF_NAME update-service SERVICE_INSTANCE [-p NEW_PLAN] [-c PARAMETERS_AS_JSON]\n\n Optionally provide service-specific configuration parameters in a valid JSON object in-line.\n cf create--service SERVICE PLAN SERVICE_INSTANCE -c '{\"name\":\"value\",\"name\":\"value\"}'\n\n Optionally provide a file containing service-specific configuration parameters in a valid JSON object. The path to the parameters file can be an absolute or relative path to a file.\n cf create-service SERVICE_INSTANCE -c PATH_TO_FILE\n\n Example of valid JSON object:\n {\n \"cluster_nodes\": {\n \"count\": 5,\n \"memory_mb\": 1024\n }\n }\n\nEXAMPLE:\n cf update-service mydb -p gold\n cf update-service mydb -c '{\"ram_gb\":4}'\n cf update-service mydb -c ~/workspace/tmp/instance_config.json", + "translation": "CF_NAME update-service SERVICE_INSTANCE [-p NEW_PLAN] [-c PARAMETERS_AS_JSON]\n\n Optionally provide service-specific configuration parameters in a valid JSON object in-line.\n cf create--service SERVICE PLAN SERVICE_INSTANCE -c '{\"name\":\"value\",\"name\":\"value\"}'\n\n Optionally provide a file containing service-specific configuration parameters in a valid JSON object. The path to the parameters file can be an absolute or relative path to a file.\n cf create-service SERVICE_INSTANCE -c PATH_TO_FILE\n\n Example of valid JSON object:\n {\n \"cluster_nodes\": {\n \"count\": 5,\n \"memory_mb\": 1024\n }\n }\n\nEXAMPLE:\n cf update-service mydb -p gold\n cf update-service mydb -c '{\"ram_gb\":4}'\n cf update-service mydb -c ~/workspace/tmp/instance_config.json", "modified": false }, { @@ -2609,11 +2609,6 @@ "translation": "Instance must be a non-negative integer", "modified": false }, - { - "id": "Invalid JSON provided in -c argument", - "translation": "Invalid JSON provided in -c argument", - "modified": false - }, { "id": "Invalid JSON response from server", "translation": "Invalid JSON response from server", @@ -2639,6 +2634,11 @@ "translation": "Invalid auth token: ", "modified": false }, + { + "id": "Invalid configuration provided for -c flag. Please provide a valid JSON object or a file path containing valid JSON.", + "translation": "Invalid configuration provided for -c flag. Please provide a valid JSON object or a file path containing valid JSON.", + "modified": false + }, { "id": "Invalid data from '{{.repoName}}' - plugin data does not exist", "translation": "Invalid data from '{{.repoName}}' - plugin data does not exist", diff --git a/cf/models/service_binding.go b/cf/models/service_binding.go index b30addd6c7d..1acff82b148 100644 --- a/cf/models/service_binding.go +++ b/cf/models/service_binding.go @@ -1,5 +1,11 @@ package models +type ServiceBindingRequest struct { + AppGuid string `json:"app_guid"` + ServiceInstanceGuid string `json:"service_instance_guid"` + Params map[string]interface{} `json:"parameters,omitempty"` +} + type ServiceBindingFields struct { Guid string Url string diff --git a/cf/models/service_instance.go b/cf/models/service_instance.go index 384e2de0ed1..a8df2153e50 100644 --- a/cf/models/service_instance.go +++ b/cf/models/service_instance.go @@ -6,13 +6,18 @@ type LastOperationFields struct { Description string } -type ServiceInstanceRequest struct { +type ServiceInstanceCreateRequest struct { Name string `json:"name"` SpaceGuid string `json:"space_guid"` PlanGuid string `json:"service_plan_guid"` Params map[string]interface{} `json:"parameters,omitempty"` } +type ServiceInstanceUpdateRequest struct { + PlanGuid string `json:"service_plan_guid"` + Params map[string]interface{} `json:"parameters,omitempty"` +} + type ServiceInstanceFields struct { Guid string Name string diff --git a/cf/models/service_key.go b/cf/models/service_key.go index 1f1b3956597..f304cee31c9 100644 --- a/cf/models/service_key.go +++ b/cf/models/service_key.go @@ -8,6 +8,12 @@ type ServiceKeyFields struct { ServiceInstanceUrl string } +type ServiceKeyRequest struct { + Name string `json:"name"` + ServiceInstanceGuid string `json:"service_instance_guid"` + Params map[string]interface{} `json:"parameters,omitempty"` +} + type ServiceKey struct { Fields ServiceKeyFields Credentials map[string]interface{} diff --git a/json/json_parser.go b/json/json_parser.go index ecc4768cec7..a1e1de11533 100644 --- a/json/json_parser.go +++ b/json/json_parser.go @@ -27,23 +27,36 @@ func ParseJsonArray(path string) ([]map[string]interface{}, error) { return stringMaps, nil } -func ParseJsonHash(path string) (map[string]interface{}, error) { - if path == "" { +func ParseJsonFromFileOrString(fileOrJson string) (map[string]interface{}, error) { + var jsonMap map[string]interface{} + var err error + var bytes []byte + + if fileOrJson == "" { return nil, nil } - bytes, err := readJsonFile(path) - if err != nil { - return nil, err + if fileExists(fileOrJson) { + bytes, err = readJsonFile(fileOrJson) + if err != nil { + return nil, err + } + } else { + bytes = []byte(fileOrJson) } - stringMap := map[string]interface{}{} - err = json.Unmarshal(bytes, &stringMap) + jsonMap, err = parseJson(bytes) + if err != nil { - return nil, errors.NewWithFmt("Incorrect json format: %s", err.Error()) + return nil, err } - return stringMap, nil + return jsonMap, nil +} + +func fileExists(path string) bool { + _, err := os.Stat(path) + return err == nil } func readJsonFile(path string) ([]byte, error) { @@ -59,3 +72,13 @@ func readJsonFile(path string) ([]byte, error) { return bytes, nil } + +func parseJson(bytes []byte) (map[string]interface{}, error) { + stringMap := map[string]interface{}{} + err := json.Unmarshal(bytes, &stringMap) + if err != nil { + return nil, errors.NewWithFmt("Incorrect json format: %s", err.Error()) + } + + return stringMap, nil +} diff --git a/json/json_parser_test.go b/json/json_parser_test.go index 33d7c1dfc36..6050bb3e6de 100644 --- a/json/json_parser_test.go +++ b/json/json_parser_test.go @@ -47,49 +47,100 @@ var _ = Describe("JSON Parser", func() { It("tries to convert the json file but fails because it was given something it didn't like", func() { _, err := json.ParseJsonArray(filename) - Expect(err).ToNot(BeNil()) + Expect(err).To(MatchError("Incorrect json format: invalid character 'S' looking for beginning of value")) }) }) }) - Describe("ParseJsonHash", func() { - var filename string - var tmpFile *os.File + Describe("ParseJsonFromFileOrString", func() { + Context("when the input is empty", func() { + It("returns nil", func() { + result, err := json.ParseJsonFromFileOrString("") - Context("when everything is proper", func() { - BeforeEach(func() { - tmpFile, _ = ioutil.TempFile("", "") - filename = tmpFile.Name() - ioutil.WriteFile(filename, []byte("{\"akey\": \"avalue\"}"), 0644) + Expect(result).To(BeNil()) + Expect(err).To(BeNil()) }) + }) + + Context("when the input is a file", func() { + var jsonFile *os.File + var fileContent string AfterEach(func() { - tmpFile.Close() - os.Remove(tmpFile.Name()) + if jsonFile != nil { + jsonFile.Close() + os.Remove(jsonFile.Name()) + } }) - It("converts a json file into an unmarshalled slice of string->string map objects", func() { - stringMap, err := json.ParseJsonHash(filename) - Expect(err).To(BeNil()) - Expect(stringMap["akey"]).To(Equal("avalue")) + BeforeEach(func() { + fileContent = `{"foo": "bar"}` + }) + + JustBeforeEach(func() { + var err error + jsonFile, err = ioutil.TempFile("", "") + Expect(err).ToNot(HaveOccurred()) + + err = ioutil.WriteFile(jsonFile.Name(), []byte(fileContent), os.ModePerm) + Expect(err).NotTo(HaveOccurred()) + }) + + It("returns the parsed json from the file", func() { + result, err := json.ParseJsonFromFileOrString(jsonFile.Name()) + Expect(err).NotTo(HaveOccurred()) + + Expect(result).To(Equal(map[string]interface{}{"foo": "bar"})) + }) + + Context("when the file contains invalid json", func() { + BeforeEach(func() { + fileContent = `badtimes` + }) + + It("returns an error", func() { + _, err := json.ParseJsonFromFileOrString(jsonFile.Name()) + Expect(err).To(MatchError("Incorrect json format: invalid character 'b' looking for beginning of value")) + }) }) }) - Context("when the JSON is invalid", func() { + Context("when the input is considered a json string (when it is not a file path)", func() { + var jsonString string + BeforeEach(func() { - tmpFile, _ = ioutil.TempFile("", "") - filename = tmpFile.Name() - ioutil.WriteFile(filename, []byte("SCARY NOISES}"), 0644) + jsonString = `{"foo": "bar"}` }) - AfterEach(func() { - tmpFile.Close() - os.Remove(tmpFile.Name()) + It("returns the parsed json", func() { + result, err := json.ParseJsonFromFileOrString(jsonString) + Expect(err).NotTo(HaveOccurred()) + + Expect(result).To(Equal(map[string]interface{}{"foo": "bar"})) }) - It("tries to convert the json file but fails because it was given something it didn't like", func() { - _, err := json.ParseJsonHash(filename) - Expect(err).ToNot(BeNil()) + Context("when the JSON is invalid", func() { + BeforeEach(func() { + jsonString = "SOMETHING IS WRONG" + }) + + It("returns a json parse error", func() { + _, err := json.ParseJsonFromFileOrString(jsonString) + Expect(err).To(MatchError("Incorrect json format: invalid character 'S' looking for beginning of value")) + }) + }) + }) + + Context("when the input is neither a file nor a json string", func() { + var invalidInput string + + BeforeEach(func() { + invalidInput = "boo" + }) + + It("returns an error", func() { + _, err := json.ParseJsonFromFileOrString(invalidInput) + Expect(err).To(HaveOccurred()) }) }) }) diff --git a/testhelpers/commands/fake_app_binder.go b/testhelpers/commands/fake_app_binder.go index 319b42fc533..b05c02d0cbc 100644 --- a/testhelpers/commands/fake_app_binder.go +++ b/testhelpers/commands/fake_app_binder.go @@ -5,15 +5,17 @@ import "github.com/cloudfoundry/cli/cf/models" type FakeAppBinder struct { AppsToBind []models.Application InstancesToBindTo []models.ServiceInstance + Params map[string]interface{} BindApplicationReturns struct { Error error } } -func (binder *FakeAppBinder) BindApplication(app models.Application, service models.ServiceInstance) error { +func (binder *FakeAppBinder) BindApplication(app models.Application, service models.ServiceInstance, paramsMap map[string]interface{}) error { binder.AppsToBind = append(binder.AppsToBind, app) binder.InstancesToBindTo = append(binder.InstancesToBindTo, service) + binder.Params = paramsMap return binder.BindApplicationReturns.Error }