热点新闻
apollo api调用初始化配置
2023-07-05 01:59  浏览:3548  搜索引擎搜索“手机低淘网”
温馨提示:信息一旦丢失不一定找得到,请务必收藏信息以备急用!本站所有信息均是注册会员发布如遇到侵权请联系文章中的联系方式或客服删除!
联系我时,请说明是在手机低淘网看到的信息,谢谢。
展会发布 展会网站大全 报名观展合作 软文发布

1、登录(apollo/admin 超管) 获取登录的cookies,手动存起来

curl -u apollo:admin --X POST 'http://$apollo-portal:8070'

2、创建项目(目的: 生成默认的application和用户的App)

curl --location --request POST --X POST 'http://$apollo-portal:8070/apps' \ --header 'User-Agent: Apipost client Runtime/+https://www.apipost.cn/' \ --header 'cookie: NG_TRANSLATE_LANG_KEY=zh-CN; JSESSIonID=BD705E7B2B7C61BF5277E6857421E5DE' \ --header 'Content-Type: application/json' \ --data '{ "appId": "tianzehao123", "name": "tianzehao123", "orgId": "TZH", "orgName": "大数据与区块链研发中心", "ownerName": "apollo", "admins": [] }'

3、创建第三方应用(目的: 注册Apollo的开放平台,获得token)

curl --location --request POST --X POST 'http://$apollo-portal:8070/consumers' \ --header 'User-Agent: Apipost client Runtime/+https://www.apipost.cn/' \ --header 'cookie: NG_TRANSLATE_LANG_KEY=zh-CN; JSESSIonID=B75B99ECEEFCBFF64D07FC6625295D59' \ --header 'Content-Type: application/json' \ --data '{ "appId": "tainzehao123", "name": "tainzehao123", "orgId": "TZH", "orgName": "大数据与区块链研发中心", "ownerName": "apollo" }'

4、赋权 【Namespace级别权限包括: 修改、发布Namespace。应用级别权限包括: 创建Namespace、修改或发布应用下任何Namespace】(这里我们采用应用级别权限)Namespace级别权限:

curl --location --request POST --X POST 'http://$apollo-portal:8070/consumers/df7c0b67fb0ac60326080d97937c881a039560cc/assign-role?type=NamespaceRole' \ --header 'User-Agent: Apipost client Runtime/+https://www.apipost.cn/' \ --header 'cookie: NG_TRANSLATE_LANG_KEY=zh-CN; JSESSIonID=B75B99ECEEFCBFF64D07FC6625295D59' \ --header 'Content-Type: application/json' \ --data '{ "appId": "tainzehao123", "namespaceName": "application" }'

5、项目配置

5.1、创建NameSpace

curl --location --request POST --X POST 'http://$apollo-portal:8070/openapi/v1/apps/tainzehao123/appnamespaces' \ --header 'User-Agent: Apipost client Runtime/+https://www.apipost.cn/' \ --header 'Authorization: df7c0b67fb0ac60326080d97937c881a039560cc' \ --header 'Content-Type: application/json' \ --data '{ "appId": "tainzehao123", "name": "TZH.fc.sssoo", "comment": "吞吞吐吐", "isPublic": false, "format": "properties", "dataChangeCreatedBy":"apollo" }'

5.2、关联namespace(目的: 使用公共配置) 使用cookie

curl --location --request POST --X POST 'http://$apollo-portal:8070/apps/tianzehao123/namespaces' \ --header 'User-Agent: Apipost client Runtime/+https://www.apipost.cn/' \ --header 'cookie: NG_TRANSLATE_LANG_KEY=zh-CN; JSESSIonID=BD705E7B2B7C61BF5277E6857421E5DE' \ --header 'Content-Type: application/json' \ --data '[ { "env": "PRO", "namespace": { "appId": "tianzehao123", "clusterName": "default", "namespaceName": "TZH.TZH.fc.sssoo" } } ]'

5.3、新增配置接口

curl --location --request POST --X POST 'http://$apollo-portal:8070/openapi/v1/envs/PRO/apps/tainzehao123/clusters/default/namespaces/TZH.fc.sssoo/items' \ --header 'User-Agent: Apipost client Runtime/+https://www.apipost.cn/' \ --header 'Authorization: 7c3a748be5087b86795ecbe92f914bd3a2567683' \ --header 'Content-Type: application/json' \ --data '{ "key": "env11", "value": "sit11", "comment": "huanjing", "dataChangeCreatedBy": "apollo" }'

5.4、修改配置

curl --location --request PUT --X PUT 'http://$apollo-portal:8070/openapi/v1/envs/PRO/apps/inc-bst-sdp-exet-external/clusters/default/namespaces/TZH.TZH.fc.sssoo/items/asd' \ --header 'User-Agent: Apipost client Runtime/+https://www.apipost.cn/' \ --header 'Authorization: df7c0b67fb0ac60326080d97937c881a039560cc' \ --header 'Content-Type: application/json' \ --data '{ "key": "asd", "value": "sit12", "comment": "huanjing", "dataChangeLastModifiedBy": "apollo", "dataChangeCreatedBy": "apollo" }'

5.4、发布配置接口

curl --location --request POST --X POST 'http://$apollo-portal:8070/openapi/v1/envs/PRO/apps/tainzehao123/clusters/default/namespaces/TZH.fc.sssoo/releases' \ --header 'User-Agent: Apipost client Runtime/+https://www.apipost.cn/' \ --header 'Authorization: df7c0b67fb0ac60326080d97937c881a039560cc' \ --header 'Content-Type: application/json' \ --data '{ "releaseTitle": "20220518174157-release", "releaseComment": "发布", "releasedBy": "apollo" }'

6、sql删除project

delete from ApolloConfigDB.App where AppId="asd-ctrl" or AppId="asd-authcenter" or AppId="asd-center"; delete from ApolloConfigDB.AppNamespace where AppId="asd-ctrl" or AppId="asd-authcenter" or AppId="asd-center"; delete from ApolloConfigDB.Namespace where AppId="asd-ctrl" or AppId="asd-authcenter" or AppId="asd-center"; delete from ApolloConfigDB.Cluster where AppId="asd-ctrl" or AppId="asd-authcenter" or AppId="asd-center"; delete from ApolloPortalDB.App where AppId="asd-ctrl" or AppId="asd-authcenter" or AppId="asd-center"; delete from ApolloPortalDB.AppNamespace where AppId="asd-ctrl" or AppId="asd-authcenter" or AppId="asd-center";

发布人:d475****    IP:117.173.23.***     举报/删稿
展会推荐
让朕来说2句
评论
收藏
点赞
转发