Skip to content

Commit 1f2d7e9

Browse files
Ramkishor ChaladiRamkishor Chaladi
authored andcommitted
updated cdn.py for issue_2019
1 parent 4ede2c7 commit 1f2d7e9

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

SoftLayer/managers/cdn.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,10 @@ def get_origins(self, unique_id, **kwargs):
6464

6565
return self.cdn_path.listOriginPath(unique_id, **kwargs)
6666

67-
def add_origin(self, unique_id, origin, path, origin_type="server", header=None,
68-
port=80, protocol='http', bucket_name=None, file_extensions=None,
69-
optimize_for="web", cache_query="include all"):
67+
def add_origin(self, unique_id, origin, path, dynamic_path, origin_type="server", header=None,
68+
port=80, https_port=None, protocol='http', bucket_name=None, file_extensions=None,
69+
optimize_for="web", compression=None, prefetching=None,
70+
cache_query="include all"):
7071
"""Creates an origin path for an existing CDN.
7172
7273
:param str unique_id: The unique ID associated with the CDN.
@@ -94,7 +95,8 @@ def add_origin(self, unique_id, origin, path, origin_type="server", header=None,
9495
performance_config = {
9596
'web': 'General web delivery',
9697
'video': 'Video on demand optimization',
97-
'file': 'Large file optimization'
98+
'file': 'Large file optimization',
99+
"dynamic": "Dynamic content acceleration"
98100
}
99101

100102
new_origin = {
@@ -103,11 +105,17 @@ def add_origin(self, unique_id, origin, path, origin_type="server", header=None,
103105
'origin': origin,
104106
'originType': types.get(origin_type),
105107
'httpPort': port,
108+
'httpsPort': https_port,
106109
'protocol': protocol.upper(),
107110
'performanceConfiguration': performance_config.get(optimize_for, 'General web delivery'),
108111
'cacheKeyQueryRule': cache_query
109112
}
110113

114+
if optimize_for == 'dynamic':
115+
new_origin['DetectionPath']= "/" + str(dynamic_path)
116+
new_origin['PrefetchEnabled']= prefetching
117+
new_origin['MobileImageCompressionEnabled']= compression
118+
111119
if header:
112120
new_origin['header'] = header
113121

0 commit comments

Comments
 (0)