简体   繁体   English

带有Service Fabric的Azure API管理

[英]Azure API Management with Service Fabric

Problem: 问题:

I want to setup a CI/CD where whenever I publish changes to my SF API, it automatically updates the endpoints of the API in the Azure API Management instance. 我想设置一个CI / CD,在每当我发布对SF API的更改时,它都会自动更新Azure API Management实例中API的终结点。

How do I plan on doing that? 我打算如何做?

I push changes to my GitHub repo, it is built, and it gets deployed. 我将更改推送到我的GitHub存储库中,它已构建并已部署。 Second step in the release is a PowerShell script which updates an existing Azure APIM API with the Swagger doc of the newly deployed SF API. 该版本的第二步是PowerShell脚本,该脚本使用新部署的SF API的Swagger文档更新现有的Azure APIM API。

Whats the problem? 有什么问题?

Well, you can't pass through the gateway unless you have an endpoint defined in the Azure APIM API. 好吧,除非您在Azure APIM API中定义了终结点,否则您将无法通过网关。 I can define a Swagger endpoint there by default, but whenever the PowerShell update is run, it'll remove that endpoint because the Swagger generated does not have itself in it, which is totally logical. 我可以在默认情况下在其中定义Swagger端点,但是每当运行PowerShell更新时,它将删除该端点,因为生成的Swagger中没有它自己,这是完全合乎逻辑的。

If I expose the Swagger endpoint without the gateway somehow, that posses a security threat, and kind of kills the purpose of Azure APIM gateway. 如果我以某种方式公开了不带网关的Swagger终结点,则会构成安全威胁,并且会破坏Azure APIM网关的用途。

My Setup? 我的设定?

Incoming Request -> Azure APIM -> Service Fabric App (Public/Internal) 传入请求-> Azure APIM-> Service Fabric应用(公共/内部)

  • Internal SF Apps will ideally not be exposed through the gateway and are only used for inter app communication. 理想情况下,内部SF Apps将不会通过网关公开,而仅用于应用程序间的通信。

Any help in this regard is highly appreciated since I am kind of blocked on this :-) 在这方面的任何帮助都将受到高度赞赏,因为我对此有所限制:-)

You could create a separate API in APIM just to access swagger AT SF side and don't update this API as a part of CI/CD. 您可以在APIM中创建一个单独的API,仅用于访问广大的AT SF端,而不必将此API作为CI / CD的一部分进行更新。 If may even be made to look from outside as a part of said API. 作为该API的一部分,甚至可以从外部查看。 For example if your main API has suffix of "/myApi", then you swagger API suffix may be defined as "/myApi/swagger.json" (operation inside it may have empty URL template). 例如,如果您的主API的后缀为“ / myApi”,那么您可能将挥舞的API后缀定义为“ /myApi/swagger.json”(其中的操作可能具有空的URL模板)。

Or you could as a part of you CI/CD recreate swagger access operation inside newly imported API. 或者,您也可以作为CI / CD的一部分,在新导入的API中重新创建摇摇欲坠的访问操作。 This endpoint will be used later to fetch swagger for next import. 稍后将使用此端点来获取大笔画幅以进行下一次导入。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM