ECS Swift access via curl

ecs-swift-access-via-curlIn that post we will discuss how to get access to ECS Swift with CLI curl tool.

Namespace ns1 is configured.

ECS namespace configured
user1 is configured. Swift password is 12345678
ECS user configured

  • Authenticate with user and password.
ecsnode:/tmp # curl --insecure -H "X-Auth-User: user1" -H "X-Auth-Key: 12345678" -v "https://ecsnode.com:9025/auth/v1.0" -X GET
* Hostname was NOT found in DNS cache
* Trying 10.10.10.1...
* Connected to ecsnode.com (10.10.10.1) port 9025 (#0)
* successfully set certificate verify locations:
* CAfile: none
 CApath: /etc/ssl/certs/
* SSLv3, TLS handshake, Client hello (1):
* SSLv3, TLS handshake, Server hello (2):
* SSLv3, TLS handshake, CERT (11):
* SSLv3, TLS handshake, Server finished (14):
* SSLv3, TLS handshake, Client key exchange (16):
* SSLv3, TLS change cipher, Client hello (1):
* SSLv3, TLS handshake, Finished (20):
* SSLv3, TLS change cipher, Client hello (1):
* SSLv3, TLS handshake, Finished (20):
* SSL connection using TLSv1.2 / AES128-SHA
* Server certificate:
* subject: CN=DataService
* start date: 2015-10-26 15:59:59 GMT
* expire date: 2025-10-23 15:59:59 GMT
* issuer: CN=DataService
* SSL certificate verify result: self signed certificate (18), continuing anyway.
> GET /auth/v1.0 HTTP/1.1
> User-Agent: curl/7.37.0
> Host: ecsnode.com:9025
> Accept: */*
> X-Auth-User: user1
> X-Auth-Key: 12345678
>
< HTTP/1.1 204 No Content
< X-Storage-Url: https://ecsnode.com:9025/v1/ns1
< X-Auth-Token: 60d7c554119c4ed1965b56675d2fb0ee
* Server Jetty(7.6.4.v20120524) is not blacklisted
< Server: Jetty(7.6.4.v20120524)
<
* Connection #0 to host ecsnode.com left intact
  • Get a list of folders.
  • X-Auth-Token and X-Storage-Url should be taken from the auth request.
ecsnode:/tmp # curl --insecure -H "X-Auth-Token: 60d7c554119c4ed1965b56675d2fb0ee" -v "https://ecsnode.com:9025 /v1/ns1" -X GET
* Hostname was NOT found in DNS cache
* Trying 10.10.10.1...
* Connected to ecsnode.com (10.10.10.1) port 9025 (#0)
* successfully set certificate verify locations:
* CAfile: none
 CApath: /etc/ssl/certs/
* SSLv3, TLS handshake, Client hello (1):
* SSLv3, TLS handshake, Server hello (2):
* SSLv3, TLS handshake, CERT (11):
* SSLv3, TLS handshake, Server finished (14):
* SSLv3, TLS handshake, Client key exchange (16):
* SSLv3, TLS change cipher, Client hello (1):
* SSLv3, TLS handshake, Finished (20):
* SSLv3, TLS change cipher, Client hello (1):
* SSLv3, TLS handshake, Finished (20):
* SSL connection using TLSv1.2 / AES128-SHA
* Server certificate:
* subject: CN=DataService
* start date: 2015-10-26 15:59:59 GMT
* expire date: 2025-10-23 15:59:59 GMT
* issuer: CN=DataService
* SSL certificate verify result: self signed certificate (18), continuing anyway.
> GET /v1/ns1 HTTP/1.1
> User-Agent: curl/7.37.0
> Host: ecsnode.com:9025
> Accept: */*
> X-Auth-Token: 60d7c554119c4ed1965b56675d2fb0ee
>
< HTTP/1.1 200 OK
< X-Timestamp: Tue, 27 Oct 2015 10:29:58 GMT
< X-Account-Bytes-Used: 0
< X-Account-Container-Count: 1
< X-Account-Object-Count: 0
< x-emc-request-id: 0a460258:150a4e067fb:a7e:0
< X-Trans-Id: 0a460258:150a4e067fb:a7e:0
< Date: Tue, 27 Oct 2015 12:28:55 GMT
< Content-Type: text/plain
< Transfer-Encoding: chunked
* Server Jetty(7.6.4.v20120524) is not blacklisted
< Server: Jetty(7.6.4.v20120524)
<
Folder1
* Connection #0 to host ecsnode.com left intact
  • Upload a file
decsnode:/tmp # curl --insecure -H "X-Auth-Token: 60d7c554119c4ed1965b56675d2fb0ee" -v "https://ecsnode.com:9025 /v1/ns1/Folder1/myfile.txt" -X PUT -T myfile.txt
* Hostname was NOT found in DNS cache
* Trying 10.10.10.1...
* Connected to ecsnode.com (10.10.10.1) port 9025 (#0)
* successfully set certificate verify locations:
* CAfile: none
 CApath: /etc/ssl/certs/
* SSLv3, TLS handshake, Client hello (1):
* SSLv3, TLS handshake, Server hello (2):
* SSLv3, TLS handshake, CERT (11):
* SSLv3, TLS handshake, Server finished (14):
* SSLv3, TLS handshake, Client key exchange (16):
* SSLv3, TLS change cipher, Client hello (1):
* SSLv3, TLS handshake, Finished (20):
* SSLv3, TLS change cipher, Client hello (1):
* SSLv3, TLS handshake, Finished (20):
* SSL connection using TLSv1.2 / AES128-SHA
* Server certificate:
* subject: CN=DataService
* start date: 2015-10-26 15:59:59 GMT
* expire date: 2025-10-23 15:59:59 GMT
* issuer: CN=DataService
* SSL certificate verify result: self signed certificate (18), continuing anyway.
> PUT /v1/ns1/Folder1/myfile.txt HTTP/1.1
> User-Agent: curl/7.37.0
> Host: ecsnode.com:9025
> Accept: */*
> X-Auth-Token: 60d7c554119c4ed1965b56675d2fb0ee
> Content-Length: 86
> Expect: 100-continue
>
< HTTP/1.1 100 Continue
* We are completely uploaded and fine
< HTTP/1.1 201 Created
< x-emc-request-id: 0a460258:150a4e067fb:a92:6
< X-Trans-Id: 0a460258:150a4e067fb:a92:6
< Date: Tue, 27 Oct 2015 12:34:55 GMT
< ETag: 5070a08ce9595f3ef8a6bf0ccda30e3d
< Last-Modified: Tue, 27 Oct 2015 12:34:55 GMT
< X-Timestamp: 1445949295
< x-emc-mtime: 1445949295208
< Location: https://ecsnode.com:9025/v1/ns1/Folder1/myfile.txt
< Content-Length: 0
* Server Jetty(7.6.4.v20120524) is not blacklisted
< Server: Jetty(7.6.4.v20120524)
<
* Connection #0 to host ecsnode.com left intact
  • Get a list of files in a folder
ecsnode:/tmp # curl --insecure -H "X-Auth-Token: 60d7c554119c4ed1965b56675d2fb0ee" -v "https://ecsnode.com:9025 /v1/ns1/Folder1" -X GET
* Hostname was NOT found in DNS cache
* Trying 10.10.10.1...
* Connected to ecsnode.com (10.10.10.1) port 9025 (#0)
* successfully set certificate verify locations:
* CAfile: none
 CApath: /etc/ssl/certs/
* SSLv3, TLS handshake, Client hello (1):
* SSLv3, TLS handshake, Server hello (2):
* SSLv3, TLS handshake, CERT (11):
* SSLv3, TLS handshake, Server finished (14):
* SSLv3, TLS handshake, Client key exchange (16):
* SSLv3, TLS change cipher, Client hello (1):
* SSLv3, TLS handshake, Finished (20):
* SSLv3, TLS change cipher, Client hello (1):
* SSLv3, TLS handshake, Finished (20):
* SSL connection using TLSv1.2 / AES128-SHA
* Server certificate:
* subject: CN=DataService
* start date: 2015-10-26 15:59:59 GMT
* expire date: 2025-10-23 15:59:59 GMT
* issuer: CN=DataService
* SSL certificate verify result: self signed certificate (18), continuing anyway.
> GET /v1/ns1/Folder1 HTTP/1.1
> User-Agent: curl/7.37.0
> Host: ecsnode.com:9025
> Accept: */*
> X-Auth-Token: 60d7c554119c4ed1965b56675d2fb0ee
>
< HTTP/1.1 200 OK
< X-Container-Object-Count: 0
< Accept-Ranges: bytes
< X-Container-Meta-x-emc-is-stale-allowed: false
< X-Timestamp: 1445943287348
< X-Container-Bytes-Used: 0
< x-emc-request-id: 0a460258:150a4e067fb:a9f:0
< X-Trans-Id: 0a460258:150a4e067fb:a9f:0
< Date: Tue, 27 Oct 2015 12:35:02 GMT
< Content-Type: text/plain
< Transfer-Encoding: chunked
* Server Jetty(7.6.4.v20120524) is not blacklisted
< Server: Jetty(7.6.4.v20120524)
<
myfile.txt
* Connection #0 to host ecsnode.com left intact

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s