SoftLayer.cdn

CDN Manager/helpers

license

MIT, see LICENSE for more details.

class SoftLayer.managers.cdn.CDNManager(client)[source]

Manage Content Delivery Networks in the account.

See product information here: https://www.ibm.com/cloud/cdn https://cloud.ibm.com/docs/infrastructure/CDN?topic=CDN-about-content-delivery-networks-cdn-

Parameters

client (SoftLayer.API.BaseClient) – the client instance

add_origin(unique_id, origin, path, origin_type='server', header=None, port=80, protocol='http', bucket_name=None, file_extensions=None, optimize_for='web', cache_query='include all')[source]

Creates an origin path for an existing CDN.

Parameters
  • unique_id (str) – The unique ID associated with the CDN.

  • path (str) – relative path to the domain provided, e.g. “/articles/video”

  • origin (str) – ip address or hostname if origin_type=server, API endpoint for your S3 object storage if origin_type=storage

  • origin_type (str) – it can be ‘server’ or ‘storage’ types.

  • header (str) – the edge server uses the host header to communicate with the origin. It defaults to hostname. (optional)

  • port (int) – the http port number (default: 80)

  • protocol (str) – the protocol of the origin (default: HTTP)

  • bucket_name (str) – name of the available resource

  • file_extensions (str) – file extensions that can be stored in the CDN, e.g. “jpg,png”

  • optimize_for (str) –

    performance configuration, available options: web, video, and file where:

    • ’web’ = ‘General web delivery’

    • ’video’ = ‘Video on demand optimization’

    • ’file’ = ‘Large file optimization’

  • cache_query (str) – rules with the following formats: ‘include-all’, ‘ignore-all’, ‘include: space separated query-names’, ‘ignore: space separated query-names’.’

Returns

a CDN origin path object

property end_date

Retrieve the cdn usage metric end date.

get_cdn(unique_id, **kwargs)[source]

Retrieves the information about the CDN account object.

Parameters
  • unique_id (str) – The unique ID associated with the CDN.

  • **kwargs (dict) – header-level option (mask)

Returns

The CDN object

get_origins(unique_id, **kwargs)[source]

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

Parameters
  • unique_id (str) – The unique ID associated with the CDN.

  • **kwargs (dict) – header-level options (mask, limit, etc.)

Returns

The list of origin paths in the CDN object.

get_usage_metrics(unique_id, history=30, frequency='aggregate')[source]

Retrieves the cdn usage metrics.

It uses the ‘days’ argument if start_date and end_date are None.

Parameters
  • unique_id (int) – The CDN uniqueId from which the usage metrics will be obtained.

  • history (int) – Last N days, default days is 30.

  • frequency (str) – It can be day, week, month and aggregate. The default is “aggregate”.

Returns

A Container_Network_CdnMarketplace_Metrics object

list_cdn(**kwargs)[source]

Lists Content Delivery Networks for the active user.

Parameters

**kwargs (dict) – header-level options (mask, limit, etc.)

Returns

The list of CDN objects in the account

purge_content(unique_id, path)[source]

Purges a URL or path from the CDN.

Parameters
  • unique_id (str) – The unique ID associated with the CDN.

  • path (str) – A string of url or path that should be purged.

Returns

A Container_Network_CdnMarketplace_Configuration_Cache_Purge array object

remove_origin(unique_id, path)[source]

Removes an origin pull mapping with the given origin pull ID.

Parameters
  • unique_id (str) – The unique ID associated with the CDN.

  • path (str) – The origin path to delete.

Returns

A string value

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

property start_data

Retrieve the cdn usage metric start date.