Usecase: API Gateway to route to a function and then test it from POSTMAN.
Highlevel:
- Create a hello world java function in OCI.
- Create an API Gateway and route it to the function.
- Add policy to access to the compartment.
- Test the API gateway rest service from postman.
Detailed steps:
Step1: Create a java hello-world function
Navigation >> developer services >> Fuctions >> Applications
Follow my below blog : how to create a function:
Follow my below blog: How to create API gateway and route.
Navigation >> Developer Services >> API Management >> Gateways
Choose compartment >> click on one gateway
Add path: /hello-java, method: POST, Gateway type: Oracle function,
Choose compartment >> function app name >> function name >> save
Navigation >> Identity & Security >> Policies >> Create policy.
Policy details:
Allow any-user to use functions-family in compartment dev where ALL { request.principal.type='ApiGateway',request.resource.compartment.id='ocid1.compartment.oc1..aaaaaa.....'}
Navigation >> Identity & Security >> Compartments >> open your compartment and see the OCID >> just copy it and use it in the Policy.
Step4: Test Api gateway from postman
Postman >>
Method: post
Test URL : <endpoint of the deployement>/<route path>
Authorization >> basic >> add user and password for OCI console.
No comments:
Post a Comment