Repository: aws/aws-cli

Issue:
lambda update-function-code --zip-file option inconsistent with create-function --zip-file option
The `aws lambda create-function --zip-file` option help says:

```
--zip-file  (blob) The path to the zip file of the code you are upload-
       ing. Example: fileb://code.zip
```

Not sure what the (blob) pertains to.

Anyway, the `aws lambda update-function-code --zip-file` option docs say:

```
--zip-file (blob)
          Based64-encoded .zip file containing your packaged source code.
```

... which is confusing and inconsistent. The `--zip-file` option for the `update-function` command should work the same as for the `create-function` command. Instead, I understand this documentation to mean that instead of providing the path to the zip file as the value of this option, the contents of the zip file need to be provided as a base64-encoded string, which seems horrible. It would be much better to provide a value like `fileb://code.zip`.



Discussion:
I went ahead and assumed the documentation was in error, and provided a value like `fileb://code.zip` and the`update-function-code` command appeared to work. Looks like the docs need tweaking.

Yes, that does seem to be a bit confusing. The CLI will actually do the encoding for you. Thanks for letting us know!


Resolving patch:
diff --git a/awscli/arguments.py b/awscli/arguments.py
--- a/awscli/arguments.py
+++ b/awscli/arguments.py
@@ -392,6 +392,7 @@ def __init__(self, name, argument_model, operation_model,
         self._required = is_required
         self._operation_model = operation_model
         self._event_emitter = event_emitter
+        self._documentation = argument_model.documentation
 
     @property
     def py_name(self):
@@ -407,7 +408,11 @@ def required(self, value):
 
     @property
     def documentation(self):
-        return self.argument_model.documentation
+        return self._documentation
+
+    @documentation.setter
+    def documentation(self, value):
+        self._documentation = value
 
     @property
     def cli_type_name(self):
diff --git a/awscli/customizations/awslambda.py b/awscli/customizations/awslambda.py
--- a/awscli/customizations/awslambda.py
+++ b/awscli/customizations/awslambda.py
@@ -23,10 +23,15 @@
     "--zip-file must be a file with the fileb:// prefix.\n"
     "Example usage:  --zip-file fileb://path/to/file.zip")
 
+ZIP_DOCSTRING = ('<p>The path to the zip file of the code you are uploading. '
+                 'Example: fileb://code.zip</p>')
+
 
 def register_lambda_create_function(cli):
     cli.register('building-argument-table.lambda.create-function',
                  _extract_code_and_zip_file_arguments)
+    cli.register('building-argument-table.lambda.update-function-code',
+                 _modify_zipfile_docstring)
     cli.register('process-cli-arg.lambda.update-function-code',
                  validate_is_zip_file)
 
@@ -38,9 +43,7 @@ def validate_is_zip_file(cli_argument, value, **kwargs):
 
 def _extract_code_and_zip_file_arguments(session, argument_table, **kwargs):
     argument_table['zip-file'] = ZipFileArgument(
-        'zip-file', help_text=('The path to the zip file of the code you '
-                               'are uploading. Example: fileb://code.zip'),
-        cli_type_name='blob')
+        'zip-file', help_text=ZIP_DOCSTRING, cli_type_name='blob')
     code_argument = argument_table['code']
     code_model = copy.deepcopy(code_argument.argument_model)
     del code_model.members['ZipFile']
@@ -54,6 +57,11 @@ def _extract_code_and_zip_file_arguments(session, argument_table, **kwargs):
     )
 
 
+def _modify_zipfile_docstring(session, argument_table, **kwargs):
+    if 'zip-file' in argument_table:
+        argument_table['zip-file'].documentation = ZIP_DOCSTRING
+
+
 def _should_contain_zip_content(value):
     if not isinstance(value, bytes):
         # If it's not bytes it's basically impossible for


Test patch: