如何将不同的Watson Discovery绑定到每个CF应用程序

时间:2018-11-20 13:18:53

标签: ibm-cloud ibm-watson watson-discovery

我正在用一个资源组,一个CF组织,一个空间创建CF应用程序。

我将不同的Watson Discovery绑定到每个CF应用程序。

出现错误提示

 "Error response from the server. Status code: 400; description: 400 Code: BXNIM0150E, Message: The service name part of the provided CRNs must be unique, Details: Service name 'discovery' must be unique for all provided CRNs."

特别是,第一个绑定(A_0001_APP)似乎工作正常,但第二个绑定(D_0001_APP)却无法正常工作。

这是正确的方法吗?

任何帮助将不胜感激。

这是一个简化的日志。

####################################################################################
# Bind to A_0001_APP -> That is absolutely fine.
####################################################################################
$ ibmcloud target
API endpoint:      https://api.au-syd.bluemix.net
Region:            au-syd
User:              *************************
Account:           *************************
Resource group:    d_resource01
CF API endpoint:   https://api.au-syd.bluemix.net (API version: 2.106.0)
Org:               d_org01
Space:             dev


$ ibmcloud cf push A_0001_APP
.....


$ ibmcloud resource service-instance-create A_0001_DISCOVERY discovery advanced jp-tok
Creating service instance A_0001_DISCOVERY in resource group d_resource01 of account *************************
OK
Service instance A_0001_DISCOVERY was created.
Name               Location   State      Type               Tags
A_0001_DISCOVERY   jp-tok     inactive   service_instance


$ ibmcloud resource service-key-create A_0001_DISCOVERY_CREDENTIAL Manager --instance-name A_0001_DISCOVERY
Creating service key of service instance A_0001_DISCOVERY under account *************************.
OK
Service key crn:v1:bluemix:public:discovery:jp-tok:a/*************************:resource-key:************************* was created.
Name:          A_0001_DISCOVERY_CREDENTIAL
ID:            crn:v1:bluemix:public:discovery:jp-tok:a/*************************:*************************:resource-key:*************************
Created At:    Mon Nov 19 07:57:03 UTC 2018
State:         active
Credentials:   .......

$ ibmcloud resource service-alias-create A_0001_DISCOVERY_ALIAS --instance-name A_0001_DISCOVERY
Creating alias A_0001_DISCOVERY_ALIAS of service instance A_0001_DISCOVERY from resource group d_resource01 into space dev...
OK
Service alias A_0001_DISCOVERY_ALIAS was successfully created.

ID:                 crn:v1:bluemix:public:discovery:au-syd:a//*************************::/*************************::resource-alias:/*************************:
Name:               A_0001_DISCOVERY_ALIAS
State               active
Service Instance:   A_0001_DISCOVERY
Space:              dev
Tags:
Parameters:

$ ibmcloud resource service-binding-create A_0001_DISCOVERY_ALIAS A_0001_APP Manager --service-id my_service
Binding service alias A_0001_DISCOVERY_ALIAS to app A_0001_APP in space dev...
OK
Service binding crn:v1:bluemix:public:discovery:au-syd:a/:*************************:resource-binding::************************* was created.


####################################################################################
# Bind to D_0001_APP -> I can't create service-binding.
####################################################################################
$ ibmcloud target
API endpoint:      https://api.au-syd.bluemix.net
Region:            au-syd
User:              *************************
Account:           *************************
Resource group:    d_resource01
CF API endpoint:   https://api.au-syd.bluemix.net (API version: 2.106.0)
Org:               d_org01
Space:             dev

$ ibmcloud cf push D_0001_APP
.....

$ ibmcloud resource service-instance-create D_0001_DISCOVERY discovery advanced jp-tok
Creating service instance D_0001_DISCOVERY in resource group d_resource01 of account *************************
OK
Service instance D_0001_DISCOVERY was created.
Name               Location   State      Type               Tags
D_0001_DISCOVERY   jp-tok     inactive   service_instance

$ ibmcloud resource service-key-create D_0001_DISCOVERY_CREDENTIAL Manager --instance-name D_0001_DISCOVERY
Creating service key of service instance D_0001_DISCOVERY under account *************************.
OK
Service key crn:v1:bluemix:public:discovery:jp-tok:a/*************************:resource-key:************************* was created.
Name:          D_0001_DISCOVERY_CREDENTIAL
ID:            crn:v1:bluemix:public:discovery:jp-tok:a/*************************:*************************:resource-key:*************************
Created At:    Tue Nov 20 10:12:56 UTC 2018
State:         active
Credentials:    .......

$ ibmcloud resource service-alias-create D_0001_DISCOVERY_ALIAS --instance-name D_0001_DISCOVERY
Creating alias D_0001_DISCOVERY_ALIAS of service instance D_0001_DISCOVERY from resource group d_resource01 into space dev...
OK
Service alias D_0001_DISCOVERY_ALIAS was successfully created.
ID:                 crn:v1:bluemix:public:discovery:au-syd:a//*************************::/*************************::resource-alias:/*************************:
Name:               D_0001_DISCOVERY_ALIAS
State               active
Service Instance:   D_0001_DISCOVERY
Space:              dev
Tags:
Parameters:

$ ibmcloud resource service-binding-create D_0001_DISCOVERY_ALIAS D_0001_APP Manager --service-id my_service
Binding service alias D_0001_DISCOVERY_ALIAS to app D_0001_APP in space dev...
FAILED
Error response from the server. Status code: 400; description: 400 Code: BXNIM0150E, Message: The service name part of the provided CRNs must be unique, Details: Service name 'discovery' must be unique for all provided CRNs.
script returned exit code 1

1 个答案:

答案 0 :(得分:0)

如错误中所述,CRN(云资源名称)的服务名称部分必须是唯一的。

CRN的基本规范格式为:

crn:version:cname:ctype:service-name:location:scope:service-instance:resource-type:resource

服务名称段唯一地标识了云提供的功能(服务,组件,产品)。该功能可以是用户提供的服务,例如IBM Cloud目录中列出的服务,也可以是对IBM Cloud功能至关重要的内部体系结构组件。

service-name指示资源所属的服务,并且IBM Cloud强制执行服务名称的全局唯一性。服务名称必须为字母数字,小写字母,“-”以外的空格或特殊字符。

是的。我能够使用唯一的别名重现该问题,而对我有用的是另一个service-id

ibmcloud resource service-binding-create D_0001_DISCOVERY_ALIAS D_0001_APP Manager --service-id myserviceID