{"action":"created","comment":{"url":"https://api.github.com/repos/TheJumpCloud/jcapi/pulls/comments/28170226","id":28170226,"diff_hunk":"@@ -0,0 +1,261 @@\n+package main\n+\n+import (\n+    \"fmt\"\n+    \"flag\"\n+    \"encoding/csv\"\n+    \"os\"\n+    \"io\"\n+    \"github.com/TheJumpCloud/jcapi\"\n+)\n+\n+\n+//\n+// This program will process each line (record) of a CSV file as a user\n+// import request into JumpCloud.\n+//\n+// The CSV file must have each line formatted as:\n+// \n+// first_name, last_name, USER_NAME, EMAIL, uid, gid, SUDO_FLAG, password, host_name, tag_name, admin1, admin2, ...\n+//\n+// Values shown in all lowercase are optional, while those in all uppercase\n+// are required.\n+//\n+// For each line of the CSV file, this program will:\n+//\n+// 1 - Insert the USER_NAME specified as a new JumpCloud user, if the name\n+//     does not already exist, otherwise this line will be treated as an\n+//     update to an existing user matching USER_NAME.\n+//\n+// 2 - If the password was specified, the USER_NAME will have that password\n+//     assigned to it immediately, otherwise, JumpCloud will automatically\n+//     generate an email message, delivered to the EMAIL specified, requesting\n+//     the user to provide an appropriate password for their account.\n+//\n+// 3 - The value of the SUDO_FLAG will always be applied to this user.  All\n+//     other optional values specified will be applied as appropriate.\n+//\n+// 4 - When both the host_name and tag_name are specified, a tag will be\n+//     created or updated for this USER_NAME associated with the host_name\n+//     provided.\n+//     (n.b. - if the USER_NAME already exists on the host_name in question,\n+//     specifying these values here will result in the account on host_name\n+//     being \"taken over\" by JumpCloud)\n+//\n+// 5 - Any invalid combination of values will generate an error and terminate\n+//     processing for that entry, but the program will attempt to process the\n+//     remainder of the file.\n+//\n+// 6 - A summary is printed at the conclusion of processing.","path":"examples/CSVImporter/CSVImporter.go","position":49,"original_position":49,"commit_id":"f5c73d942c4202716f429e64795d229990063247","original_commit_id":"f5c73d942c4202716f429e64795d229990063247","user":{"login":"jamesbrown7","id":5472946,"avatar_url":"https://avatars.githubusercontent.com/u/5472946?v=3","gravatar_id":"","url":"https://api.github.com/users/jamesbrown7","html_url":"https://github.com/jamesbrown7","followers_url":"https://api.github.com/users/jamesbrown7/followers","following_url":"https://api.github.com/users/jamesbrown7/following{/other_user}","gists_url":"https://api.github.com/users/jamesbrown7/gists{/gist_id}","starred_url":"https://api.github.com/users/jamesbrown7/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jamesbrown7/subscriptions","organizations_url":"https://api.github.com/users/jamesbrown7/orgs","repos_url":"https://api.github.com/users/jamesbrown7/repos","events_url":"https://api.github.com/users/jamesbrown7/events{/privacy}","received_events_url":"https://api.github.com/users/jamesbrown7/received_events","type":"User","site_admin":false},"body":"Did we end up that this is idempotent? That would be really handy for folks if they could just run it over and over (even if they get errors for already-processed items). It would also be good to call it out here.","created_at":"2015-04-10T18:45:35Z","updated_at":"2015-04-10T18:45:35Z","html_url":"https://github.com/TheJumpCloud/jcapi/pull/3#discussion_r28170226","pull_request_url":"https://api.github.com/repos/TheJumpCloud/jcapi/pulls/3","_links":{"self":{"href":"https://api.github.com/repos/TheJumpCloud/jcapi/pulls/comments/28170226"},"html":{"href":"https://github.com/TheJumpCloud/jcapi/pull/3#discussion_r28170226"},"pull_request":{"href":"https://api.github.com/repos/TheJumpCloud/jcapi/pulls/3"}}},"pull_request":{"url":"https://api.github.com/repos/TheJumpCloud/jcapi/pulls/3","id":33072252,"html_url":"https://github.com/TheJumpCloud/jcapi/pull/3","diff_url":"https://github.com/TheJumpCloud/jcapi/pull/3.diff","patch_url":"https://github.com/TheJumpCloud/jcapi/pull/3.patch","issue_url":"https://api.github.com/repos/TheJumpCloud/jcapi/issues/3","number":3,"state":"open","locked":false,"title":"Csv importer","user":{"login":"dasGitHub","id":10110795,"avatar_url":"https://avatars.githubusercontent.com/u/10110795?v=3","gravatar_id":"","url":"https://api.github.com/users/dasGitHub","html_url":"https://github.com/dasGitHub","followers_url":"https://api.github.com/users/dasGitHub/followers","following_url":"https://api.github.com/users/dasGitHub/following{/other_user}","gists_url":"https://api.github.com/users/dasGitHub/gists{/gist_id}","starred_url":"https://api.github.com/users/dasGitHub/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dasGitHub/subscriptions","organizations_url":"https://api.github.com/users/dasGitHub/orgs","repos_url":"https://api.github.com/users/dasGitHub/repos","events_url":"https://api.github.com/users/dasGitHub/events{/privacy}","received_events_url":"https://api.github.com/users/dasGitHub/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-04-10T18:40:14Z","updated_at":"2015-04-10T18:45:35Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ee2eef26d83a26a0b85bc0bed5122130c3a023e6","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/TheJumpCloud/jcapi/pulls/3/commits","review_comments_url":"https://api.github.com/repos/TheJumpCloud/jcapi/pulls/3/comments","review_comment_url":"https://api.github.com/repos/TheJumpCloud/jcapi/pulls/comments{/number}","comments_url":"https://api.github.com/repos/TheJumpCloud/jcapi/issues/3/comments","statuses_url":"https://api.github.com/repos/TheJumpCloud/jcapi/statuses/f5c73d942c4202716f429e64795d229990063247","head":{"label":"TheJumpCloud:csv_importer","ref":"csv_importer","sha":"f5c73d942c4202716f429e64795d229990063247","user":{"login":"TheJumpCloud","id":4927461,"avatar_url":"https://avatars.githubusercontent.com/u/4927461?v=3","gravatar_id":"","url":"https://api.github.com/users/TheJumpCloud","html_url":"https://github.com/TheJumpCloud","followers_url":"https://api.github.com/users/TheJumpCloud/followers","following_url":"https://api.github.com/users/TheJumpCloud/following{/other_user}","gists_url":"https://api.github.com/users/TheJumpCloud/gists{/gist_id}","starred_url":"https://api.github.com/users/TheJumpCloud/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TheJumpCloud/subscriptions","organizations_url":"https://api.github.com/users/TheJumpCloud/orgs","repos_url":"https://api.github.com/users/TheJumpCloud/repos","events_url":"https://api.github.com/users/TheJumpCloud/events{/privacy}","received_events_url":"https://api.github.com/users/TheJumpCloud/received_events","type":"Organization","site_admin":false},"repo":{"id":27883713,"name":"jcapi","full_name":"TheJumpCloud/jcapi","owner":{"login":"TheJumpCloud","id":4927461,"avatar_url":"https://avatars.githubusercontent.com/u/4927461?v=3","gravatar_id":"","url":"https://api.github.com/users/TheJumpCloud","html_url":"https://github.com/TheJumpCloud","followers_url":"https://api.github.com/users/TheJumpCloud/followers","following_url":"https://api.github.com/users/TheJumpCloud/following{/other_user}","gists_url":"https://api.github.com/users/TheJumpCloud/gists{/gist_id}","starred_url":"https://api.github.com/users/TheJumpCloud/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TheJumpCloud/subscriptions","organizations_url":"https://api.github.com/users/TheJumpCloud/orgs","repos_url":"https://api.github.com/users/TheJumpCloud/repos","events_url":"https://api.github.com/users/TheJumpCloud/events{/privacy}","received_events_url":"https://api.github.com/users/TheJumpCloud/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/TheJumpCloud/jcapi","description":"JumpCloud's Go (golang) REST API SDK","fork":false,"url":"https://api.github.com/repos/TheJumpCloud/jcapi","forks_url":"https://api.github.com/repos/TheJumpCloud/jcapi/forks","keys_url":"https://api.github.com/repos/TheJumpCloud/jcapi/keys{/key_id}","collaborators_url":"https://api.github.com/repos/TheJumpCloud/jcapi/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/TheJumpCloud/jcapi/teams","hooks_url":"https://api.github.com/repos/TheJumpCloud/jcapi/hooks","issue_events_url":"https://api.github.com/repos/TheJumpCloud/jcapi/issues/events{/number}","events_url":"https://api.github.com/repos/TheJumpCloud/jcapi/events","assignees_url":"https://api.github.com/repos/TheJumpCloud/jcapi/assignees{/user}","branches_url":"https://api.github.com/repos/TheJumpCloud/jcapi/branches{/branch}","tags_url":"https://api.github.com/repos/TheJumpCloud/jcapi/tags","blobs_url":"https://api.github.com/repos/TheJumpCloud/jcapi/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/TheJumpCloud/jcapi/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/TheJumpCloud/jcapi/git/refs{/sha}","trees_url":"https://api.github.com/repos/TheJumpCloud/jcapi/git/trees{/sha}","statuses_url":"https://api.github.com/repos/TheJumpCloud/jcapi/statuses/{sha}","languages_url":"https://api.github.com/repos/TheJumpCloud/jcapi/languages","stargazers_url":"https://api.github.com/repos/TheJumpCloud/jcapi/stargazers","contributors_url":"https://api.github.com/repos/TheJumpCloud/jcapi/contributors","subscribers_url":"https://api.github.com/repos/TheJumpCloud/jcapi/subscribers","subscription_url":"https://api.github.com/repos/TheJumpCloud/jcapi/subscription","commits_url":"https://api.github.com/repos/TheJumpCloud/jcapi/commits{/sha}","git_commits_url":"https://api.github.com/repos/TheJumpCloud/jcapi/git/commits{/sha}","comments_url":"https://api.github.com/repos/TheJumpCloud/jcapi/comments{/number}","issue_comment_url":"https://api.github.com/repos/TheJumpCloud/jcapi/issues/comments{/number}","contents_url":"https://api.github.com/repos/TheJumpCloud/jcapi/contents/{+path}","compare_url":"https://api.github.com/repos/TheJumpCloud/jcapi/compare/{base}...{head}","merges_url":"https://api.github.com/repos/TheJumpCloud/jcapi/merges","archive_url":"https://api.github.com/repos/TheJumpCloud/jcapi/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/TheJumpCloud/jcapi/downloads","issues_url":"https://api.github.com/repos/TheJumpCloud/jcapi/issues{/number}","pulls_url":"https://api.github.com/repos/TheJumpCloud/jcapi/pulls{/number}","milestones_url":"https://api.github.com/repos/TheJumpCloud/jcapi/milestones{/number}","notifications_url":"https://api.github.com/repos/TheJumpCloud/jcapi/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/TheJumpCloud/jcapi/labels{/name}","releases_url":"https://api.github.com/repos/TheJumpCloud/jcapi/releases{/id}","created_at":"2014-12-11T17:42:52Z","updated_at":"2015-04-09T19:44:48Z","pushed_at":"2015-04-10T18:40:14Z","git_url":"git://github.com/TheJumpCloud/jcapi.git","ssh_url":"git@github.com:TheJumpCloud/jcapi.git","clone_url":"https://github.com/TheJumpCloud/jcapi.git","svn_url":"https://github.com/TheJumpCloud/jcapi","homepage":"https://jumpcloud.com","size":357,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"TheJumpCloud:master","ref":"master","sha":"2398d1942401ccb82b605f2d8bbc7e8c6aaa69fd","user":{"login":"TheJumpCloud","id":4927461,"avatar_url":"https://avatars.githubusercontent.com/u/4927461?v=3","gravatar_id":"","url":"https://api.github.com/users/TheJumpCloud","html_url":"https://github.com/TheJumpCloud","followers_url":"https://api.github.com/users/TheJumpCloud/followers","following_url":"https://api.github.com/users/TheJumpCloud/following{/other_user}","gists_url":"https://api.github.com/users/TheJumpCloud/gists{/gist_id}","starred_url":"https://api.github.com/users/TheJumpCloud/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TheJumpCloud/subscriptions","organizations_url":"https://api.github.com/users/TheJumpCloud/orgs","repos_url":"https://api.github.com/users/TheJumpCloud/repos","events_url":"https://api.github.com/users/TheJumpCloud/events{/privacy}","received_events_url":"https://api.github.com/users/TheJumpCloud/received_events","type":"Organization","site_admin":false},"repo":{"id":27883713,"name":"jcapi","full_name":"TheJumpCloud/jcapi","owner":{"login":"TheJumpCloud","id":4927461,"avatar_url":"https://avatars.githubusercontent.com/u/4927461?v=3","gravatar_id":"","url":"https://api.github.com/users/TheJumpCloud","html_url":"https://github.com/TheJumpCloud","followers_url":"https://api.github.com/users/TheJumpCloud/followers","following_url":"https://api.github.com/users/TheJumpCloud/following{/other_user}","gists_url":"https://api.github.com/users/TheJumpCloud/gists{/gist_id}","starred_url":"https://api.github.com/users/TheJumpCloud/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TheJumpCloud/subscriptions","organizations_url":"https://api.github.com/users/TheJumpCloud/orgs","repos_url":"https://api.github.com/users/TheJumpCloud/repos","events_url":"https://api.github.com/users/TheJumpCloud/events{/privacy}","received_events_url":"https://api.github.com/users/TheJumpCloud/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/TheJumpCloud/jcapi","description":"JumpCloud's Go (golang) REST API SDK","fork":false,"url":"https://api.github.com/repos/TheJumpCloud/jcapi","forks_url":"https://api.github.com/repos/TheJumpCloud/jcapi/forks","keys_url":"https://api.github.com/repos/TheJumpCloud/jcapi/keys{/key_id}","collaborators_url":"https://api.github.com/repos/TheJumpCloud/jcapi/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/TheJumpCloud/jcapi/teams","hooks_url":"https://api.github.com/repos/TheJumpCloud/jcapi/hooks","issue_events_url":"https://api.github.com/repos/TheJumpCloud/jcapi/issues/events{/number}","events_url":"https://api.github.com/repos/TheJumpCloud/jcapi/events","assignees_url":"https://api.github.com/repos/TheJumpCloud/jcapi/assignees{/user}","branches_url":"https://api.github.com/repos/TheJumpCloud/jcapi/branches{/branch}","tags_url":"https://api.github.com/repos/TheJumpCloud/jcapi/tags","blobs_url":"https://api.github.com/repos/TheJumpCloud/jcapi/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/TheJumpCloud/jcapi/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/TheJumpCloud/jcapi/git/refs{/sha}","trees_url":"https://api.github.com/repos/TheJumpCloud/jcapi/git/trees{/sha}","statuses_url":"https://api.github.com/repos/TheJumpCloud/jcapi/statuses/{sha}","languages_url":"https://api.github.com/repos/TheJumpCloud/jcapi/languages","stargazers_url":"https://api.github.com/repos/TheJumpCloud/jcapi/stargazers","contributors_url":"https://api.github.com/repos/TheJumpCloud/jcapi/contributors","subscribers_url":"https://api.github.com/repos/TheJumpCloud/jcapi/subscribers","subscription_url":"https://api.github.com/repos/TheJumpCloud/jcapi/subscription","commits_url":"https://api.github.com/repos/TheJumpCloud/jcapi/commits{/sha}","git_commits_url":"https://api.github.com/repos/TheJumpCloud/jcapi/git/commits{/sha}","comments_url":"https://api.github.com/repos/TheJumpCloud/jcapi/comments{/number}","issue_comment_url":"https://api.github.com/repos/TheJumpCloud/jcapi/issues/comments{/number}","contents_url":"https://api.github.com/repos/TheJumpCloud/jcapi/contents/{+path}","compare_url":"https://api.github.com/repos/TheJumpCloud/jcapi/compare/{base}...{head}","merges_url":"https://api.github.com/repos/TheJumpCloud/jcapi/merges","archive_url":"https://api.github.com/repos/TheJumpCloud/jcapi/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/TheJumpCloud/jcapi/downloads","issues_url":"https://api.github.com/repos/TheJumpCloud/jcapi/issues{/number}","pulls_url":"https://api.github.com/repos/TheJumpCloud/jcapi/pulls{/number}","milestones_url":"https://api.github.com/repos/TheJumpCloud/jcapi/milestones{/number}","notifications_url":"https://api.github.com/repos/TheJumpCloud/jcapi/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/TheJumpCloud/jcapi/labels{/name}","releases_url":"https://api.github.com/repos/TheJumpCloud/jcapi/releases{/id}","created_at":"2014-12-11T17:42:52Z","updated_at":"2015-04-09T19:44:48Z","pushed_at":"2015-04-10T18:40:14Z","git_url":"git://github.com/TheJumpCloud/jcapi.git","ssh_url":"git@github.com:TheJumpCloud/jcapi.git","clone_url":"https://github.com/TheJumpCloud/jcapi.git","svn_url":"https://github.com/TheJumpCloud/jcapi","homepage":"https://jumpcloud.com","size":357,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/TheJumpCloud/jcapi/pulls/3"},"html":{"href":"https://github.com/TheJumpCloud/jcapi/pull/3"},"issue":{"href":"https://api.github.com/repos/TheJumpCloud/jcapi/issues/3"},"comments":{"href":"https://api.github.com/repos/TheJumpCloud/jcapi/issues/3/comments"},"review_comments":{"href":"https://api.github.com/repos/TheJumpCloud/jcapi/pulls/3/comments"},"review_comment":{"href":"https://api.github.com/repos/TheJumpCloud/jcapi/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/TheJumpCloud/jcapi/pulls/3/commits"},"statuses":{"href":"https://api.github.com/repos/TheJumpCloud/jcapi/statuses/f5c73d942c4202716f429e64795d229990063247"}}}}