1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00
fog--fog/lib/fog/hp/examples/cdn.md

1.9 KiB
Executable file

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

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 - cdn status for container
  • X-CDN-URI - 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

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 | Examples