Oracle Storage Cloud Service: Creating Containers Using the REST API

Here an interactive script to create a storage container:
Download here

#!/bin/bash

## DESCRIPTION: Oracle Storage Cloud Service: Creating Containers Using the REST API
## DOCUMENTATION: http://www.oracle.com/webfolder/technetwork/tutorials/obe/cloud/objectstorage/creating_containers_REST_API/creating_containers_REST_API.html

## KNOWN ISSUES: Does not work with the following identity domains:
## - oucloudusa8

## AUTHOR: Sebastien Colas 


echo -n 'Your identity domain :'
read identity
echo -n 'Your username :'
read username
echo -n 'Your password :'
read password
echo -n 'Container name you want to create :'
read container

echo

curl -v -s -X GET -H "X-Storage-User: Storage-${identity}:${username}" -H "X-Storage-Pass: ${password}" https://${identity}.storage.oraclecloud.com/auth/v1.0 2> auth.txt

storage=`cat auth.txt | grep X-Storage-Url auth.txt | cut -f 3 -d ' ' | col -bp`
auth=`cat auth.txt | grep X-Auth-Token | cut -f 3 -d ' '`

echo "X-Storage-Url : ${storage}"
echo "X-Auth-Token : ${auth}"

curl -v -s -X PUT -H "X-Auth-Token: ${auth}" ${storage}/${container} 2> create.txt

ret=`cat create.txt | grep 'HTTP/1.1 201 Created'`

echo

if [ -n "$ret" ]
then 
  echo "Container ${container} successfully created"
  echo "Cloud Storage Container: Storage-${identity}/${container}"
else
  echo "an error occured please see the log files"
fi