自定义来源新增
新增商品类型为AstroZero应用的broker来源。
同时以AstroZero为例开发Service Broker接口Demo,提供以下接口进行接口配置:
1)认证凭据
URL
POST /baas/auth/v1.0/oauth2/token
Headers示例
Content-Type:application/x-www-form-urlencoded
请求示例
{
"grant_type": "client_credentials",
"client_id": "",
"client_secret": ""
}
响应示例
{
"access_token": "",
"expires_in": 3600,
"token_type": "Bearer"
}
配置图片
认证凭据携带说明:调用服务目录等其他接口时,会取鉴权接口的Body出差中的access_token,放入Header中access-token中,来建立鉴权。
2)服务目录
URL
GET /service/CP_DS__AstroZeroBrokerDemo/1.0.0/catalog
请求示例
无
响应示例
{
"services": [
{
"allow_context_updates": false,
"bindable": false,
"bindings_retrievable": false,
"description": "",
"id": "$CP_DS__AstroZeroBrokerDemo_b",
"instances_retrievable": false,
"name": "$CP_DS__AstroZeroBrokerDemo_b",
"plan_updateable": false,
"plans": [
{
"bindable": false,
"description": "",
"free": true,
"id": "003M000000ppqFT7kFRQ",
"name": "CP_DS__AstroZeroBrokerDemo-0.0.9__svc",
"plan_updateable": false,
"schemas": {
"service_binding": null,
"service_instance": {
"create": {
"parameters": {
"properties": {
"client_id": {
"description": "客户端ID", // 创建时需要界面输入入参
"type": "string"
},
"client_secret": {
"description": "客户端密钥", // 创建时需要界面输入入参
"type": "password"
}
},
"required": [
"client_id",
"client_secret"
],
"type": "object"
}
}
}
}
}
]
}
]
}
配置图片
3)服务创建
URL
PUT /service/CP_DS__AstroZeroBrokerDemo/1.0.0/service_instances/{instance_id}
请求示例
{
"context": "string",
"maintenance_info": {},
"parameters": {
"client_id": "",
"client_secret": ""
},
"plan_id": "string",
"service_id": "string"
}
响应示例
{
"metadata": {
"display": [
{
"description": "",
"type": "string",
"value": ""
}
]
},
"parameters": {
"client_id": "string",
"client_secret": "string"
}
}
配置图片
4)服务实例信息
URL
GET /service/CP_DS__AstroZeroBrokerDemo/1.0.0/service_instances/{instance_id}
请求示例
{
"plan_id": "string",
"service_id": "string"
}
响应示例
{
"description": "",
"instance_usable": false,
"state": "",
"update_repeatable": false
}
5)服务实例信息最新操作
URL
GET /service/CP_DS__AstroZeroBrokerDemo/1.0.0/service_instances/{instance_id}/last_operation
请求示例
{
"plan_id": "string",
"service_id": "string",
"operation": "string"
}
响应示例
{
"description": "string",
"instance_usable": false,
"state": "string",
"update_repeatable": false
}