SoftLayer.cdn

CDN Manager/helpers

license:MIT, see LICENSE for more details.
class SoftLayer.managers.cdn.CDNManager(client)[source]

Manage CDN accounts

add_origin(account_id, media_type, origin_url, cname=None, secure=False)[source]

Adds an original pull mapping to an origin-pull based CDN account with the options provided.

Parameters:
  • account_id (int) – the numeric ID associated with the CDN account.
  • media_type (string) – the media type/protocol associated with this origin pull mapping; valid values are HTTP, FLASH, and WM.
  • origin_url (string) – the base URL from which content should be pulled.
  • cname (string) – an optional CNAME that should be associated with this origin pull rule; only the hostname should be included (i.e., no ‘http://‘, directories, etc.).
  • secure (boolean) – specifies whether this is an SSL origin pull rule, if SSL is enabled on your account (defaults to false).
get_account(account_id, **kwargs)[source]

Retrieves a CDN account with the specified account ID.

Parameters:
  • int (account_id) – the numeric ID associated with the CDN account.
  • **kwargs (dict) – additional arguments to include in the object mask.
get_origins(account_id, **kwargs)[source]

Retrieves a list of origin pull mappings for a specified CDN account.

Parameters:
  • int (account_id) – the numeric ID associated with the CDN account.
  • **kwargs (dict) – additional arguments to include in the object mask.
list_accounts()[source]

Lists CDN accounts for the active user.

load_content(account_id, urls)[source]

Prefetches one or more URLs to the CDN edge nodes.

Parameters:
  • account_id (int) – the CDN account ID into which content should be preloaded.
  • urls – a string or a list of strings representing the CDN URLs that should be pre-loaded.
Returns:

true if all load requests were successfully submitted; otherwise, returns the first error encountered.

purge_content(account_id, urls)[source]

Purges one or more URLs from the CDN edge nodes.

Parameters:
  • account_id (int) – the CDN account ID from which content should be purged.
  • urls – a string or a list of strings representing the CDN URLs that should be purged.
Returns:

true if all purge requests were successfully submitted; otherwise, returns the first error encountered.

remove_origin(account_id, origin_id)[source]

Removes an origin pull mapping with the given origin pull ID under the provided CDN account ID.

Parameters:
  • account_id (int) – the CDN account ID from which the mapping should be deleted.
  • origin_id (int) – the origin pull mapping ID to delete.
resolve_ids(identifier)

Takes a string and tries to resolve to a list of matching ids.

What exactly ‘identifier’ can be depends on the resolvers

Parameters:identifier (string) – identifying string
Returns list: