• Home
  • Archive
  • Tools
  • Contact Us

The Customize Windows

Technology Journal

  • Cloud Computing
  • Computer
  • Digital Photography
  • Windows 7
  • Archive
  • Cloud Computing
  • Virtualization
  • Computer and Internet
  • Digital Photography
  • Android
  • Sysadmin
  • Electronics
  • Big Data
  • Virtualization
  • Downloads
  • Web Development
  • Apple
  • Android
Advertisement
You are here:Home » Changing Data With cURL for OpenStack Swift (HP Cloud CDN)

By Abhishek Ghosh February 16, 2015 6:33 pm Updated on February 19, 2015

Changing Data With cURL for OpenStack Swift (HP Cloud CDN)

Advertisement

Changing Data With cURL For Object is Quite Easy in OpenStack Swift. Here Are Examples With HP Cloud CDN To Make it Clear. Official Examples Are Bad, They Are Written By Rackspace’s Employees. Rackspace uses API Key based access while normally we use Key Stone based Access – HP Cloud uses Key Stone based access too. That is why Racksace’s stuffs will not work with HP Cloud Products including HP Cloud CDN. Skip the first sub header in this article, if you do not want to read criticism and other things. Rackspace Cloud is an OpenStack deployment that uses a custom authentication back end not the Native OpenStack installation. Otherwise, people would port them easily.

 

Changing Data With cURL for OpenStack Swift (HP Cloud CDN) : Why It Feels Hell Like Tough?

 

Releasing Softwares with non cross-vendor usability renders it vendor locked. That is Richard M. Stallman said “Cloud Computing is a Hype.” Basically, his contribution is huge only in Linux! He will know what a Software has inside it. You are reading this article means, you are either advanced user or going to be advanced user. You have understood the fact – HP Cloud’s whole team can not easily make their services very user friendly to a new, novice computer user. We described how to upload the static contents from WordPress to OpenStack Swift (HP Cloud CDN) for the first time on this Planet. We have not discovered anything new. They were written but not in usable form to a new user. Python Swift Client is the best development for OpenStack Swift. Code contribution for OpenStack is highest by HP. HP is hardware company. Their Software License is like Free Software. That is why you’ll see that, HP sponsors Free Software Foundation. Articles like this are useless :

Advertisement

---

Vim
1
http://arstechnica.com/information–technology/2008/09/why–stallman–is–wrong–when–he–calls–cloud–computing–stupid/

The person wrote has not much contribution to Free Software :

Vim
1
https://github.com/segphault?tab=repositories

Now you know very well about PRISM, NSA Spyware activities etc. There is another Ryan Paul, who has no beard – it is a US Political Person. But this Ryan Paul’s Google Plus account is verified :

Vim
1
https://plus.google.com/+RyanPaul/about

All are arranged. Back to the topic – we will demonstrate you using cURL for OpenStack Swift which you can test with HP Cloud CDN. The examples are badly written, one reason is written above and another reason is that – they are employees, not Bloggers or Technical Blog Writers. If Darren Rowse wrote it, he would write more readable way.

Why I do not write Health Blogs? Because I know; I can not make easy to understand. Our brain processes stuffs of different domains in different ways. If you pay me $8000 per month and force to write “How to replace elbow joint”, it will be quite unreadable. Technically sound but practically useless. Also, cURL is not installed on MS Windows – you can install cURL on Windows by reading this guide.

 

Changing Data With cURL for OpenStack Swift (HP Cloud CDN)

 

Take native OpenStack Swift installation and HP Cloud CDN as Equivalent. We do not need to create a container, publish it as CDN etc, via CLI, we have the features on Graphical User Interface. We need to change the Metadata like things – like Expires Header of some objects.

We have four secrets :

  1. All data in the OpenStack RC file (written in Python Swift Client tuts)
  2. Account username and password
  3. The API URLs from where you downloaded the OpenStack RC file
  4. URL of the Container or Object

 

Run this command after modification :

 

Vim
1
curl –v –X GET –H “X-Auth-User: username” –H “X-Auth-Key: password” “https://region-b.geo-1.identity.hpcloudsvc.com:35357/v2.0/”

 

The username and password both are in that OpenStack RC file and is the thing which you use to login to HP Cloud except – the username is in LOWER CASE. This command will definitely work and you’ll get this response :

Vim
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
âžœ  ~  curl –v –X GET –H “X-Auth-User: myusername” –H “X-Auth-Key: myPasSword” “https://region-b.geo-1.identity.hpcloudsvc.com:35357/v2.0/”
* Hostname was NOT found in DNS cache
*   Trying 206.164.176.15…
* Connected to region–b.geo–1.identity.hpcloudsvc.com (206.164.176.15) port 35357 (#0)
* TLS 1.2 connection using TLS_RSA_WITH_RC4_128_MD5
* Server certificate: region–b.geo–1.identity.hpcloudsvc.com
* Server certificate: VeriSign Class 3 Secure Server CA – G3
* Server certificate: VeriSign Class 3 Public Primary Certification Authority – G5
> GET /v2.0/ HTTP/1.1
> User–Agent: curl/7.37.1
> Host: region–b.geo–1.identity.hpcloudsvc.com:35357
> Accept: */*
> X–Auth–User: myusername
> X–Auth–Key: myPasSword
>
< HTTP/1.1 200 OK
< Date: Sun, 08 Feb 2015 11:06:51 GMT
* Server Apache is not blacklisted
< Server: Apache
< Vary: X–Auth–Token
< Content–Length: 277
< Content–Type: application/json
< Connection: keep–alive
<
* Connection #0 to host region–b.geo–1.identity.hpcloudsvc.com left intact
{“version”: {“status”: “stable”, “updated”: “2012-06-20T16:55:53.340Z”, “id”: “v2.0”, “links”: [{“href”: “https://docs.hpcloud.com/api/identity”, “type”: “text/html”, “rel”: “describedby”}, {...}

Have you received the X-Auth-Key? See the output above ! The official guides are described in this way :

Vim
1
2
3
4
curl –i –X POST –H “Origin: example.com” –H “X-Auth-Token:
48e17715dfce47bb90dc2a336f63493a“
https://storage.example.com/v1/MossoCloudFS_c31366f1–9f1c–40dc–a
b92–6b3f0b5a8c45/ephotos

Rackspace wrote the guides – MossoCloud is Rackspace Cloud Sites. Now, you have a CDN API URL which looks like this :

Vim
1
https://region–a.geo–1.objects.hpcloudsvc.com/v1/1234567890123

If your container’s name is tcw-all-january and inside its root, there is a file named apple-touch-icon-144x144-precomposed.png, then the relative URI becomes :

Vim
1
./tcw–all–january/apple–touch–icon–144×144–precomposed.png

That dot is what we said above :

Vim
1
https://region–a.geo–1.objects.hpcloudsvc.com/v1/1234567890123

Join these two :

Vim
1
https://region–a.geo–1.objects.hpcloudsvc.com/v1/1234567890123/tcw–all–january/apple–touch–icon–144×144–precomposed.png

We normally use the CDN URLs which has read only function. First test that URI return header which has read and write permission for you :

Vim
1
curl –i https://region–a.geo–1.objects.hpcloudsvc.com/v1/1234567890123/tcw–all–january/apple–touch–icon–144×144–precomposed.png

You’ll get :

Vim
1
2
3
4
5
6
7
8
9
10
HTTP/1.1 200 OK
Content–Length: 19752
Content–Type: image/png
Accept–Ranges: bytes
Last–Modified: Fri, 23 Jan 2015 18:44:58 GMT
Etag: 003372f86df8eb31286cdb7036635139
X–Timestamp: 1422038698.69038
X–Object–Meta–Mtime: 1371802422.000000
X–Trans–Id: txcbfafd0a53604a8aa8f57–0054d74b70
Date: Sun, 08 Feb 2015 11:41:36 GMT
Changing Data With cURL for OpenStack Swift (HP Cloud CDN)

Morons write the documentations in this way :

Vim
1
2
3
4
5
6
7
8
9
10
11
curl –i https://region–a.geo–1.objects.hpcloudsvc.com/v1/1234567890123/tcw–all–january/apple–touch–icon–144×144–precomposed.png
HTTP/1.1 200 OK
Content–Length: 19752
Content–Type: image/png
Accept–Ranges: bytes
Last–Modified: Fri, 23 Jan 2015 18:44:58 GMT
Etag: 003372f86df8eb31286cdb7036635139
X–Timestamp: 1422038698.69038
X–Object–Meta–Mtime: 1371802422.000000
X–Trans–Id: txcbfafd0a53604a8aa8f57–0054d74b70
Date: Sun, 08 Feb 2015 11:41:36 GMT

It is really difficult to understand. Sajal Kayan also suffered, he is quite known person; he initially could not change the meta data (expire headers). Time to time, with complex commands; which is command and which is response becomes difficult to understand.

Text Books has not written to write in that way. It is like, some doctors do not talk properly with the patients! That is a wrong in accordance to the Text books. Patient Should be Explained and Counseled. In the same way, in the Engineering Text books (related to these topics) exactly the same is written – User Might Be Explained.

Human frankly does not talk properly after taking money when a human is dying, how you can expect that his brother will explain which is command and which is output or why -k flag is used? That is why software engineers, doctors all faces a bit “control” by the owner groups. Otherwise, both will not work properly. Basic thing is that, they assume, degree or traditional education will do the things. Owners usually do not have MBA but has better engine to control the MBA. Practical thing.

If you run this for HP Cloud :

Vim
1
curl –X –i –k https://region–a.geo–1.objects.hpcloudsvc.com/v1/1234567890123/tcw–all–january/apple–touch–icon–144×144–precomposed.png

You will get a response :

Vim
1
This method may not be used.%

This means – everything is right, you need to put that Authentication stuff. Firewall is blocking. For a given provider, HP Cloud, if you run :

Vim
1
curl –k https://region–b.geo–1.identity.hpcloudsvc.com:35357

You’ll Get :

Vim
1
“versions”: {“values”: [{“status”: “stable”, “updated”: “2012-06-20T16:55:53.340Z”, “id”: “v1.0”}, {“status”: “stable”, “updated”: “2012-06-20T16:55:53.340Z”, “id”: “v1.1”, “links”: [{“href”: “https://docs.hpcloud.com/api/identity”, “type”: “text/html”, “rel”: “described by”}]}, {“status”: “stable”, “updated”: “2012-06-20T16:55:53.340Z”, “id”: “v2.0”, “links”: [{“href”: “https://docs.hpcloud.com/api/identity”, “type”: “text/html”, “rel”: “described by”}, {“href”: “https://region-b.geo-1.identity.hpcloudsvc.com:35357/v2.0”, “rel”: “self”}]}, {“status”: “stable”, “updated”: “2013-04-25T16:55:53.340Z”, “id”: “v3.0”, “links”: [{“href”: “https://docs.hpcloud.com/api/v13/identity”, “type”: “text/html”, “rel”: “describedby”}, {“href”: “https://region-b.geo-1.identity.hpcloudsvc.com:35357/v3”, “rel”: “self”}]}]}}%

Collapsed JSON response. Officially, according to HP Cloud CDN docs, you should use this format to update the metadata TTL :

Vim
1
curl –i –k –X POST “X-Auth-Token: PassWord” https://region–a.geo–1.objects.hpcloudsvc.com/v1/1234567890123/tcw–all–january/apple–touch–icon–144×144–precomposed.png “x_ttl: 1024”

You can use :

"X-Auth-User: username" -H "X-Auth-Key: Password"

in place of

"X-Auth-Token: PassWord"

If you are getting :

Vim
1
2
3
4
5
6
7
HTTP/1.1 401 Unauthorized
Content–Length: 131
Content–Type: text/html; charset=UTF–8
X–Trans–Id: txbf160d2639c244afa20ef–0054d7599d
Date: Sun, 08 Feb 2015 12:42:05 GMT
 
<html><h1>Unauthorized</h1><p>This server could not verify that you are authorized to access the document you requested.</p></html>%

Then ask HP Cloud’s Support. It is Firewall which is blocking. You have done 90% right.

Python Middleware is a better way, that is fully different topic. We at least passed you to a point which possibly you were fighting too much.

Facebook Twitter Pinterest

Abhishek Ghosh

About Abhishek Ghosh

Abhishek Ghosh is a Businessman, Surgeon, Author and Blogger. You can keep touch with him on Twitter - @AbhishekCTRL.

Here’s what we’ve got for you which might like :

Articles Related to Changing Data With cURL for OpenStack Swift (HP Cloud CDN)

  • Nginx WordPress Installation Guide (All Steps)

    This is a Full Nginx WordPress Installation Guide With All the Steps, Including Some Optimization and Setup Which is Compatible With WordPress DOT ORG Example Settings For Nginx.

  • Change CDN Object Metadata in HP Cloud CDN With cURL

    Possibly Most Important Parameter to Change is TTL or Expires. We Have Pointed How To Change CDN Object Metadata in HP Cloud CDN With cURL.

  • OpenStack Swift & HPCloud CDN PHP Bindings : Basics

    Here is the basics of OpenStack Swift & HPCloud CDN PHP Bindings for the WordPress Plugin developers and those who works with PHP based CMS.

  • Upload to HP Cloud CDN Using OpenStack Swift Client

    Here is How to Upload Images, Java-scripts, CSS Files to HP Cloud CDN Using OpenStack Swift Python Client From OS X or GNU Linux Terminal.

performing a search on this website can help you. Also, we have YouTube Videos.

Take The Conversation Further ...

We'd love to know your thoughts on this article.
Meet the Author over on Twitter to join the conversation right now!

If you want to Advertise on our Article or want a Sponsored Article, you are invited to Contact us.

Contact Us

Subscribe To Our Free Newsletter

Get new posts by email:

Please Confirm the Subscription When Approval Email Will Arrive in Your Email Inbox as Second Step.

Search this website…

 

Popular Articles

Our Homepage is best place to find popular articles!

Here Are Some Good to Read Articles :

  • Cloud Computing Service Models
  • What is Cloud Computing?
  • Cloud Computing and Social Networks in Mobile Space
  • ARM Processor Architecture
  • What Camera Mode to Choose
  • Indispensable MySQL queries for custom fields in WordPress
  • Windows 7 Speech Recognition Scripting Related Tutorials

Social Networks

  • Pinterest (24.3K Followers)
  • Twitter (5.8k Followers)
  • Facebook (5.7k Followers)
  • LinkedIn (3.7k Followers)
  • YouTube (1.3k Followers)
  • GitHub (Repository)
  • GitHub (Gists)
Looking to publish sponsored article on our website?

Contact us

Recent Posts

  • Hybrid Multi-Cloud Environments Are Becoming UbiquitousJuly 12, 2023
  • Data Protection on the InternetJuly 12, 2023
  • Basics of BJT TransistorJuly 11, 2023
  • What is Confidential Computing?July 11, 2023
  • How a MOSFET WorksJuly 10, 2023
PC users can consult Corrine Chorney for Security.

Want to know more about us?

Read Notability and Mentions & Our Setup.

Copyright © 2023 - The Customize Windows | dESIGNed by The Customize Windows

Copyright  · Privacy Policy  · Advertising Policy  · Terms of Service  · Refund Policy