CDNManager

class SoftLayer.managers.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

__init__(client)[source]

Methods

__init__(client)

add_origin(unique_id, origin, path, dynamic_path)

Creates an origin path for an existing CDN.

create_cdn([hostname, origin, origin_type, ...])

Create CDN domain mapping for a particular customer.

delete_cdn(unique_id)

Delete CDN domain mapping for a particular customer.

edit(identifier[, header, http_port, ...])

Edit the cdn object.

get_cache_key_query_rule(cache_type, ...)

Get the cdn object detail.

get_cdn(unique_id, **kwargs)

Retrieves the information about the CDN account object.

get_origins(unique_id, **kwargs)

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

get_usage_metrics(unique_id[, history, ...])

Retrieves the cdn usage metrics.

list_cdn(**kwargs)

Lists Content Delivery Networks for the active user.

purge_content(unique_id, path)

Purges a URL or path from the CDN.

remove_origin(unique_id, path)

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

resolve_ids(identifier)

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

Attributes

end_date

Retrieve the cdn usage metric end date.

resolvers

start_data

Retrieve the cdn usage metric start date.

add_origin(unique_id, origin, path, dynamic_path, origin_type='server', header=None, http_port=80, https_port=None, protocol='http', bucket_name=None, file_extensions=None, optimize_for='web', compression=None, prefetching=None, 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”

  • dynamic_path (str) – The path that Akamai edge servers periodically fetch the test object from. example = /detection-test-object.html

  • 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)

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

  • https_port (int) – the https port number

  • 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’

    • ’dynamic’ = ‘Dynamic content acceleration’

  • compression (bool) – Enable or disable compression of JPEG images for requests over certain network conditions.

  • prefetching (bool) – Enable or disable the embedded object prefetching feature.

  • 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

create_cdn(hostname=None, origin=None, origin_type=None, http=None, https=None, bucket_name=None, cname=None, header=None, path=None, ssl=None)[source]

Create CDN domain mapping for a particular customer.

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

  • 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.

  • http (int) – http port

  • https (int) – https port

  • bucket_name (str) – name of the available resource

  • cname (str) – globally unique subdomain

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

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

  • ssl (str) – ssl certificate

Returns:

The cdn that is being created.

delete_cdn(unique_id)[source]

Delete CDN domain mapping for a particular customer.

Parameters:

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

Returns:

The cdn that is being deleted.

edit(identifier, header=None, http_port=None, https_port=None, origin=None, respect_headers=None, cache=None, cache_description=None, performance_configuration=None)[source]

Edit the cdn object.

Parameters:
  • identifier (string) – The CDN identifier.

  • header – The cdn Host header.

  • http_port – The cdn HTTP port.

  • https_port – The cdn HTTPS port.

  • origin – The cdn Origin server address.

  • respect_headers – The cdn Respect headers.

  • cache – The cdn Cache key optimization.

  • performance_configuration – The cdn performance configuration.

Returns:

SoftLayer_Container_Network_CdnMarketplace_Configuration_Mapping[].

property end_date

Retrieve the cdn usage metric end date.

static get_cache_key_query_rule(cache_type, cache_description)[source]

Get the cdn object detail.

Parameters:
  • cache_type (string) – Cache type.

  • cache – Cache description.

Returns:

string value.

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.