{"action":"created","comment":{"url":"https://api.github.com/repos/aws/aws-cli/pulls/comments/50460542","id":50460542,"diff_hunk":"@@ -50,14 +80,103 @@ def __init__(self):\n \n     def add_to_params(self, parameters, value):\n         if value is not None:\n-            caller_reference = 'cli-%s-%s' % (\n-                int(time.time()), random.randint(1, 1000000))\n             parameters['InvalidationBatch'] = {\n-                \"CallerReference\": caller_reference,\n+                \"CallerReference\": unique_string(),\n                 \"Paths\": {\"Quantity\": len(value), \"Items\": value},\n                 }\n \n \n+class ExclusiveArgument(CustomArgument):\n+    DOC = '%s This argument and --%s are mututally exclusive.'\n+\n+    def __init__(self, name, argument_table,\n+                 exclusive_to='distribution-config', help_text=''):\n+        argument_table[exclusive_to].required = False\n+        super(ExclusiveArgument, self).__init__(\n+            name, help_text=self.DOC % (help_text, exclusive_to))\n+\n+    def distribution_config_template(self):\n+        return {\n+            \"CallerReference\": unique_string(),\n+            \"Origins\": {\"Quantity\": 0, \"Items\": []},\n+            \"DefaultCacheBehavior\": {\n+                \"TargetOriginId\": \"placeholder\",\n+                \"ForwardedValues\": {\n+                    \"QueryString\": False,\n+                    \"Cookies\": {\"Forward\": \"none\"},\n+                },\n+                \"TrustedSigners\": {\n+                    \"Enabled\": False,\n+                    \"Quantity\": 0\n+                },\n+                \"ViewerProtocolPolicy\": \"allow-all\",\n+                \"MinTTL\": 0\n+            },\n+            \"Enabled\": True,\n+            \"Comment\": \"\",\n+        }\n+\n+\n+class OriginDomainName(ExclusiveArgument):\n+    def __init__(self, argument_table):\n+        super(OriginDomainName, self).__init__(\n+            'origin-domain-name', argument_table,\n+            help_text='The domain name for your origin.')\n+\n+    def add_to_params(self, parameters, value):\n+        if value is None:\n+            return\n+        parameters.setdefault(\n+            'DistributionConfig', self.distribution_config_template())\n+        origin_id = unique_string(prefix=value)\n+        item = {\"Id\": origin_id, \"DomainName\": value, \"OriginPath\": ''}\n+        if item['DomainName'].endswith('.s3.amazonaws.com'):\n+            # We do not need to detect '.s3[\\w-].amazonaws.com' as S3 buckets,\n+            # because CloudFront treats GovCloud S3 buckets as custom domain.\n+            # http://docs.aws.amazon.com/govcloud-us/latest/UserGuide/setting-up-cloudfront.html\n+            item[\"S3OriginConfig\"] = {\"OriginAccessIdentity\": \"\"}\n+        else:\n+            item[\"CustomOriginConfig\"] = {\n+                'HTTPPort': 80, 'HTTPSPort': 443,\n+                'OriginProtocolPolicy': 'http-only'}\n+        parameters['DistributionConfig']['Origins'] = {\n+            \"Quantity\": 1, \"Items\": [item]}\n+        parameters['DistributionConfig']['DefaultCacheBehavior'][\n+            'TargetOriginId'] = origin_id\n+\n+\n+class CreateDefaultRootObject(ExclusiveArgument):\n+    def __init__(self, argument_table):\n+        super(CreateDefaultRootObject, self).__init__(\n+            'default-root-object', argument_table, help_text=(\n+                'The object that you want CloudFront to return (for example, '\n+                'index.html) when a viewer request points to your root URL.'))\n+\n+    def add_to_params(self, parameters, value):\n+        if value is not None:\n+            parameters.setdefault(\n+                'DistributionConfig', self.distribution_config_template())\n+            parameters['DistributionConfig']['DefaultRootObject'] = value\n+\n+\n+class UpdateDefaultRootObject(CreateDefaultRootObject):","path":"awscli/customizations/cloudfront.py","position":123,"original_position":123,"commit_id":"6dd38e49cf9670728306a0ae23bdc31f78d19ef4","original_commit_id":"6dd38e49cf9670728306a0ae23bdc31f78d19ef4","user":{"login":"jamesls","id":368057,"avatar_url":"https://avatars.githubusercontent.com/u/368057?v=3","gravatar_id":"","url":"https://api.github.com/users/jamesls","html_url":"https://github.com/jamesls","followers_url":"https://api.github.com/users/jamesls/followers","following_url":"https://api.github.com/users/jamesls/following{/other_user}","gists_url":"https://api.github.com/users/jamesls/gists{/gist_id}","starred_url":"https://api.github.com/users/jamesls/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jamesls/subscriptions","organizations_url":"https://api.github.com/users/jamesls/orgs","repos_url":"https://api.github.com/users/jamesls/repos","events_url":"https://api.github.com/users/jamesls/events{/privacy}","received_events_url":"https://api.github.com/users/jamesls/received_events","type":"User","site_admin":false},"body":"Can we update the docs for this to say that if you don't provide `distribution-config` we'll make a `get-distribution-config` call?","created_at":"2016-01-21T20:41:10Z","updated_at":"2016-01-21T20:41:10Z","html_url":"https://github.com/aws/aws-cli/pull/1736#discussion_r50460542","pull_request_url":"https://api.github.com/repos/aws/aws-cli/pulls/1736","_links":{"self":{"href":"https://api.github.com/repos/aws/aws-cli/pulls/comments/50460542"},"html":{"href":"https://github.com/aws/aws-cli/pull/1736#discussion_r50460542"},"pull_request":{"href":"https://api.github.com/repos/aws/aws-cli/pulls/1736"}}},"pull_request":{"url":"https://api.github.com/repos/aws/aws-cli/pulls/1736","id":56448632,"html_url":"https://github.com/aws/aws-cli/pull/1736","diff_url":"https://github.com/aws/aws-cli/pull/1736.diff","patch_url":"https://github.com/aws/aws-cli/pull/1736.patch","issue_url":"https://api.github.com/repos/aws/aws-cli/issues/1736","number":1736,"state":"open","locked":false,"title":"Cloudfront create-distribution and update-distribution customization","user":{"login":"rayluo","id":821550,"avatar_url":"https://avatars.githubusercontent.com/u/821550?v=3","gravatar_id":"","url":"https://api.github.com/users/rayluo","html_url":"https://github.com/rayluo","followers_url":"https://api.github.com/users/rayluo/followers","following_url":"https://api.github.com/users/rayluo/following{/other_user}","gists_url":"https://api.github.com/users/rayluo/gists{/gist_id}","starred_url":"https://api.github.com/users/rayluo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rayluo/subscriptions","organizations_url":"https://api.github.com/users/rayluo/orgs","repos_url":"https://api.github.com/users/rayluo/repos","events_url":"https://api.github.com/users/rayluo/events{/privacy}","received_events_url":"https://api.github.com/users/rayluo/received_events","type":"User","site_admin":false},"body":"Implement a new optional `--origin-domain-name` parameter and `--default-root-object` for `aws cloudfront create-distribution`. The following command shows an example for an S3 domain::\r\n\r\n    aws cloudfront create-distribution \\\r\n      --origin-domain-name my-bucket.s3.amazonaws.com --default-root-object index.html\r\n\r\nImplement a new optional `--default-root-object` parameter for `aws cloudfront update-distribution`. The following command shows an example for changing default root object::\r\n\r\n    aws cloudfront update-distribution --default-root-object index.html\r\n\r\nExample in `aws cloudfront create-distribution help` and `aws cloudfront update-distribution help` has also been updated to reflect the new parameters.\r\n\r\nThis PR replaces #1728 and #1731.","created_at":"2016-01-19T10:44:42Z","updated_at":"2016-01-21T20:41:10Z","closed_at":null,"merged_at":null,"merge_commit_sha":"37bff3a39c82ef77e559a820a495e0a5fd297f14","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/aws/aws-cli/pulls/1736/commits","review_comments_url":"https://api.github.com/repos/aws/aws-cli/pulls/1736/comments","review_comment_url":"https://api.github.com/repos/aws/aws-cli/pulls/comments{/number}","comments_url":"https://api.github.com/repos/aws/aws-cli/issues/1736/comments","statuses_url":"https://api.github.com/repos/aws/aws-cli/statuses/6dd38e49cf9670728306a0ae23bdc31f78d19ef4","head":{"label":"rayluo:cloudfront-create-update","ref":"cloudfront-create-update","sha":"6dd38e49cf9670728306a0ae23bdc31f78d19ef4","user":{"login":"rayluo","id":821550,"avatar_url":"https://avatars.githubusercontent.com/u/821550?v=3","gravatar_id":"","url":"https://api.github.com/users/rayluo","html_url":"https://github.com/rayluo","followers_url":"https://api.github.com/users/rayluo/followers","following_url":"https://api.github.com/users/rayluo/following{/other_user}","gists_url":"https://api.github.com/users/rayluo/gists{/gist_id}","starred_url":"https://api.github.com/users/rayluo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rayluo/subscriptions","organizations_url":"https://api.github.com/users/rayluo/orgs","repos_url":"https://api.github.com/users/rayluo/repos","events_url":"https://api.github.com/users/rayluo/events{/privacy}","received_events_url":"https://api.github.com/users/rayluo/received_events","type":"User","site_admin":false},"repo":{"id":38785763,"name":"aws-cli","full_name":"rayluo/aws-cli","owner":{"login":"rayluo","id":821550,"avatar_url":"https://avatars.githubusercontent.com/u/821550?v=3","gravatar_id":"","url":"https://api.github.com/users/rayluo","html_url":"https://github.com/rayluo","followers_url":"https://api.github.com/users/rayluo/followers","following_url":"https://api.github.com/users/rayluo/following{/other_user}","gists_url":"https://api.github.com/users/rayluo/gists{/gist_id}","starred_url":"https://api.github.com/users/rayluo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rayluo/subscriptions","organizations_url":"https://api.github.com/users/rayluo/orgs","repos_url":"https://api.github.com/users/rayluo/repos","events_url":"https://api.github.com/users/rayluo/events{/privacy}","received_events_url":"https://api.github.com/users/rayluo/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/rayluo/aws-cli","description":"Universal Command Line Interface for Amazon Web Services","fork":true,"url":"https://api.github.com/repos/rayluo/aws-cli","forks_url":"https://api.github.com/repos/rayluo/aws-cli/forks","keys_url":"https://api.github.com/repos/rayluo/aws-cli/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rayluo/aws-cli/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rayluo/aws-cli/teams","hooks_url":"https://api.github.com/repos/rayluo/aws-cli/hooks","issue_events_url":"https://api.github.com/repos/rayluo/aws-cli/issues/events{/number}","events_url":"https://api.github.com/repos/rayluo/aws-cli/events","assignees_url":"https://api.github.com/repos/rayluo/aws-cli/assignees{/user}","branches_url":"https://api.github.com/repos/rayluo/aws-cli/branches{/branch}","tags_url":"https://api.github.com/repos/rayluo/aws-cli/tags","blobs_url":"https://api.github.com/repos/rayluo/aws-cli/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rayluo/aws-cli/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rayluo/aws-cli/git/refs{/sha}","trees_url":"https://api.github.com/repos/rayluo/aws-cli/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rayluo/aws-cli/statuses/{sha}","languages_url":"https://api.github.com/repos/rayluo/aws-cli/languages","stargazers_url":"https://api.github.com/repos/rayluo/aws-cli/stargazers","contributors_url":"https://api.github.com/repos/rayluo/aws-cli/contributors","subscribers_url":"https://api.github.com/repos/rayluo/aws-cli/subscribers","subscription_url":"https://api.github.com/repos/rayluo/aws-cli/subscription","commits_url":"https://api.github.com/repos/rayluo/aws-cli/commits{/sha}","git_commits_url":"https://api.github.com/repos/rayluo/aws-cli/git/commits{/sha}","comments_url":"https://api.github.com/repos/rayluo/aws-cli/comments{/number}","issue_comment_url":"https://api.github.com/repos/rayluo/aws-cli/issues/comments{/number}","contents_url":"https://api.github.com/repos/rayluo/aws-cli/contents/{+path}","compare_url":"https://api.github.com/repos/rayluo/aws-cli/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rayluo/aws-cli/merges","archive_url":"https://api.github.com/repos/rayluo/aws-cli/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rayluo/aws-cli/downloads","issues_url":"https://api.github.com/repos/rayluo/aws-cli/issues{/number}","pulls_url":"https://api.github.com/repos/rayluo/aws-cli/pulls{/number}","milestones_url":"https://api.github.com/repos/rayluo/aws-cli/milestones{/number}","notifications_url":"https://api.github.com/repos/rayluo/aws-cli/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rayluo/aws-cli/labels{/name}","releases_url":"https://api.github.com/repos/rayluo/aws-cli/releases{/id}","created_at":"2015-07-08T23:39:35Z","updated_at":"2015-07-08T23:39:38Z","pushed_at":"2016-01-21T15:48:51Z","git_url":"git://github.com/rayluo/aws-cli.git","ssh_url":"git@github.com:rayluo/aws-cli.git","clone_url":"https://github.com/rayluo/aws-cli.git","svn_url":"https://github.com/rayluo/aws-cli","homepage":null,"size":7726,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"develop"}},"base":{"label":"aws:develop","ref":"develop","sha":"db6021bab355b718a57eaf14ae09ebf53013db21","user":{"login":"aws","id":2232217,"avatar_url":"https://avatars.githubusercontent.com/u/2232217?v=3","gravatar_id":"","url":"https://api.github.com/users/aws","html_url":"https://github.com/aws","followers_url":"https://api.github.com/users/aws/followers","following_url":"https://api.github.com/users/aws/following{/other_user}","gists_url":"https://api.github.com/users/aws/gists{/gist_id}","starred_url":"https://api.github.com/users/aws/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aws/subscriptions","organizations_url":"https://api.github.com/users/aws/orgs","repos_url":"https://api.github.com/users/aws/repos","events_url":"https://api.github.com/users/aws/events{/privacy}","received_events_url":"https://api.github.com/users/aws/received_events","type":"Organization","site_admin":false},"repo":{"id":6780767,"name":"aws-cli","full_name":"aws/aws-cli","owner":{"login":"aws","id":2232217,"avatar_url":"https://avatars.githubusercontent.com/u/2232217?v=3","gravatar_id":"","url":"https://api.github.com/users/aws","html_url":"https://github.com/aws","followers_url":"https://api.github.com/users/aws/followers","following_url":"https://api.github.com/users/aws/following{/other_user}","gists_url":"https://api.github.com/users/aws/gists{/gist_id}","starred_url":"https://api.github.com/users/aws/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aws/subscriptions","organizations_url":"https://api.github.com/users/aws/orgs","repos_url":"https://api.github.com/users/aws/repos","events_url":"https://api.github.com/users/aws/events{/privacy}","received_events_url":"https://api.github.com/users/aws/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/aws/aws-cli","description":"Universal Command Line Interface for Amazon Web Services","fork":false,"url":"https://api.github.com/repos/aws/aws-cli","forks_url":"https://api.github.com/repos/aws/aws-cli/forks","keys_url":"https://api.github.com/repos/aws/aws-cli/keys{/key_id}","collaborators_url":"https://api.github.com/repos/aws/aws-cli/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/aws/aws-cli/teams","hooks_url":"https://api.github.com/repos/aws/aws-cli/hooks","issue_events_url":"https://api.github.com/repos/aws/aws-cli/issues/events{/number}","events_url":"https://api.github.com/repos/aws/aws-cli/events","assignees_url":"https://api.github.com/repos/aws/aws-cli/assignees{/user}","branches_url":"https://api.github.com/repos/aws/aws-cli/branches{/branch}","tags_url":"https://api.github.com/repos/aws/aws-cli/tags","blobs_url":"https://api.github.com/repos/aws/aws-cli/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/aws/aws-cli/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/aws/aws-cli/git/refs{/sha}","trees_url":"https://api.github.com/repos/aws/aws-cli/git/trees{/sha}","statuses_url":"https://api.github.com/repos/aws/aws-cli/statuses/{sha}","languages_url":"https://api.github.com/repos/aws/aws-cli/languages","stargazers_url":"https://api.github.com/repos/aws/aws-cli/stargazers","contributors_url":"https://api.github.com/repos/aws/aws-cli/contributors","subscribers_url":"https://api.github.com/repos/aws/aws-cli/subscribers","subscription_url":"https://api.github.com/repos/aws/aws-cli/subscription","commits_url":"https://api.github.com/repos/aws/aws-cli/commits{/sha}","git_commits_url":"https://api.github.com/repos/aws/aws-cli/git/commits{/sha}","comments_url":"https://api.github.com/repos/aws/aws-cli/comments{/number}","issue_comment_url":"https://api.github.com/repos/aws/aws-cli/issues/comments{/number}","contents_url":"https://api.github.com/repos/aws/aws-cli/contents/{+path}","compare_url":"https://api.github.com/repos/aws/aws-cli/compare/{base}...{head}","merges_url":"https://api.github.com/repos/aws/aws-cli/merges","archive_url":"https://api.github.com/repos/aws/aws-cli/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/aws/aws-cli/downloads","issues_url":"https://api.github.com/repos/aws/aws-cli/issues{/number}","pulls_url":"https://api.github.com/repos/aws/aws-cli/pulls{/number}","milestones_url":"https://api.github.com/repos/aws/aws-cli/milestones{/number}","notifications_url":"https://api.github.com/repos/aws/aws-cli/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/aws/aws-cli/labels{/name}","releases_url":"https://api.github.com/repos/aws/aws-cli/releases{/id}","created_at":"2012-11-20T16:07:36Z","updated_at":"2016-01-21T07:45:30Z","pushed_at":"2016-01-21T15:48:53Z","git_url":"git://github.com/aws/aws-cli.git","ssh_url":"git@github.com:aws/aws-cli.git","clone_url":"https://github.com/aws/aws-cli.git","svn_url":"https://github.com/aws/aws-cli","homepage":null,"size":10674,"stargazers_count":3503,"watchers_count":3503,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":504,"mirror_url":null,"open_issues_count":152,"forks":504,"open_issues":152,"watchers":3503,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/aws/aws-cli/pulls/1736"},"html":{"href":"https://github.com/aws/aws-cli/pull/1736"},"issue":{"href":"https://api.github.com/repos/aws/aws-cli/issues/1736"},"comments":{"href":"https://api.github.com/repos/aws/aws-cli/issues/1736/comments"},"review_comments":{"href":"https://api.github.com/repos/aws/aws-cli/pulls/1736/comments"},"review_comment":{"href":"https://api.github.com/repos/aws/aws-cli/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/aws/aws-cli/pulls/1736/commits"},"statuses":{"href":"https://api.github.com/repos/aws/aws-cli/statuses/6dd38e49cf9670728306a0ae23bdc31f78d19ef4"}}}}