Repository: softlayer/softlayer-python
Pull request #2054 (2023-07-25 12:45:34)

Sub features and Example were missing in slcli cdn edit, slcli cdn origin-add
Hi @allmightyspiff,

Fixes: #2019 

**Title:**
Added Sub features and Example in slcli cdn edit, slcli cdn origin-add

**Description:**
1. I have added sub **feature** cache-description in ./slcli **cdn** **edit** --help
2. I have added **Example** and sub **features** like **https port**, **compression**, **dynamic-path**, **prefetching** in ./slcli **cdn** **origin-add** --help.

Please **review** it.

Please find the screen shots.

**Screen Shot: 1**
<img width="1307" alt="Screenshot 2023-07-19 at 6 49 35 PM" src="https://github.com/softlayer/softlayer-python/assets/125332006/04331d12-2006-46bc-b3ff-883b444cf49f">

**Screen Shot: 2**
<img width="844" alt="Screenshot 2023-07-19 at 6 50 32 PM" src="https://github.com/softlayer/softlayer-python/assets/125332006/f66a0512-c2fa-4bfb-b604-761cf262c1f2">

**Screen Shot: 3**
<img width="996" alt="Screenshot 2023-07-24 at 11 55 57 PM" src="https://github.com/softlayer/softlayer-python/assets/125332006/7f15a5a5-ba7f-4f3c-afdb-34e5bc4881ec">

**Screen Shot: 4**
<img width="1226" alt="Screenshot 2023-07-24 at 10 06 04 PM" src="https://github.com/softlayer/softlayer-python/assets/125332006/0a8ae482-9637-4bfb-a538-96a8be37e90e">

**Screen Shot: 5**
<img width="1225" alt="Screenshot 2023-07-24 at 10 06 13 PM" src="https://github.com/softlayer/softlayer-python/assets/125332006/30c78cbf-196b-45d4-9445-1174ed9a327f">

Thanks,
Ramkishor Chaladi.


Patch:
diff --git a/SoftLayer/CLI/block/access/authorize.py b/SoftLayer/CLI/block/access/authorize.py
index 4a5931e9..e5aef52a 100644
--- a/SoftLayer/CLI/block/access/authorize.py
+++ b/SoftLayer/CLI/block/access/authorize.py
@@ -21,13 +21,7 @@
               help='The ID of one virtual server to authorize. ' + MULTIPLE)
 @environment.pass_env
 def cli(env, volume_id, hardware_id, virtual_id, ip_address_id, ip_address):
-    """Authorize hosts to access a given volume.
-
-    EXAMPLE::
-
-            slcli block access-authorize 12345678 --virtual-id 87654321
-            This command authorizes virtual server with ID 87654321 to access volume with ID 12345678.
-    """
+    """Authorize hosts to access a given volume."""
     block_manager = SoftLayer.BlockStorageManager(env.client)
     ip_address_id_list = list(ip_address_id)
 
diff --git a/SoftLayer/CLI/block/access/list.py b/SoftLayer/CLI/block/access/list.py
index c2aa4c24..5846a349 100644
--- a/SoftLayer/CLI/block/access/list.py
+++ b/SoftLayer/CLI/block/access/list.py
@@ -21,13 +21,7 @@
               default='name')
 @environment.pass_env
 def cli(env, columns, sortby, volume_id):
-    """List hosts that are authorized to access the volume.
-
-    EXAMPLE::
-
-            slcli block access-list 12345678 --sortby id
-            This command lists all hosts that are authorized to access volume with ID 12345678 and sorts them by ID.
-    """
+    """List hosts that are authorized to access the volume."""
     block_manager = SoftLayer.BlockStorageManager(env.client)
     resolved_id = helpers.resolve_id(block_manager.resolve_ids, volume_id, 'Volume Id')
     access_list = block_manager.get_block_volume_access_list(
diff --git a/SoftLayer/CLI/block/access/revoke.py b/SoftLayer/CLI/block/access/revoke.py
index d1ab27bd..b034ecac 100644
--- a/SoftLayer/CLI/block/access/revoke.py
+++ b/SoftLayer/CLI/block/access/revoke.py
@@ -18,13 +18,7 @@
               help='The ID of one SoftLayer_Virtual_Guest to revoke authorization.')
 @environment.pass_env
 def cli(env, volume_id, hardware_id, virtual_id, ip_address_id, ip_address):
-    """Revoke authorization for hosts that are accessing a specific volume.
-
-    EXAMPLE::
-
-            slcli block access-revoke 12345678 --virtual-id 87654321
-            This command revokes access of virtual server with ID 87654321 to volume with ID 12345678.
-    """
+    """Revoke authorization for hosts that are accessing a specific volume."""
     block_manager = SoftLayer.BlockStorageManager(env.client)
     ip_address_id_list = list(ip_address_id)
 
diff --git a/SoftLayer/CLI/block/duplicate_convert_status.py b/SoftLayer/CLI/block/duplicate_convert_status.py
index 630e3e1b..9849cea3 100644
--- a/SoftLayer/CLI/block/duplicate_convert_status.py
+++ b/SoftLayer/CLI/block/duplicate_convert_status.py
@@ -7,11 +7,12 @@
 from SoftLayer.CLI import formatting
 
 
-@click.command(cls=SoftLayer.CLI.command.SLCommand)
+@click.command(cls=SoftLayer.CLI.command.SLCommand,
+               epilog="""Get status for split or move completed percentage of a given block duplicate volume.""")
 @click.argument('volume-id')
 @environment.pass_env
 def cli(env, volume_id):
-    """Get status for split or move completed percentage of a given block storage duplicate volume."""
+    """Get status for split or move completed percentage of a given block duplicate volume."""
     table = formatting.Table(['Username', 'Active Conversion Start Timestamp', 'Completed Percentage'])
 
     block_manager = SoftLayer.BlockStorageManager(env.client)
diff --git a/SoftLayer/CLI/block/refresh.py b/SoftLayer/CLI/block/refresh.py
index e58fbf28..d5e8bea8 100644
--- a/SoftLayer/CLI/block/refresh.py
+++ b/SoftLayer/CLI/block/refresh.py
@@ -13,13 +13,7 @@
               help="Cancel current refresh process and initiates the new refresh.")
 @environment.pass_env
 def cli(env, volume_id, snapshot_id, force_refresh):
-    """Refresh a duplicate volume with a snapshot from its parent.
-
-    EXAMPLE::
-
-            slcli block volume-refresh VOLUME_ID SNAPSHOT_ID
-            Refresh a duplicate VOLUME_ID with a snapshot from its parent SNAPSHOT_ID.
-    """
+    """Refresh a duplicate volume with a snapshot from its parent."""
     block_manager = SoftLayer.BlockStorageManager(env.client)
     resp = block_manager.refresh_dupe(volume_id, snapshot_id, force_refresh)
 
diff --git a/SoftLayer/CLI/block/replication/disaster_recovery_failover.py b/SoftLayer/CLI/block/replication/disaster_recovery_failover.py
index 00026352..221faf57 100644
--- a/SoftLayer/CLI/block/replication/disaster_recovery_failover.py
+++ b/SoftLayer/CLI/block/replication/disaster_recovery_failover.py
@@ -9,8 +9,8 @@
 
 
 @click.command(cls=SoftLayer.CLI.command.SLCommand,
-               epilog="""If a volume (with replication) becomes inaccessible due to a disaster event,
-this method can be used to immediately
+               epilog="""Failover an inaccessible block volume to its available replicant volume.
+If a volume (with replication) becomes inaccessible due to a disaster event, this method can be used to immediately
 failover to an available replica in another location. This method does not allow for failback via API.
 After using this method, to failback to the original volume, please open a support ticket.
 If you wish to test failover, please use replica-failover.""")
@@ -18,13 +18,7 @@
 @click.option('--replicant-id', help="ID of the replicant volume.")
 @environment.pass_env
 def cli(env, volume_id, replicant_id):
-    """Failover an inaccessible block volume to its available replicant volume.
-
-    EXAMPLE::
-
-            slcli block disaster-recovery-failover 12345678 87654321
-            This command performs failover operation for volume with ID 12345678 to replica volume with ID 87654321.
-    """
+    """Failover an inaccessible block volume to its available replicant volume."""
     block_storage_manager = SoftLayer.BlockStorageManager(env.client)
 
     click.secho("""WARNING : Failover an inaccessible block volume to its available replicant volume."""
diff --git a/SoftLayer/CLI/block/set_note.py b/SoftLayer/CLI/block/set_note.py
index 8c35762c..a9678bf0 100644
--- a/SoftLayer/CLI/block/set_note.py
+++ b/SoftLayer/CLI/block/set_note.py
@@ -15,12 +15,7 @@
               help='Public notes related to a Storage volume')
 @environment.pass_env
 def cli(env, volume_id, note):
-    """Set note for an existing block storage volume.
-
-    EXAMPLE::
-
-            slcli block volume-set-note 12345678 --note 'this is my note'
-    """
+    """Set note for an existing block storage volume."""
     block_manager = SoftLayer.BlockStorageManager(env.client)
     block_volume_id = helpers.resolve_id(block_manager.resolve_ids, volume_id, 'Block Volume')
 
diff --git a/SoftLayer/CLI/block/snapshot/set_notify_status.py b/SoftLayer/CLI/block/snapshot/set_notify_status.py
index 053a959e..a9d051ee 100644
--- a/SoftLayer/CLI/block/snapshot/set_notify_status.py
+++ b/SoftLayer/CLI/block/snapshot/set_notify_status.py
@@ -20,8 +20,9 @@ def cli(env, volume_id, enable):
     """Enables/Disables snapshot space usage threshold warning for a given volume."""
     block_manager = SoftLayer.BlockStorageManager(env.client)
 
-    block_manager.set_volume_snapshot_notification(volume_id, enable)
+    status = block_manager.set_volume_snapshot_notification(volume_id, enable)
 
-    click.echo(
+    if status:
+        click.echo(
             'Snapshots space usage threshold warning notification has bee set to %s for volume %s'
             % (enable, volume_id))
diff --git a/SoftLayer/CLI/block/subnets/assign.py b/SoftLayer/CLI/block/subnets/assign.py
index d80e5aff..daf554df 100644
--- a/SoftLayer/CLI/block/subnets/assign.py
+++ b/SoftLayer/CLI/block/subnets/assign.py
@@ -14,12 +14,6 @@
 def cli(env, access_id, subnet_id):
     """Assign block storage subnets to the given host id.
 
-    EXAMPLE::
-
-                slcli block subnets-assign 111111 --subnet-id 222222
-                slcli block subnets-assign 111111 --subnet-id 222222 --subnet-id 333333
-                ACCESS_ID is the host_id obtained by: softlayer slcli block access-list <volume_id>
-
     access_id is the host_id obtained by: slcli block access-list <volume_id>
 
     SoftLayer_Account::iscsiisolationdisabled must be False to use this command
diff --git a/SoftLayer/CLI/block/subnets/list.py b/SoftLayer/CLI/block/subnets/list.py
index 297846ab..a60142f7 100644
--- a/SoftLayer/CLI/block/subnets/list.py
+++ b/SoftLayer/CLI/block/subnets/list.py
@@ -21,11 +21,6 @@
 def cli(env, access_id):
     """List block storage assigned subnets for the given host id.
 
-    Example::
-
-                slcli block subnets-list 12345678
-                ACCESS_ID is the host_id obtained by: softlayer slcli block access-list <volume_id>
-
     access_id is the host_id obtained by: slcli block access-list <volume_id>
     """
 
diff --git a/SoftLayer/CLI/block/subnets/remove.py b/SoftLayer/CLI/block/subnets/remove.py
index 98d52ad1..92d825af 100644
--- a/SoftLayer/CLI/block/subnets/remove.py
+++ b/SoftLayer/CLI/block/subnets/remove.py
@@ -14,12 +14,6 @@
 def cli(env, access_id, subnet_id):
     """Remove block storage subnets for the given host id.
 
-    Example::
-
-                slcli block subnets-remove 111111 --subnet-id 222222
-                slcli block subnets-remove 111111 --subnet-id 222222 --subnet-id 333333
-                ACCESS_ID is the host_id obtained by: slcli block access-list <volume_id>
-
     access_id is the host_id obtained by: slcli block access-list <volume_id>
 
     SoftLayer_Account::iscsiisolationdisabled must be False to use this command
diff --git a/SoftLayer/CLI/cdn/edit.py b/SoftLayer/CLI/cdn/edit.py
index bd2c8b82..df4f1794 100644
--- a/SoftLayer/CLI/cdn/edit.py
+++ b/SoftLayer/CLI/cdn/edit.py
@@ -31,11 +31,16 @@
               type=click.Choice(['1', '0']),
               help="Respect headers. The value 1 is On and 0 is Off."
               )
-@click.option('--cache', '-c', multiple=True, type=str,
+@click.option('--cache', '-c', type=str,
               help="Cache key optimization. These are the valid options to choose: 'include-all', 'ignore-all', "
                    "'include-specified', 'ignore-specified'. If you select 'include-specified' or 'ignore-specified' "
-                   "please add a description too using again --cache, "
-                   "e.g --cache=include-specified --cache=description."
+                   "please add to option --cache-description.\n"
+                   " e.g --cache=include-specified --cache-description=description."
+              )
+@click.option('--cache-description', '-C', type=str,
+              help="In cache option, if you select 'include-specified' or 'ignore-specified', "
+                   "please add a description too using this option.\n"
+                   "e.g --cache include-specified --cache-description description."
               )
 @click.option('--performance-configuration', '-p',
               type=click.Choice(['General web delivery', 'Large file optimization', 'Video on demand optimization']),
@@ -43,7 +48,8 @@
                    "the Dynamic content acceleration option is not added because this has a special configuration."
               )
 @environment.pass_env
-def cli(env, identifier, header, http_port, https_port, origin, respect_headers, cache, performance_configuration):
+def cli(env, identifier, header, http_port, https_port, origin, respect_headers, cache,
+        cache_description, performance_configuration):
     """Edit a CDN Account.
 
        Note: You can use the hostname or uniqueId as IDENTIFIER.
@@ -53,15 +59,14 @@ def cli(env, identifier, header, http_port, https_port, origin, respect_headers,
     cdn_id = helpers.resolve_id(manager.resolve_ids, identifier, 'CDN')
 
     cache_result = {}
-    if cache:
+    if cache or cache_description:
         if len(cache) > 1:
-            cache_result['cacheKeyQueryRule'] = cache[0]
-            cache_result['description'] = cache[1]
+            cache_result['cacheKeyQueryRule'] = cache
         else:
             cache_result['cacheKeyQueryRule'] = cache[0]
 
     cdn_result = manager.edit(cdn_id, header=header, http_port=http_port, https_port=https_port, origin=origin,
-                              respect_headers=respect_headers, cache=cache_result,
+                              respect_headers=respect_headers, cache=cache_result, cache_description=cache_description,
                               performance_configuration=performance_configuration)
 
     table = formatting.KeyValueTable(['name', 'value'])
diff --git a/SoftLayer/CLI/cdn/origin_add.py b/SoftLayer/CLI/cdn/origin_add.py
index 0214f862..7a77b026 100644
--- a/SoftLayer/CLI/cdn/origin_add.py
+++ b/SoftLayer/CLI/cdn/origin_add.py
@@ -24,21 +24,34 @@
 @click.option('--bucket-name', '-b',
               type=click.STRING,
               help="The name of the available resource [required if --origin-type=storage]")
-@click.option('--port', '-p',
+@click.option('--http-port', '-p',
               type=click.INT,
-              help="The http port number.",
-              default=80,
-              show_default=True)
+              help="The http port number. [http or https is required]")
+@click.option('--https-port', '-s',
+              type=click.INT,
+              help="The https port number. [http or https is required]"
+              )
 @click.option('--protocol', '-P',
               type=click.STRING,
               help="The protocol used by the origin.",
               default='http',
               show_default=True)
 @click.option('--optimize-for', '-o',
-              type=click.Choice(['web', 'video', 'file']),
+              type=click.Choice(['web', 'video', 'file', 'dynamic']),
               help="Performance configuration",
               default='web',
               show_default=True)
+@click.option('--dynamic-path', '-d',
+              help="The path that Akamai edge servers periodically fetch the test object from."
+              "example = /detection-test-object.html")
+@click.option('--compression', '-i',
+              help="Enable or disable compression of JPEG images for requests over certain network conditions.",
+              default='true',
+              show_default=True)
+@click.option('--prefetching', '-g',
+              help="Enable or disable the embedded object prefetching feature.",
+              default='true',
+              show_default=True)
 @click.option('--extensions', '-e',
               type=click.STRING,
               help="File extensions that can be stored in the CDN, example: 'jpg, png, pdf'")
@@ -50,7 +63,9 @@
               show_default=True)
 @environment.pass_env
 def cli(env, unique_id, origin, path, origin_type, header,
-        bucket_name, port, protocol, optimize_for, extensions, cache_query):
+        bucket_name, http_port, https_port, protocol, optimize_for,
+        dynamic_path, compression, prefetching,
+        extensions, cache_query):
     """Create an origin path for an existing CDN mapping.
 
     For more information see the following documentation: \n
@@ -62,10 +77,12 @@ def cli(env, unique_id, origin, path, origin_type, header,
     if origin_type == 'storage' and not bucket_name:
         raise exceptions.ArgumentError('[-b | --bucket-name] is required when [-t | --origin-type] is "storage"')
 
-    result = manager.add_origin(unique_id, origin, path, origin_type=origin_type,
-                                header=header, port=port, protocol=protocol,
+    result = manager.add_origin(unique_id, origin, path, dynamic_path, origin_type=origin_type,
+                                header=header, http_port=http_port, https_port=https_port, protocol=protocol,
                                 bucket_name=bucket_name, file_extensions=extensions,
-                                optimize_for=optimize_for, cache_query=cache_query)
+                                optimize_for=optimize_for,
+                                compression=compression, prefetching=prefetching,
+                                cache_query=cache_query)
 
     table = formatting.Table(['Item', 'Value'])
     table.align['Item'] = 'r'
@@ -78,8 +95,11 @@ def cli(env, unique_id, origin, path, origin_type, header,
 
     table.add_row(['Origin', result['origin']])
     table.add_row(['Origin Type', result['originType']])
+    table.add_row(['Header', result['header']])
     table.add_row(['Path', result['path']])
-    table.add_row(['Port', result['httpPort']])
+    table.add_row(['Http Port', result['httpPort']])
+    table.add_row(['Https Port', result['httpsPort']])
+    table.add_row(['Cache Key Rule', result['cacheKeyQueryRule']])
     table.add_row(['Configuration', result['performanceConfiguration']])
     table.add_row(['Status', result['status']])
 
diff --git a/SoftLayer/fixtures/SoftLayer_Network_CdnMarketplace_Configuration_Mapping_Path.py b/SoftLayer/fixtures/SoftLayer_Network_CdnMarketplace_Configuration_Mapping_Path.py
index 59705f7b..3824e569 100644
--- a/SoftLayer/fixtures/SoftLayer_Network_CdnMarketplace_Configuration_Mapping_Path.py
+++ b/SoftLayer/fixtures/SoftLayer_Network_CdnMarketplace_Configuration_Mapping_Path.py
@@ -21,16 +21,23 @@
 
 createOriginPath = [
     {
-        "header": "test.example.com",
         "httpPort": 80,
+        "httpsPort": 81,
         "mappingUniqueId": "993419389425697",
         "origin": "10.10.10.1",
         "originType": "HOST_SERVER",
+        "header": "test.example.com",
         "path": "/example",
         "status": "RUNNING",
         "bucketName": "test-bucket",
         'fileExtension': 'jpg',
-        "performanceConfiguration": "General web delivery"
+        "performanceConfiguration": "Dynamic content acceleration",
+        "dynamicContentAcceleration": {
+                "detectionPath": "/abc.html",
+                "prefetchEnabled": True,
+                "mobileImageCompressionEnabled": True
+            },
+        "cacheKeyQueryRule": "include-all"
     }
 ]
 
diff --git a/SoftLayer/managers/cdn.py b/SoftLayer/managers/cdn.py
index 703e6f14..0f3a26f0 100644
--- a/SoftLayer/managers/cdn.py
+++ b/SoftLayer/managers/cdn.py
@@ -64,27 +64,35 @@ def get_origins(self, unique_id, **kwargs):
 
         return self.cdn_path.listOriginPath(unique_id, **kwargs)
 
-    def add_origin(self, 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"):
+    def add_origin(self, 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"):
         """Creates an origin path for an existing CDN.
 
         :param str unique_id: The unique ID associated with the CDN.
         :param str path: relative path to the domain provided, e.g. "/articles/video"
+        :param str dynamic_path: The path that Akamai edge servers periodically fetch the test object from.
+                                example = /detection-test-object.html
         :param str origin: ip address or hostname if origin_type=server, API endpoint for
                            your S3 object storage if origin_type=storage
         :param str origin_type: it can be 'server' or 'storage' types.
         :param str header: the edge server uses the host header to communicate with the origin.
                            It defaults to hostname. (optional)
-        :param int port: the http port number (default: 80)
+        :param int http_port: the http port number (default: 80)
+        :param int https_port: the https port number
         :param str protocol: the protocol of the origin (default: HTTP)
         :param str bucket_name: name of the available resource
         :param str file_extensions: file extensions that can be stored in the CDN, e.g. "jpg,png"
         :param str optimize_for: performance configuration, available options: web, video, and file where:
 
-                                    - 'web' = 'General web delivery'
-                                    - 'video' = 'Video on demand optimization'
-                                    - 'file' = 'Large file optimization'
+                                - 'web' = 'General web delivery'
+                                - 'video' = 'Video on demand optimization'
+                                - 'file' = 'Large file optimization'
+                                - 'dynamic' = 'Dynamic content acceleration'
+        :param bool compression: Enable or disable compression of JPEG images for requests over
+                                certain network conditions.
+        :param bool prefetching: Enable or disable the embedded object prefetching feature.
         :param str cache_query: rules with the following formats: 'include-all', 'ignore-all',
                                'include: space separated query-names',
                                'ignore: space separated query-names'.'
@@ -94,7 +102,8 @@ def add_origin(self, unique_id, origin, path, origin_type="server", header=None,
         performance_config = {
             'web': 'General web delivery',
             'video': 'Video on demand optimization',
-            'file': 'Large file optimization'
+            'file': 'Large file optimization',
+            "dynamic": "Dynamic content acceleration"
         }
 
         new_origin = {
@@ -102,12 +111,20 @@ def add_origin(self, unique_id, origin, path, origin_type="server", header=None,
             'path': path,
             'origin': origin,
             'originType': types.get(origin_type),
-            'httpPort': port,
+            'httpPort': http_port,
+            'httpsPort': https_port,
             'protocol': protocol.upper(),
-            'performanceConfiguration': performance_config.get(optimize_for, 'General web delivery'),
-            'cacheKeyQueryRule': cache_query
+            'performanceConfiguration': performance_config.get(optimize_for),
+            'cacheKeyQueryRule': cache_query,
         }
 
+        if optimize_for == 'dynamic':
+            new_origin['dynamicContentAcceleration'] = {
+                'detectionPath': "/" + str(dynamic_path),
+                'prefetchEnabled': bool(prefetching),
+                'mobileImageCompressionEnabled': bool(compression)
+            }
+
         if header:
             new_origin['header'] = header
 
@@ -175,7 +192,7 @@ def end_date(self):
         return self._end_date
 
     def edit(self, identifier, header=None, http_port=None, https_port=None, origin=None,
-             respect_headers=None, cache=None, performance_configuration=None):
+             respect_headers=None, cache=None, cache_description=None, performance_configuration=None):
         """Edit the cdn object.
 
         :param string identifier: The CDN identifier.
@@ -223,12 +240,12 @@ def edit(self, identifier, header=None, http_port=None, https_port=None, origin=
         if respect_headers:
             config['respectHeaders'] = respect_headers
 
-        if cache:
+        if cache or cache_description:
             if 'include-specified' in cache['cacheKeyQueryRule']:
-                cache_key_rule = self.get_cache_key_query_rule('include', cache)
+                cache_key_rule = self.get_cache_key_query_rule('include', cache_description)
                 config['cacheKeyQueryRule'] = cache_key_rule
             elif 'ignore-specified' in cache['cacheKeyQueryRule']:
-                cache_key_rule = self.get_cache_key_query_rule('ignore', cache)
+                cache_key_rule = self.get_cache_key_query_rule('ignore', cache_description)
                 config['cacheKeyQueryRule'] = cache_key_rule
             else:
                 config['cacheKeyQueryRule'] = cache['cacheKeyQueryRule']
@@ -254,7 +271,7 @@ def _get_ids_from_hostname(self, hostname):
         return result
 
     @staticmethod
-    def get_cache_key_query_rule(cache_type, cache):
+    def get_cache_key_query_rule(cache_type, cache_description):
         """Get the cdn object detail.
 
         :param string cache_type: Cache type.
@@ -262,10 +279,10 @@ def get_cache_key_query_rule(cache_type, cache):
 
         :return: string value.
         """
-        if 'description' not in cache:
+        if cache_description is None:
             raise SoftLayer.SoftLayerError('Please add a description to be able to update the'
                                            ' cache.')
-        cache_result = '%s: %s' % (cache_type, cache['description'])
+        cache_result = '%s: %s' % (cache_type, cache_description)
 
         return cache_result
 


Test patch:
diff --git a/tests/CLI/modules/cdn_tests.py b/tests/CLI/modules/cdn_tests.py
index 2e368261..f10bafe7 100644
--- a/tests/CLI/modules/cdn_tests.py
+++ b/tests/CLI/modules/cdn_tests.py
@@ -66,15 +66,30 @@ def test_add_origin_server(self):
 
         self.assert_no_fail(result)
 
+    def test_add_origin_server_dynamic(self):
+        result = self.run_command(
+            ['cdn', 'origin-add', '-t', 'server', '-H=test.example.com', '-s', 81, '-o', 'dynamic', '-c=include-all',
+             '-P', 'HTTPS', '-d', 'abc.html', '-g', True, '-i', True, '1234', '10.10.10.1', '/example/videos2', ])
+
+        self.assert_no_fail(result)
+
     def test_add_origin_storage(self):
         result = self.run_command(['cdn', 'origin-add', '-t', 'storage', '-b=test-bucket', '-H=test.example.com',
                                    '-p', 80, '-o', 'web', '-c=include-all', '1234', '10.10.10.1', '/example/videos2'])
 
         self.assert_no_fail(result)
 
+    def test_add_origin_storage_dynamic(self):
+        result = self.run_command(['cdn', 'origin-add', '-t', 'storage', '-b=test-bucket', '-H=test.example.com',
+                                   '-s', 81, '-o', 'dynamic', '-c=include-all', '1234', '10.10.10.1',
+                                   '/example/videos2', '-g', True, '-i', True])
+
+        self.assert_no_fail(result)
+
     def test_add_origin_without_storage(self):
         result = self.run_command(['cdn', 'origin-add', '-t', 'storage', '-H=test.example.com', '-p', 80,
-                                   '-o', 'web', '-c=include-all', '1234', '10.10.10.1', '/example/videos2'])
+                                   '-P', 'HTTPS', '-o', 'web', '-c=include-all',
+                                   '1234', '10.10.10.1', '/example/videos2'])
 
         self.assertEqual(result.exit_code, 2)
         self.assertIsInstance(result.exception, exceptions.ArgumentError)
@@ -86,6 +101,15 @@ def test_add_origin_storage_with_file_extensions(self):
 
         self.assert_no_fail(result)
 
+    def test_add_origin_storage_with_file_extensions_dynamic(self):
+        result = self.run_command(
+            ['cdn', 'origin-add', '-t', 'storage', '-b=test-bucket', '-e', 'jpg', '-H=test.example.com', '-s', 81,
+             '-P', 'HTTPS', '-o', 'dynamic', '-d', 'abc.html', '-g', True, '-i', True,
+             '-c=include-all', '1234', '10.10.10.1', '/example/videos2',
+             ])
+
+        self.assert_no_fail(result)
+
     def test_remove_origin(self):
         result = self.run_command(['cdn', 'origin-remove', '1234',
                                    '/example1'])
diff --git a/tests/managers/cdn_tests.py b/tests/managers/cdn_tests.py
index 6a220e28..71dcf737 100644
--- a/tests/managers/cdn_tests.py
+++ b/tests/managers/cdn_tests.py
@@ -58,42 +58,54 @@ def test_get_origins(self):
                                 'listOriginPath')
 
     def test_add_origin(self):
-        self.cdn_client.add_origin("12345", "10.10.10.1", "/example/videos", origin_type="server",
-                                   header="test.example.com", port=80, protocol='http', optimize_for="web",
-                                   cache_query="include all")
+        self.cdn_client.add_origin("12345", "10.10.10.1", "/example/videos", dynamic_path="abc.html",
+                                   origin_type="server", header="test.example.com", https_port=81,
+                                   protocol='https', optimize_for="dynamic", compression=True,
+                                   prefetching=True, cache_query="include all")
 
         args = ({
             'uniqueId': "12345",
             'origin': '10.10.10.1',
             'path': '/example/videos',
-                    'originType': 'HOST_SERVER',
-                    'header': 'test.example.com',
-                    'httpPort': 80,
-                    'protocol': 'HTTP',
-                    'performanceConfiguration': 'General web delivery',
-                    'cacheKeyQueryRule': "include all"
+            'originType': 'HOST_SERVER',
+            'header': 'test.example.com',
+            'httpPort': 80,
+            'httpsPort': 81,
+            'protocol': 'HTTPS',
+            'performanceConfiguration': 'Dynamic content acceleration',
+            'cacheKeyQueryRule': "include all",
+            'dynamicContentAcceleration': {
+                'detectionPath': "/abc.html",
+                'prefetchEnabled': True,
+                'mobileImageCompressionEnabled': True
+            }
         },)
         self.assert_called_with('SoftLayer_Network_CdnMarketplace_Configuration_Mapping_Path',
                                 'createOriginPath',
                                 args=args)
 
     def test_add_origin_with_bucket_and_file_extension(self):
-        self.cdn_client.add_origin("12345", "10.10.10.1", "/example/videos", origin_type="storage",
-                                   bucket_name="test-bucket", file_extensions="jpg", header="test.example.com", port=80,
-                                   protocol='http', optimize_for="web", cache_query="include all")
+        self.cdn_client.add_origin("12345", "10.10.10.1", "/example/videos", dynamic_path="abc.html",
+                                   origin_type="server", header="test.example.com", https_port=81,
+                                   protocol='https', optimize_for="dynamic", compression=True,
+                                   prefetching=True, cache_query="include all")
 
         args = ({
             'uniqueId': "12345",
             'origin': '10.10.10.1',
             'path': '/example/videos',
-                    'originType': 'OBJECT_STORAGE',
-                    'header': 'test.example.com',
-                    'httpPort': 80,
-                    'protocol': 'HTTP',
-                    'bucketName': 'test-bucket',
-                    'fileExtension': 'jpg',
-                    'performanceConfiguration': 'General web delivery',
-                    'cacheKeyQueryRule': "include all"
+            'originType': 'HOST_SERVER',
+            'header': 'test.example.com',
+            'httpPort': 80,
+            'httpsPort': 81,
+            'protocol': 'HTTPS',
+            'performanceConfiguration': 'Dynamic content acceleration',
+            'cacheKeyQueryRule': "include all",
+            'dynamicContentAcceleration': {
+                'detectionPath': "/abc.html",
+                'prefetchEnabled': True,
+                'mobileImageCompressionEnabled': True
+            }
         },)
         self.assert_called_with('SoftLayer_Network_CdnMarketplace_Configuration_Mapping_Path',
                                 'createOriginPath',