如何不绑定app的情况下获得predix-zone-id?

Ivar_PredixCN 2017-08-28 09:36:45
PROBLEM
In order to call Predix services such as Asset, ACS, Analytics, or Time Series you must specify a Predix-Zone-Id header in your requests. How do you find the zone id when you do not yet have an app to push?

STEPS

Services such as Asset, ACS, and Time Series are multi-tenant and therefore share a common service endpoint. Your data is kept separate from others through the Predix-Zone-Id. There are a few ways to retrieve this guid that is needed when making any requests to the service. You do want to keep this value a secret between you and the service to help prevent unauthorized use of your partition.

The following examples use an instance of predix-timeseries called my-predix-timeseries.

(a) Run cf service my-predix-timeseries --guid and use the returned value.

This command simply returns a string such as:
12345678-1234-abcd-1a2b-1234abcd5678

(b) Use a Predix service key to get all of the VCAP details for your service including the Predix-Zone-Id, URIs, and connection details.


$ cf create-service-key my-predix-timeseries my-timeseries-key
...
OK
$ cf service-key my-predix-timeseries my-timeseries-key
{
"ingest": {
"uri": "wss://gateway-predix-data-services.run.aws-usw02-pr.ice.predix.io/v1/stream/messages",
"zone-http-header-name": "Predix-Zone-Id",
"zone-http-header-value": "12345678-1234-abcd-12ab-1234abcd5678",
"zone-token-scopes": [
"timeseries.zones.12345678-1234-abcd-12ab-1234abcd5678.user",
"timeseries.zones.12345678-1234-abcd-12ab-1234abcd5678.ingest"
]
},
"query": {
"uri": "https://time-series-store-predix.run.aws-usw02-pr.ice.predix.io/v1/datapoints",
"zone-http-header-name": "Predix-Zone-Id",
"zone-http-header-value": "12345678-1234-abcd-12ab-1234abcd5678",
"zone-token-scopes": [
"timeseries.zones.12345678-1234-abcd-12ab-1234abcd5678.user",
"timeseries.zones.12345678-1234-abcd-12ab-1234abcd5678.query"
]
}
}



You can find the Predix-Zone-Id in that returned dictionary.

(c) You can start with a hello world application, cf push to cloud foundry, cf bind the service to the app, then run cf env for the app.

DEPENDENCIES
Cloud Foundry CLI

You should know how to create services in Cloud Foundry.

RESOURCES
Cloud Foundry Documentation on Managing Service Keys
https://docs.cloudfoundry.org/devguide/services/service-keys.html
...全文
893 12 打赏 收藏 转发到动态 举报
写回复
用AI写文章
12 条回复
切换为时间正序
请发表友善的回复…
发表回复
nettman 2017-09-06
  • 打赏
  • 举报
回复
wanc1212 2017-08-31
  • 打赏
  • 举报
回复
看不明白,我是新人,还是要支持的
csdn987q 2017-08-31
  • 打赏
  • 举报
回复
qq_40012785 2017-08-29
  • 打赏
  • 举报
回复
haofffffffffffff
csdn987q 2017-08-29
  • 打赏
  • 举报
回复
hugh_z 2017-08-29
  • 打赏
  • 举报
回复
很专业的样子.
cattpon 2017-08-29
  • 打赏
  • 举报
回复
learning~
Cosmos-Z 2017-08-29
  • 打赏
  • 举报
回复
哦哦哦哦哦哦哦哦哦
nettman 2017-08-28
  • 打赏
  • 举报
回复
qq_40008338 2017-08-28
  • 打赏
  • 举报
回复
评论送积分吗
wjxxiao 2017-08-28
  • 打赏
  • 举报
回复
看不明白,我是新人

163

社区成员

发帖
与我相关
我的任务
社区描述
GE的Predix平台整合云计算可扩展性、大数据管理和高级分析技术来助力新一代的数字化企业。结合GE自己作为全球工业界领导者的经验,Predix云平台为开发高级工业应用程序提供可连接性、安全和高性能。
云计算大数据 技术论坛(原bbs)
社区管理员
  • GE Predix工业互联网开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧