How to operate pivotal cloud foundry opsman though java RESTful

299 views Asked by At

I'm now using pivotol's cloud foundry and I'm thinking a java app to automatically check & upgrade products on pcf ops-manager. Right now I'm typing things like "$ uaac curl -k https://****.org/api/v0/diagnostic_report" on command line to manually operate it.

Since ops-manager is operated through RESTful api, I thought pivotal spring's REST template would be a good idea. (https://spring.io/guides/gs/consuming-rest). I am new to the whole RESTful idea, in my understanding, we just reach this endpoint and it returns or operates what we require in the api url. And through REST template tutorial, I successfully got the info back. But in my scenario, I need to pass the security requirement which is cloud foundry's uaa, User Account and Authentication Service.

My question is, how do I curl the api endpoint with the uaa(https://docs.cloudfoundry.org/api/uaa/). In another way, how do I do "$ uaac curl -k https://****.org/api/v0/diagnostic_report" in java? Coding example will be very helpful.

Thank you so much!!!

2

There are 2 answers

0
K.AJ On

I suggest you learn Concourse CI. Concourse CI is an open source tool where you can setup pipelines. It was developed in Pivotal and Pivotal uses it internally for lot of their products and platforms.

Here is a link to github project https://github.com/lsilvapvt/concourse-pipeline-samples. Go thru it and you will understand how you can use concourse to do backups and automated upgrades etc.

Also sign up on their slack channel - https://concourseci.slack.com/archives/general. It is a great resource.

0
Kumaresh Babu N S On

Pivotal Cloud Foundry provides REST API for accessing Ops Manager for various activities. You need to provide OAuth2 Token API for every API access.

Following URL would be helpful for your research.

http://docs.pivotal.io/pivotalcf/1-12/opsman-api