Forum Stats

  • 3,783,611 Users
  • 2,254,809 Discussions
  • 7,880,485 Comments

Discussions

Using curl to pull back instance and orchestration states

Dabbsy
Dabbsy Member Posts: 6
edited Dec 15, 2017 1:40AM in Java Cloud Service

I’m running some curl from a shell script to get the state of an instance and also an orchestration.

In the below, I’ve replaced my actual tenant and info with the oracle sample code and I’ve previously generated a cookie and passed this into the $COMPUTE_COOKIE parameter.

This cookie works fine.

When I try and run curl against the instance it returns all the information I want – but how can I just pull back the state? 

curl -X GET \

  -H "Cookie: $COMPUTE_COOKIE"   \

  -H "Accept: application/oracle-compute-v3+json" \

https://api-z999.compute.us0.oraclecloud.com/instance/Compute-acme/[email protected]/dev1/f653a677-b566-4f92-8e93-71d47b364119z999.compute.us0.oraclecloud.com/instance/Compute-acme/[email protected]/dev1/f653a677-b566-4f92-8e93-71d47b364119

The curl command pulls back dozens of fields including "state": "running" (which is the only piece of information I need) – but there’s that much date in there in one long string, so it’s difficult to easily pull out the state only – can I just ask for the state to be returned?  or how can I easily extract the state only.

when I run a similar command to the get the state of the orchestration:-

curl -X GET \

  -H "Cookie: $COMPUTE_COOKIE"   \

  -H "Accept: application/oracle-compute-v3+json" \

https://api-z999.compute.us0.oraclecloud.com/orchestrations/Compute-acme/[email protected]/dev1/

this returns

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">

<html><head>

<title>403 Forbidden</title>

</head><body>

<h1>Forbidden</h1>

<p>You don't have permission to access /orchestrations/Compute-acme/[email protected]/dev1/ on this server.</p>

</body></html>

If I’ve created the orchestration and the instance myself (and I can access the instance - first command in the post) how can I not have the permissions to see the orchestration?  Is there a way of checking these permissions at the instance and the orchestration level or is there something else going on that might be stopping me?

Any assistance appreciated - this is my first venture with cloud, curl and the REST APIs.

thanks a lot

Jonathan

Answers

This discussion has been closed.