With the Oracle API Gateway, we have the tools to manage the lifecycle of APIs through Oracle Cloud Infrastructure (OCI). OCI provides the interfaces to make it easy for developers to prototype, test, and validate APIs. However, this is a manual process on the console. With FlexDeploy’s Oracle API Gateway Plugin we can automate the process of creating API resources, validating APIs, creating API deployments, and more. In this blog, we will explore the automation capabilities that FlexDeploy provides with respect to API specifications.
The API Gateway Plugin
With FlexDeploy’s Oracle API Gateway Plugin we have 2 operations — one for the build process and another for the deploy process. Let’s assume for this blog that we have a tenancy, compartment, and gateway ready to deploy our APIs to. In addition, we will be storing our APIs as API specification files in a Git source control repository. This is good practice to maintain version history and provide a single source of truth for your API deployments. The goal here is build our APIs once from source control and deploy to many environments.
See the API Gateway plugin guide for more details.
API Build Process
The following logic is all encapsulated in one build operation. See the documentation page for more information on the apiBuild operation.
- Retrieve the API(s) from source control.
- For each API:
- If the API is in Open API format, upload the API to OCI with defined tags. Tags allow us to find that API by any of the tag values. Also it links the API resource to a build event in FlexDeploy and source control commit for auditing purposes. Here is an example of the API resource after a build executes in FlexDeploy.
- Validate the API. The build execution in FlexDeploy will fail if validation fails.
- Create an artifact containing all the API specification file(s).
API Deploy Process
The following logic is all encapsulated in one deploy operation. See the documentation page for more information on the apiDeploy operation.
- Retrieve the artifact from a build.
- For each API in the artifact:
- Perform property replacement on any keyword defined by you in the API specification. This is useful if you need to change some value in the API that depends on the environment to which you’re deploying, e.g. a service URL or an authentication token.
- If the API is in Open API format, create an API deployment from the API resource. FlexDeploy will make sure the API resource matches the content from the artifact by creating / overwriting it at run time.
- Otherwise, create an API deployment from the artifact file content.
- In both case (point 2 or point 3), defined tags are added in the same way they were in the build process. Tags allow us to find that API deployment by any of the tag values. Also it links the API deployment to a deploy event in FlexDeploy and source control commit for auditing purposes.
Cloud Accounts
For FlexDeploy to make the connection to OCI, you will need to make an account storing the tenancy id, OCI region, and credentials. You make one of these for every OCI region – tenancy combination for your use case.
Conclusion
It is important to have visibility into the changes that were made, and tags make that easy. Tagging allows FlexDeploy users to link an API resource and/or API deployment to a source control revision. This automation can be extended even further to deploy API changes to multiple environments via a release and pipeline. The release and pipeline allows you to group multiple packages together from different projects and deploy them together.
This has been a quick look at the immediate value FlexDeploy’s API Gateway Plugin can provide to API developers. Making many changes quickly and deploying one or many APIs with a click of a button is possible with FlexDeploy!