{"action":"created","comment":{"url":"https://api.github.com/repos/Azure/azure-cli/pulls/comments/72831798","id":72831798,"diff_hunk":"@@ -150,3 +151,201 @@ def required_values_validator(namespace):\n     APPLICATION.remove(APPLICATION.COMMAND_TABLE_LOADED, add_id_parameters)\n \n APPLICATION.register(APPLICATION.COMMAND_TABLE_LOADED, add_id_parameters)\n+\n+def register_generic_update(name, getter, setter, setter_arg_name='parameters'):\n+    from msrestazure.azure_operation import AzureOperationPoller\n+    from azure.cli.commands import CliCommand, command_table\n+    from azure.cli.commands._introspection import extract_args_from_signature\n+\n+    get_arguments = dict(extract_args_from_signature(getter))\n+    set_arguments = dict(extract_args_from_signature(setter))\n+\n+    def handler(args):\n+        ordered_arguments = args.pop('ordered_arguments')\n+\n+        getterargs = {key: val for key, val in args.items()\n+                      if key in get_arguments}\n+        instance = getter(**getterargs)\n+\n+        # Update properties\n+        for arg in ordered_arguments:\n+            arg_type, expressions = arg\n+            if arg_type == '--set':\n+                try:\n+                    for expression in expressions:\n+                        set_properties(instance, expression)\n+                except ValueError:\n+                    raise CLIError('--set should be of the form:'\n+                                   ' --set property.property=<value>'\n+                                   ' property2.property=<value>')","path":"src/azure/cli/commands/arm.py","position":38,"original_position":38,"commit_id":"3151d190f348cfc7a5faffb926c112836bb2923b","original_commit_id":"aba9dba46118b6cefa5ae332be9f18acb29859b7","user":{"login":"johanste","id":15110018,"avatar_url":"https://avatars.githubusercontent.com/u/15110018?v=3","gravatar_id":"","url":"https://api.github.com/users/johanste","html_url":"https://github.com/johanste","followers_url":"https://api.github.com/users/johanste/followers","following_url":"https://api.github.com/users/johanste/following{/other_user}","gists_url":"https://api.github.com/users/johanste/gists{/gist_id}","starred_url":"https://api.github.com/users/johanste/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/johanste/subscriptions","organizations_url":"https://api.github.com/users/johanste/orgs","repos_url":"https://api.github.com/users/johanste/repos","events_url":"https://api.github.com/users/johanste/events{/privacy}","received_events_url":"https://api.github.com/users/johanste/received_events","type":"User","site_admin":false},"body":"Verifying that this  is probably better done in a type parameter for the set argument. The less parameter processing that has to be done in the handler itself, the better...","created_at":"2016-07-29T17:43:06Z","updated_at":"2016-07-29T17:43:06Z","html_url":"https://github.com/Azure/azure-cli/pull/558#discussion_r72831798","pull_request_url":"https://api.github.com/repos/Azure/azure-cli/pulls/558","_links":{"self":{"href":"https://api.github.com/repos/Azure/azure-cli/pulls/comments/72831798"},"html":{"href":"https://github.com/Azure/azure-cli/pull/558#discussion_r72831798"},"pull_request":{"href":"https://api.github.com/repos/Azure/azure-cli/pulls/558"}}},"pull_request":{"url":"https://api.github.com/repos/Azure/azure-cli/pulls/558","id":79113196,"html_url":"https://github.com/Azure/azure-cli/pull/558","diff_url":"https://github.com/Azure/azure-cli/pull/558.diff","patch_url":"https://github.com/Azure/azure-cli/pull/558.patch","issue_url":"https://api.github.com/repos/Azure/azure-cli/issues/558","number":558,"state":"open","locked":false,"title":"Generic Update Command support.  ","user":{"login":"BurtBiel","id":10136041,"avatar_url":"https://avatars.githubusercontent.com/u/10136041?v=3","gravatar_id":"","url":"https://api.github.com/users/BurtBiel","html_url":"https://github.com/BurtBiel","followers_url":"https://api.github.com/users/BurtBiel/followers","following_url":"https://api.github.com/users/BurtBiel/following{/other_user}","gists_url":"https://api.github.com/users/BurtBiel/gists{/gist_id}","starred_url":"https://api.github.com/users/BurtBiel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BurtBiel/subscriptions","organizations_url":"https://api.github.com/users/BurtBiel/orgs","repos_url":"https://api.github.com/users/BurtBiel/repos","events_url":"https://api.github.com/users/BurtBiel/events{/privacy}","received_events_url":"https://api.github.com/users/BurtBiel/received_events","type":"User","site_admin":false},"body":"Allows an update command to be registered, which then updates fields with a generic\r\nset/add/remove syntax.  I added az vm update along with the infrastructure.\r\n\r\n```\r\nCommand\r\n    az vm update: Update VM properties.\r\n        Update VM objects and properties using paths that correspond to 'az vm show'.  See examples.\r\n\r\nArguments\r\n    --add              : Add an object to a list of objects by specifying a path and key value\r\n                         pairs.  Example: --add property1.list id=<id>.\r\n    --api-version      : Client Api Version.  Default: 2016-03-30.\r\n    --expand           : The expand expression to apply on the operation.\r\n    --ids              : ID of resource.\r\n    --name -n          : The name of the virtual machine.\r\n    --remove           : Remove a property or an element from a list.  Example: --remove\r\n                         property1.list <index>.\r\n    --resource-group -g: Name of resource group.\r\n    --set              : Update an object by specifying a property path and value to set.  Example:\r\n                         --set property1.property2=value.\r\n\r\nGlobal Arguments\r\n    --debug            : Increase logging verbosity to show all debug logs.\r\n    --help -h          : Show this help message and exit.\r\n    --output -o        : Output format.  Allowed values: json, tsv, list.  Default: json.\r\n    --query            : JMESPath query string. See http://jmespath.org/ for more information and\r\n                         examples.\r\n    --verbose          : Increase logging verbosity. Use --debug for full debug logs.\r\n\r\nExamples\r\n    Add or update a tag\r\n        az <command> -n name -g group --set tags.tagName=tagValue\r\n    Remove a tag\r\n        az <command> -n name -g group --remove tags.tagName\r\n    Set primary NIC\r\n        az <command> -n name -g group --set network_profile.network_interfaces[1].primary=false\r\n        network_profile.network_interfaces[0].primary=true\r\n    Add new non-primary NIC\r\n        az <command> -n name -g group --add network_profile.network_interfaces primary=false\r\n        id=<NIC_ID>\r\n    Remove fourth NIC\r\n        az <command> -n name -g group --remove network_profile.network_interfaces 3\r\n```","created_at":"2016-07-27T23:08:57Z","updated_at":"2016-07-29T17:43:06Z","closed_at":null,"merged_at":null,"merge_commit_sha":"983eee43f686abbdc8f3ce39e6e38e3220987e3b","assignee":{"login":"johanste","id":15110018,"avatar_url":"https://avatars.githubusercontent.com/u/15110018?v=3","gravatar_id":"","url":"https://api.github.com/users/johanste","html_url":"https://github.com/johanste","followers_url":"https://api.github.com/users/johanste/followers","following_url":"https://api.github.com/users/johanste/following{/other_user}","gists_url":"https://api.github.com/users/johanste/gists{/gist_id}","starred_url":"https://api.github.com/users/johanste/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/johanste/subscriptions","organizations_url":"https://api.github.com/users/johanste/orgs","repos_url":"https://api.github.com/users/johanste/repos","events_url":"https://api.github.com/users/johanste/events{/privacy}","received_events_url":"https://api.github.com/users/johanste/received_events","type":"User","site_admin":false},"assignees":[{"login":"johanste","id":15110018,"avatar_url":"https://avatars.githubusercontent.com/u/15110018?v=3","gravatar_id":"","url":"https://api.github.com/users/johanste","html_url":"https://github.com/johanste","followers_url":"https://api.github.com/users/johanste/followers","following_url":"https://api.github.com/users/johanste/following{/other_user}","gists_url":"https://api.github.com/users/johanste/gists{/gist_id}","starred_url":"https://api.github.com/users/johanste/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/johanste/subscriptions","organizations_url":"https://api.github.com/users/johanste/orgs","repos_url":"https://api.github.com/users/johanste/repos","events_url":"https://api.github.com/users/johanste/events{/privacy}","received_events_url":"https://api.github.com/users/johanste/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/Azure/azure-cli/pulls/558/commits","review_comments_url":"https://api.github.com/repos/Azure/azure-cli/pulls/558/comments","review_comment_url":"https://api.github.com/repos/Azure/azure-cli/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Azure/azure-cli/issues/558/comments","statuses_url":"https://api.github.com/repos/Azure/azure-cli/statuses/3151d190f348cfc7a5faffb926c112836bb2923b","head":{"label":"BurtBiel:commands/GenericUpdate","ref":"commands/GenericUpdate","sha":"3151d190f348cfc7a5faffb926c112836bb2923b","user":{"login":"BurtBiel","id":10136041,"avatar_url":"https://avatars.githubusercontent.com/u/10136041?v=3","gravatar_id":"","url":"https://api.github.com/users/BurtBiel","html_url":"https://github.com/BurtBiel","followers_url":"https://api.github.com/users/BurtBiel/followers","following_url":"https://api.github.com/users/BurtBiel/following{/other_user}","gists_url":"https://api.github.com/users/BurtBiel/gists{/gist_id}","starred_url":"https://api.github.com/users/BurtBiel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BurtBiel/subscriptions","organizations_url":"https://api.github.com/users/BurtBiel/orgs","repos_url":"https://api.github.com/users/BurtBiel/repos","events_url":"https://api.github.com/users/BurtBiel/events{/privacy}","received_events_url":"https://api.github.com/users/BurtBiel/received_events","type":"User","site_admin":false},"repo":{"id":64347252,"name":"azure-cli","full_name":"BurtBiel/azure-cli","owner":{"login":"BurtBiel","id":10136041,"avatar_url":"https://avatars.githubusercontent.com/u/10136041?v=3","gravatar_id":"","url":"https://api.github.com/users/BurtBiel","html_url":"https://github.com/BurtBiel","followers_url":"https://api.github.com/users/BurtBiel/followers","following_url":"https://api.github.com/users/BurtBiel/following{/other_user}","gists_url":"https://api.github.com/users/BurtBiel/gists{/gist_id}","starred_url":"https://api.github.com/users/BurtBiel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BurtBiel/subscriptions","organizations_url":"https://api.github.com/users/BurtBiel/orgs","repos_url":"https://api.github.com/users/BurtBiel/repos","events_url":"https://api.github.com/users/BurtBiel/events{/privacy}","received_events_url":"https://api.github.com/users/BurtBiel/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/BurtBiel/azure-cli","description":"Command-line tools for Azure.","fork":true,"url":"https://api.github.com/repos/BurtBiel/azure-cli","forks_url":"https://api.github.com/repos/BurtBiel/azure-cli/forks","keys_url":"https://api.github.com/repos/BurtBiel/azure-cli/keys{/key_id}","collaborators_url":"https://api.github.com/repos/BurtBiel/azure-cli/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/BurtBiel/azure-cli/teams","hooks_url":"https://api.github.com/repos/BurtBiel/azure-cli/hooks","issue_events_url":"https://api.github.com/repos/BurtBiel/azure-cli/issues/events{/number}","events_url":"https://api.github.com/repos/BurtBiel/azure-cli/events","assignees_url":"https://api.github.com/repos/BurtBiel/azure-cli/assignees{/user}","branches_url":"https://api.github.com/repos/BurtBiel/azure-cli/branches{/branch}","tags_url":"https://api.github.com/repos/BurtBiel/azure-cli/tags","blobs_url":"https://api.github.com/repos/BurtBiel/azure-cli/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/BurtBiel/azure-cli/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/BurtBiel/azure-cli/git/refs{/sha}","trees_url":"https://api.github.com/repos/BurtBiel/azure-cli/git/trees{/sha}","statuses_url":"https://api.github.com/repos/BurtBiel/azure-cli/statuses/{sha}","languages_url":"https://api.github.com/repos/BurtBiel/azure-cli/languages","stargazers_url":"https://api.github.com/repos/BurtBiel/azure-cli/stargazers","contributors_url":"https://api.github.com/repos/BurtBiel/azure-cli/contributors","subscribers_url":"https://api.github.com/repos/BurtBiel/azure-cli/subscribers","subscription_url":"https://api.github.com/repos/BurtBiel/azure-cli/subscription","commits_url":"https://api.github.com/repos/BurtBiel/azure-cli/commits{/sha}","git_commits_url":"https://api.github.com/repos/BurtBiel/azure-cli/git/commits{/sha}","comments_url":"https://api.github.com/repos/BurtBiel/azure-cli/comments{/number}","issue_comment_url":"https://api.github.com/repos/BurtBiel/azure-cli/issues/comments{/number}","contents_url":"https://api.github.com/repos/BurtBiel/azure-cli/contents/{+path}","compare_url":"https://api.github.com/repos/BurtBiel/azure-cli/compare/{base}...{head}","merges_url":"https://api.github.com/repos/BurtBiel/azure-cli/merges","archive_url":"https://api.github.com/repos/BurtBiel/azure-cli/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/BurtBiel/azure-cli/downloads","issues_url":"https://api.github.com/repos/BurtBiel/azure-cli/issues{/number}","pulls_url":"https://api.github.com/repos/BurtBiel/azure-cli/pulls{/number}","milestones_url":"https://api.github.com/repos/BurtBiel/azure-cli/milestones{/number}","notifications_url":"https://api.github.com/repos/BurtBiel/azure-cli/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/BurtBiel/azure-cli/labels{/name}","releases_url":"https://api.github.com/repos/BurtBiel/azure-cli/releases{/id}","deployments_url":"https://api.github.com/repos/BurtBiel/azure-cli/deployments","created_at":"2016-07-27T23:00:27Z","updated_at":"2016-07-27T23:00:30Z","pushed_at":"2016-07-29T17:36:47Z","git_url":"git://github.com/BurtBiel/azure-cli.git","ssh_url":"git@github.com:BurtBiel/azure-cli.git","clone_url":"https://github.com/BurtBiel/azure-cli.git","svn_url":"https://github.com/BurtBiel/azure-cli","homepage":null,"size":5392,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"Azure:master","ref":"master","sha":"9258a86c0087c3ee59bb59c8c92237b2c85f1668","user":{"login":"Azure","id":6844498,"avatar_url":"https://avatars.githubusercontent.com/u/6844498?v=3","gravatar_id":"","url":"https://api.github.com/users/Azure","html_url":"https://github.com/Azure","followers_url":"https://api.github.com/users/Azure/followers","following_url":"https://api.github.com/users/Azure/following{/other_user}","gists_url":"https://api.github.com/users/Azure/gists{/gist_id}","starred_url":"https://api.github.com/users/Azure/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Azure/subscriptions","organizations_url":"https://api.github.com/users/Azure/orgs","repos_url":"https://api.github.com/users/Azure/repos","events_url":"https://api.github.com/users/Azure/events{/privacy}","received_events_url":"https://api.github.com/users/Azure/received_events","type":"Organization","site_admin":false},"repo":{"id":51040886,"name":"azure-cli","full_name":"Azure/azure-cli","owner":{"login":"Azure","id":6844498,"avatar_url":"https://avatars.githubusercontent.com/u/6844498?v=3","gravatar_id":"","url":"https://api.github.com/users/Azure","html_url":"https://github.com/Azure","followers_url":"https://api.github.com/users/Azure/followers","following_url":"https://api.github.com/users/Azure/following{/other_user}","gists_url":"https://api.github.com/users/Azure/gists{/gist_id}","starred_url":"https://api.github.com/users/Azure/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Azure/subscriptions","organizations_url":"https://api.github.com/users/Azure/orgs","repos_url":"https://api.github.com/users/Azure/repos","events_url":"https://api.github.com/users/Azure/events{/privacy}","received_events_url":"https://api.github.com/users/Azure/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Azure/azure-cli","description":"Command-line tools for Azure.","fork":false,"url":"https://api.github.com/repos/Azure/azure-cli","forks_url":"https://api.github.com/repos/Azure/azure-cli/forks","keys_url":"https://api.github.com/repos/Azure/azure-cli/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Azure/azure-cli/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Azure/azure-cli/teams","hooks_url":"https://api.github.com/repos/Azure/azure-cli/hooks","issue_events_url":"https://api.github.com/repos/Azure/azure-cli/issues/events{/number}","events_url":"https://api.github.com/repos/Azure/azure-cli/events","assignees_url":"https://api.github.com/repos/Azure/azure-cli/assignees{/user}","branches_url":"https://api.github.com/repos/Azure/azure-cli/branches{/branch}","tags_url":"https://api.github.com/repos/Azure/azure-cli/tags","blobs_url":"https://api.github.com/repos/Azure/azure-cli/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Azure/azure-cli/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Azure/azure-cli/git/refs{/sha}","trees_url":"https://api.github.com/repos/Azure/azure-cli/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Azure/azure-cli/statuses/{sha}","languages_url":"https://api.github.com/repos/Azure/azure-cli/languages","stargazers_url":"https://api.github.com/repos/Azure/azure-cli/stargazers","contributors_url":"https://api.github.com/repos/Azure/azure-cli/contributors","subscribers_url":"https://api.github.com/repos/Azure/azure-cli/subscribers","subscription_url":"https://api.github.com/repos/Azure/azure-cli/subscription","commits_url":"https://api.github.com/repos/Azure/azure-cli/commits{/sha}","git_commits_url":"https://api.github.com/repos/Azure/azure-cli/git/commits{/sha}","comments_url":"https://api.github.com/repos/Azure/azure-cli/comments{/number}","issue_comment_url":"https://api.github.com/repos/Azure/azure-cli/issues/comments{/number}","contents_url":"https://api.github.com/repos/Azure/azure-cli/contents/{+path}","compare_url":"https://api.github.com/repos/Azure/azure-cli/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Azure/azure-cli/merges","archive_url":"https://api.github.com/repos/Azure/azure-cli/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Azure/azure-cli/downloads","issues_url":"https://api.github.com/repos/Azure/azure-cli/issues{/number}","pulls_url":"https://api.github.com/repos/Azure/azure-cli/pulls{/number}","milestones_url":"https://api.github.com/repos/Azure/azure-cli/milestones{/number}","notifications_url":"https://api.github.com/repos/Azure/azure-cli/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Azure/azure-cli/labels{/name}","releases_url":"https://api.github.com/repos/Azure/azure-cli/releases{/id}","deployments_url":"https://api.github.com/repos/Azure/azure-cli/deployments","created_at":"2016-02-04T00:21:51Z","updated_at":"2016-07-29T14:49:41Z","pushed_at":"2016-07-29T17:36:48Z","git_url":"git://github.com/Azure/azure-cli.git","ssh_url":"git@github.com:Azure/azure-cli.git","clone_url":"https://github.com/Azure/azure-cli.git","svn_url":"https://github.com/Azure/azure-cli","homepage":null,"size":8186,"stargazers_count":7,"watchers_count":7,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":7,"mirror_url":null,"open_issues_count":81,"forks":7,"open_issues":81,"watchers":7,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Azure/azure-cli/pulls/558"},"html":{"href":"https://github.com/Azure/azure-cli/pull/558"},"issue":{"href":"https://api.github.com/repos/Azure/azure-cli/issues/558"},"comments":{"href":"https://api.github.com/repos/Azure/azure-cli/issues/558/comments"},"review_comments":{"href":"https://api.github.com/repos/Azure/azure-cli/pulls/558/comments"},"review_comment":{"href":"https://api.github.com/repos/Azure/azure-cli/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Azure/azure-cli/pulls/558/commits"},"statuses":{"href":"https://api.github.com/repos/Azure/azure-cli/statuses/3151d190f348cfc7a5faffb926c112836bb2923b"}}}}
{"actor":{"display_login":"johanste"}}