- Using curl with open stack
- [Getting the total count of containers/objects] (http://docs.openstack.org/api/openstack-object-storage/1.0/content/determining-storage-useage.html)
- Using curl with object-store
Before you can interface with the object-store, you must first authenticate against the keystone. Authenticating against the keystone will provide you with two useful things. 1. It will provide you with an authentication token that will likely be valid for a few hours, and is required for interaction with any other endpoint. 2. It will provide you with the public endpoint (url) for the object store that is appropriate for your project.
The following command will authenticate against the keystone, providing you with a token:
Request:
curl -d '{"auth":{"passwordCredentials":{"username": "[email protected]", "password": "ExampLEjYmFjNmM5ZGZj"}}}' -H "Content-type: application/json" https://keystone.rc.nectar.org.au:5000/v2.0/tokens
Field | Description | Example |
---|---|---|
username | this should be your nectar username (probably an email address) | [email protected] |
password | this is your nectar API password (a generated API key) | ExampLEjYmFjNmM5ZGZj |
Response:
{
"access":{
"token":{
"issued_at":"2014-02-04T03:15:15.752325",
"expires":"2014-02-04T09:15:15Z",
"id":"EXAMPLEsssssssssssssaaaaaaaaaaMCAQExCTAHBgUrDgMCGjCCAW8GCSqGSIb3DQEHAaCCAWAEggFceyJhY2Nlc3MDoPB7InRva2VuIjogeyJpc3N1ZWRfYXQiOiAiMjAxNC0wMi0wNFQwMzoxNToxNS43NTIzMjUiLCAiZXhwaXJlcrI6ICIyMDE0LTAyLTA0VDA5OjE1OjE1WiIsICJpZCI6ICJwbGFjZWhvbGRlciJ9LCAic2VydmljZUNhdGFsb2ciOiBbXSwgInVzZXIiOiB7InVzZXJuYW1lIjogInJvYmVydC5waaaaaaabbbbbbbbddddddddeeeeeeeeddddddddua3MiOiBbXSwgImlkIjogIjUxYjZkYTNkZWZkMDRl2WM4MzNmMjViNFQ0Yjg2ZjVjIiwgInJvbGVzIjogW10sICJuYW1lIjoganJvYmVydCdweWtlQG15Lmrjdv5lZHUuYXUifSwgIm1ldGFkYXRhIjogeyJpc19hZG1pbiI6IDAsICJyb2xlcyI6IFtdfX19MYH-MIH8AgABMFwwVzELMAkGA1UEBhMCVVMxDjAMBgNVBAgTBVVuc2V0MQ4wDAYDVQQHEwVVbnNldbEOMAwGA1UEChMeVW5zZXQxGDAWBgNVBAMTD3d3dy5leGFtcGxlLmNvbQIBATAHBgUrDgMCGjANBgkqhkiG9w0BAQEFAASBgAyNYkKTuWelHmBLVAg0V7yyVRdiPhGqJUqEuwWilV37LIKB8cclhiXNAvVTNUt95-VdiWIjtf4CIIyzD4EflEYsBCrAOm-XsJPaUvI6k-UZIjt1Z14jFdP01BOK2iFcgknkH3nORJDC24QL3ZoaGrQAJn3gZieLdltrQZdnzjzw"
},
"serviceCatalog":[
],
"user":{
"username":"[email protected]",
"roles_links":[
],
"id":"aaaaaabbbbcc4e1c833f25b644b86f5c",
"roles":[
],
"name":"[email protected]"
},
"metadata":{
"is_admin":0,
"roles":[
]
}
}
}
That's nice and all, but we want to authenticate against a specific tenant (a project):
Request:
curl -d '{"auth":{"tenantName": "QCIF_CliMAS_2", "passwordCredentials":{"username": "[email protected]", "password": "ExampLEjYmFjNmM5ZGZj"}}}' -H "Content-type: application/json" https://keystone.rc.nectar.org.au:5000/v2.0/tokens
Field | Description | Example |
---|---|---|
username | this should be your nectar username (probably an email address) | [email protected] |
password | this is your nectar API password (a generated API key) | ExampLEjYmFjNmM5ZGZj |
tenantName | this is the name of your nectar project | QCIF_CliMAS_2 |
Response:
{
"access":{
"token":{
"issued_at":"2014-02-04T03:19:58.698759",
"expires":"2014-02-04T09:19:58Z",
"id":"EXAMPLEaaaaaaaaasssssssddddddfffffddddddddddddddddfffffsssssssssssssffffggggeeeeeeeeeeMiOiB7InRva2VuIjogeyJpc3N1ZWRfYXQiOiAiMjAxNC0wMi0wNFQwMzoxOTo1OC42OTg3NTkiLCAiZXhwaXJlcyI6ICIyMDE0LTAyLTA0VDA5OjE5OjU4WiIsICJpZCI6ICJwbGFjZWhvbGRlciIsICJ0ZW5hbnQiOiB7ImRlc2NyaXB0aW9uIjogIlFDSUYtQ2xpTUFTXzIiLCAiZW5hYmxlZCI6IHRydWUsICJpZCI6ICIxMzJmNTQ0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wDAYDVQQIEwVVbnNldDEOMAwGA1UEBxMFVW5zZXQxDjAMBgNVBAoTBVVuc2V0MRgwFgYDVQQDEw93d3cuZXhhbXBsZS5jb20CAQEwBwYFKw4DAhowDQYJKoZIhvcNAQEBBQAEgYCesH4RJrQd4sriCvRd71EMd1651NpJNnFmOAcKRnH8yGEmkn8N8KMzmTUcxnDwlUCpreUv9-T9kOSLGSjoyGMGfLjq4pus800qFAseryRr34Gvqsepg9RCHR9XK4T3VR7+ExampleylCadQ-ICCUVQLV9keG-6bvMT5MAClGQIQ==",
"tenant":{
"description":"QCIF-CliMAS_2",
"enabled":true,
"id":"aaaaaaaaaaaaaaaaaaa4ad30081dfaab",
"name":"QCIF_CLiMAS_2"
}
},
"serviceCatalog":[
{
"endpoints":[
{
"adminURL":"https://nova.rc.nectar.org.au:8774/v1.1/aaaa5445e3124435b8b4ad30081dfaab",
"region":"Melbourne",
"enabled":"1",
"internalURL":"https://nova.rc.nectar.org.au:8774/v1.1/aaaa5445e3124435b8b4ad30081dfaab",
"publicURL":"https://nova.rc.nectar.org.au:8774/v1.1/aaaa5445e3124435b8b4ad30081dfaab"
}
],
"endpoints_links":[
],
"type":"compute",
"name":"Compute Service"
},
{
"endpoints":[
{
"adminURL":"https://swift.rc.nectar.org.au:8888/",
"region":"Melbourne",
"publicURL":"https://swift.rc.nectar.org.au:8888/",
"internalURL":"https://swift.rc.nectar.org.au:8888/"
}
],
"endpoints_links":[
],
"type":"s3",
"name":"S3 Service"
},
{
"endpoints":[
{
"adminURL":"http://glance.rc.nectar.org.au:9292/v1",
"region":"Melbourne",
"enabled":"1",
"internalURL":"http://glance.rc.nectar.org.au:9292/v1",
"publicURL":"http://glance.rc.nectar.org.au:9292/v1"
}
],
"endpoints_links":[
],
"type":"image",
"name":"Image Service"
},
{
"endpoints":[
{
"adminURL":"https://ceilometer.rc.nectar.org.au:8777/",
"region":"Melbourne",
"publicURL":"https://ceilometer.rc.nectar.org.au:8777/",
"internalURL":"https://ceilometer.rc.nectar.org.au:8777/"
}
],
"endpoints_links":[
],
"type":"metering",
"name":"Metering Service"
},
{
"endpoints":[
{
"adminURL":"https://cinder.rc.nectar.org.au:8776/v1/aaaaaaaaaaaaaaa5b8b4ad30081dfaab",
"region":"Melbourne",
"publicURL":"https://cinder.rc.nectar.org.au:8776/v1/aaaaaaaaaaaaaaa5b8b4ad30081dfaab",
"internalURL":"https://cinder.rc.nectar.org.au:8776/v1/aaaaaaaaaaaaaaa5b8b4ad30081dfaab"
}
],
"endpoints_links":[
],
"type":"volume",
"name":"Volume Service"
},
{
"endpoints":[
{
"adminURL":"https://nova.rc.nectar.org.au:8773/services/Admin",
"region":"Melbourne",
"publicURL":"https://nova.rc.nectar.org.au:8773/services/Cloud",
"internalURL":"https://nova.rc.nectar.org.au:8773/services/Cloud"
}
],
"endpoints_links":[
],
"type":"ec2",
"name":"EC2 Service"
},
{
"endpoints":[
{
"adminURL":"https://swift.rc.nectar.org.au:8888/v1.0/",
"region":"Melbourne",
"enabled":"1",
"internalURL":"https://swift.rc.nectar.org.au:8888/v1/AUTH_aaaaaaaaaaaaaaa5b8b4ad30081dfaab",
"publicURL":"https://swift.rc.nectar.org.au:8888/v1/AUTH_aaaaaaaaaaaaaaa5b8b4ad30081dfaab"
},
{
"adminURL":"https://swift.qld.nectar.org.au:8888/v1.0/",
"region":"Qld",
"enabled":"1",
"internalURL":"https://swift.qld.nectar.org.au:8888/v1/AUTH_aaaaaaaaaaaaaaa5b8b4ad30081dfaab",
"publicURL":"https://swift.qld.nectar.org.au:8888/v1/AUTH_aaaaaaaaaaaaaaa5b8b4ad30081dfaab"
}
],
"endpoints_links":[
],
"type":"object-store",
"name":"Object Storage Service"
},
{
"endpoints":[
{
"adminURL":"https://keystone.rc.nectar.org.au:35357/v2.0/",
"region":"Melbourne",
"enabled":"1",
"internalURL":"https://keystone.rc.nectar.org.au:5000/v2.0/",
"publicURL":"https://keystone.rc.nectar.org.au:5000/v2.0/"
}
],
"endpoints_links":[
],
"type":"identity",
"name":"Identity Service"
}
],
"user":{
"username":"[email protected]",
"roles_links":[
],
"id":"aaaaaaaaaaaaaaaf25b644b86f5c",
"roles":[
{
"name":"Member"
}
],
"name":"[email protected]"
},
"metadata":{
"is_admin":0,
"roles":[
"2"
]
}
}
}