Tuesday, April 18, 2023

OCI API Gateway route to OCI function and test from Postman

Usecase: API Gateway to route to a function and then test it from POSTMAN.

Highlevel:

  1. Create a hello world java function in OCI.
  2. Create an API Gateway and route it to the function.
  3. Add policy to access to the compartment.
  4. 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:


Here, I have already created the function.


Step2: create an API gateway and route to function as deployment.

Follow my below blog: How to create API gateway and route.

Navigation >> Developer Services >> API Management >> Gateways


I have already created couple of API gatways already. We will use one gateway and add anothet route.

Choose compartment >> click on one gateway


Deployment >> demo-api >>edit



Add another route >> 
Add path: /hello-java, method: POST, Gateway type: Oracle function, 

Choose compartment >> function app name >> function  name >> save


Function route added >> copy the endpoint for testing.


Step3: add a policy to the compartment so that any user can access.

Navigation >> Identity & Security >> Policies >> Create policy.


Here, I have already added the 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.....'}



How to get the compartment id:
Navigation >> Identity & Security >> Compartments >> open your compartment and see the OCID >> just copy it and use it in the Policy.



We are ready now for testing:

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.


Raw >> test >> input:  Sanddy >> output : Hello, Sanddy !


Note: if we dont add the policy to the compartment where function resides, it will fail with 500 Internal server error.

Wednesday, April 12, 2023

OIC - Create an API Gateway to call Oracle Integration REST service

Usecase: we will create an API gateway in OCI console and call rest OIC service.

Highlevel steps:

  1. Create a rest OIC service which to be called from API gateway.
  2. Create a VCN(it will create two subnets : public and private)
  3. Create a security list(to get access) and add to the public subnet of the VCN
  4. Create an API Gateway
  5. Add deployment of the rest service to the gateway
  6. Take the API gatway deployem endpoint url and test in Postman

Detailed steps:

Login to OCI console >> networking >> Virtual Cloud Networks


Select compartment >> start VCN Wizard


Start VCN wizard


Provide VCN name and compartment.


Click create.


VCN created. Click View VCN.


2 subnets created >> private and public


Click Security Lists


Create Security List


Provide security list name, compartment >> add ingress rule


Source  CIDR : 0.0.0.0/0
Destination port range : 443


Security list created >> go to subnets


Open public subnet 


Add security list


Select the compartment >> add the security list.



Developer services >> API Management >> Gateways


Select compartment and create gateway.


Provide Gateway name, type, compartment >> provide VCN name, select public subnet.


Gateway created.


Deployments >> Create deployment


Provide api gatway details:

Name: demo-api
Path prefix : /demo-api/1.0
Compartment: dev



Selecting no authentication which is basic authentication.
Note: you can also go for single or multiple authentication options.


Provide route Service details:
Path: /testHello
Method: POST
Backend type: HTTP
URL


Provide different time out paramters >> click show route request policies


Add the Authorization : Basic base64 representation of username:passoword


Next


Create the deployment


Copy the endpoint of the deployment for testing.


Open in postman >> select basic authentication >> provide OCI user and password

Test url: OCI deploywent Endpoint/path of the URL added in the deployment.


Body >> raw >> json
Provide input data


Hurahha!!! It worked. We have received the response.

Friday, April 7, 2023

MS Excel - Add drop down list and add conditional coloring or formatting

Detailed Steps:

Select the cells of the field. Here, Status. >> click on data tab


Data validation


Validation criteria >> allow as List


Source: Provide the list values


See the list is ready.


Now we will add conditional coloring.
Select the cells >> conditional formatting 


Select New Rule


Select Format only cells that contain >> equal to >> specify one value . " Not started". >> Format.


Select a color.


Ok


See its ready for Not started. Similarly , we can add for other values and colors.




Featured Post

11g to 12c OSB projects migration points

1. Export 11g OSB code and import in 12c Jdeveloper. Steps to import OSB project in Jdeveloper:   File⇾Import⇾Service Bus Resources⇾ Se...