Sha256: 9311e2093b8d14609b4d060e3f4e100b41191cfd4eb9e2cd11b5407eacef0ca8

Contents?: true

Size: 1.87 KB

Versions: 31

Compression:

Stored size: 1.87 KB

Contents

# Examples for working with HP Cloud CDN Service

The HP Cloud services provides CDN support via the request layer abstraction.  In the request abstraction, you can CDN-enable a container, get a list of the CDN-enabled containers, list the metadata for a CDN-enabled container, update the metadata for a CDN-enabled container, and CDN-disable a container.

The examples on this page can be executed from within a Ruby console (IRB):

        irb

* [Connecting to the Service](https://github.com/fog/fog/blob/master/lib/fog/hp/docs/connect.md)


## CDN-Enabling an Existing Container

To CDN-enable an existing container:

        conn.put_container("fog-rocks")

## Listing CDN-Enabled Containers

To generate a list of CDN-enabled containers:

        conn.get_containers

## Listing the Metadata for a CDN-Enabled Container

To list the metadata (or header information) for a CDN-enabled container:

        conn.head_container("fog-rocks")

## Updating the Metadata for a CDN-Enabled Container

To update or modify the metadata for a CDN-enabled container, use the command

> conn.post_container("fog-rocks", {**option**})

Where _option_ can be any of the following:

* X-CDN-Enabled <Boolean> - cdn status for container
* X-CDN-URI <String> - cdn url for this container
* 'X-TTL'<~String> - integer seconds before data expires, defaults to 86400 (1 day), in 900 (15 min.) to 1577836800 (50 years)
* X-Log-Retention <Boolean>

So for example, if you want to modify the X-TTL metadata information so that the value becomes 3600, the command would be:

        conn.post_container("fog-rocks", {'X-Ttl' => 3600 })

## Disabling a CDN Container

To CDN-disable container:

        conn.delete_container("fog-rocks")

---------
[Documentation Home](https://github.com/fog/fog/blob/master/lib/fog/hp/README.md) | [Examples](https://github.com/fog/fog/blob/master/lib/fog/hp/examples/getting_started_examples.md)

Version data entries

31 entries across 31 versions & 4 rubygems

Version Path
fog-1.37.0 lib/fog/hp/examples/cdn.md
fog-1.36.0 lib/fog/hp/examples/cdn.md
fog-1.35.0 lib/fog/hp/examples/cdn.md
fog-2.0.0.pre.0 lib/fog/hp/examples/cdn.md
vagrant-cloudstack-1.2.0 vendor/bundle/gems/fog-1.32.0/lib/fog/hp/examples/cdn.md
fog-1.34.0 lib/fog/hp/examples/cdn.md
fog-1.33.0 lib/fog/hp/examples/cdn.md
fog-1.32.0 lib/fog/hp/examples/cdn.md
fog-1.31.0 lib/fog/hp/examples/cdn.md
vagrant-cloudstack-1.1.0 vendor/bundle/gems/fog-1.22.1/lib/fog/hp/examples/cdn.md
fog-1.30.0 lib/fog/hp/examples/cdn.md
fog-1.29.0 lib/fog/hp/examples/cdn.md
fog-1.28.0 lib/fog/hp/examples/cdn.md
fog-1.27.0 lib/fog/hp/examples/cdn.md
fog-1.26.0 lib/fog/hp/examples/cdn.md
fog-1.25.0 lib/fog/hp/examples/cdn.md
nsidc-fog-1.24.1 lib/fog/hp/examples/cdn.md
fog-1.24.0 lib/fog/hp/examples/cdn.md
ns-fog-1.22.11 lib/fog/hp/examples/cdn.md
ns-fog-1.22.10 lib/fog/hp/examples/cdn.md