很多不是我们所想象的那种文档。
像Java api的这种文档,还真没有。
但是关于这方面的资料还是有的,可能cloud foundry并没有我们想象的那样,有很多的api。可能就那么几个。
比如:
paas认证,创建应用程序,创建路由应用程序,上传application,启动app等。
- authenticate to the PaaS
- create the application
- create a route for the application
- associate the route with the application
- upload the application bits
- start the app
上面实现的rest api。
Authentication【paas认证】
[mw_shl_code=bash,true]curl -H 'AUTHORIZATION: Basic Y2Y6' -d "username=me&password=myself&grant_type=password"
${PAAS_HOST}/uaa/oauth/token[/mw_shl_code]
创建应用程序
[mw_shl_code=bash,true]export post_data=$(cat <<eof
{ "disk_quota":2048,
"memory": 512,
"name":"${appname}",
"space_guid":"${space}"}
eof
)
curl -X POST -d "${post_data}" -H "${AUTH}" ${PAAS_HOST}/v2/apps[/mw_shl_code]
创建路由
[mw_shl_code=bash,true]export post_data=$(cat<<eof
{ "domain_guid":"${domain}",
"host":"${appname}",
"space_guid":"${space}"}
eof
)
curl -X POST -d "${post_data}" -H "${AUTH}" ${PAAS_HOST}/v2/routes[/mw_shl_code]
关联路由
[mw_shl_code=bash,true]curl -X PUT -H "${AUTH}" ${PAAS_HOST}/v2/apps/${APP}/routes/${ROUTE}[/mw_shl_code]
上传 Application Bits
[mw_shl_code=bash,true]curl -X PUT -H "${AUTH}" -F 'resources=[]' -F "application=@application.zip"
${PAAS_HOST}/v2/apps/${APP}/bits[/mw_shl_code]
启动App
[mw_shl_code=bash,true]curl -X PUT -d '{"console":true,"state":"STARTED"}' -H "${AUTH}"
${PAAS_HOST}/v2/apps/${APP}[/mw_shl_code]
|