{"action":"created","comment":{"url":"https://api.github.com/repos/guardian/certificate-magic/pulls/comments/50822141","id":50822141,"diff_hunk":"@@ -90,15 +90,20 @@ object Magic extends BouncyCastle with FileHelpers {\n     System.err.println(s\"installing to IAM\")\n \n     val iamClient = region.createClient(classOf[AmazonIdentityManagementClient], installCredentialsProvider, null)\n-    val uploadResult = iamClient.uploadServerCertificate(\n-      new UploadServerCertificateRequest()\n-        .withServerCertificateName(s\"$safeDomain-exp$expDate\")\n-        .withPrivateKey(decryptedPem)\n-        .withCertificateBody(certificatePem)\n-        .withCertificateChain(chainPem)\n-    )\n-\n-    System.err.println(s\"successfully installed certificate in IAM as ${uploadResult.getServerCertificateMetadata.getArn}\")\n+    val certificateUploadRequest = new UploadServerCertificateRequest()\n+      .withServerCertificateName(s\"$safeDomain-exp$expDate\")\n+      .withPrivateKey(decryptedPem)\n+      .withCertificateBody(certificatePem)\n+      .withCertificateChain(chainPem)\n+\n+    Try {\n+      val certificateUploadResult = iamClient.uploadServerCertificate(certificateUploadRequest)\n+      val certificateArn = certificateUploadResult.getServerCertificateMetadata.getArn\n+      System.err.println(s\"successfully installed certificate in IAM as ${certificateArn}\")","path":"src/main/scala/com/gu/certificate/Magic.scala","position":31,"original_position":31,"commit_id":"8880dd18ce10d8c7c7d88ccb2a036bd4a734727a","original_commit_id":"8880dd18ce10d8c7c7d88ccb2a036bd4a734727a","user":{"login":"nlindblad","id":164991,"avatar_url":"https://avatars.githubusercontent.com/u/164991?v=3","gravatar_id":"","url":"https://api.github.com/users/nlindblad","html_url":"https://github.com/nlindblad","followers_url":"https://api.github.com/users/nlindblad/followers","following_url":"https://api.github.com/users/nlindblad/following{/other_user}","gists_url":"https://api.github.com/users/nlindblad/gists{/gist_id}","starred_url":"https://api.github.com/users/nlindblad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nlindblad/subscriptions","organizations_url":"https://api.github.com/users/nlindblad/orgs","repos_url":"https://api.github.com/users/nlindblad/repos","events_url":"https://api.github.com/users/nlindblad/events{/privacy}","received_events_url":"https://api.github.com/users/nlindblad/received_events","type":"User","site_admin":false},"body":"Makes perfect sense. Thanks!","created_at":"2016-01-26T11:17:46Z","updated_at":"2016-01-26T11:17:46Z","html_url":"https://github.com/guardian/certificate-magic/pull/11#discussion_r50822141","pull_request_url":"https://api.github.com/repos/guardian/certificate-magic/pulls/11","_links":{"self":{"href":"https://api.github.com/repos/guardian/certificate-magic/pulls/comments/50822141"},"html":{"href":"https://github.com/guardian/certificate-magic/pull/11#discussion_r50822141"},"pull_request":{"href":"https://api.github.com/repos/guardian/certificate-magic/pulls/11"}}},"pull_request":{"url":"https://api.github.com/repos/guardian/certificate-magic/pulls/11","id":56596626,"html_url":"https://github.com/guardian/certificate-magic/pull/11","diff_url":"https://github.com/guardian/certificate-magic/pull/11.diff","patch_url":"https://github.com/guardian/certificate-magic/pull/11.patch","issue_url":"https://api.github.com/repos/guardian/certificate-magic/issues/11","number":11,"state":"open","locked":false,"title":"Improve ServerCertificatesPerAccount limit error message","user":{"login":"nlindblad","id":164991,"avatar_url":"https://avatars.githubusercontent.com/u/164991?v=3","gravatar_id":"","url":"https://api.github.com/users/nlindblad","html_url":"https://github.com/nlindblad","followers_url":"https://api.github.com/users/nlindblad/followers","following_url":"https://api.github.com/users/nlindblad/following{/other_user}","gists_url":"https://api.github.com/users/nlindblad/gists{/gist_id}","starred_url":"https://api.github.com/users/nlindblad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nlindblad/subscriptions","organizations_url":"https://api.github.com/users/nlindblad/orgs","repos_url":"https://api.github.com/users/nlindblad/repos","events_url":"https://api.github.com/users/nlindblad/events{/privacy}","received_events_url":"https://api.github.com/users/nlindblad/received_events","type":"User","site_admin":false},"body":"One of the problem that can occur during the certificate upload process is hitting the `ServerCertificatesPerAccount` limit, which means you have to request an increase to the number of SSL certificates you can store in your AWS account.\r\n\r\nThe error could be improved a bit:\r\n\r\n    com.amazonaws.services.identitymanagement.model.LimitExceededException: Cannot exceed quota for ServerCertificatesPerAccount: 20 (Service: AmazonIdentityManagement; Status Code: 409; Error Code: LimitExceeded; Request ID: XYZ)\r\n    com.amazonaws.services.identitymanagement.model.LimitExceededException: Cannot exceed quota for ServerCertificatesPerAccount: 20 (Service: AmazonIdentityManagement; Status Code: 409; Error Code: LimitExceeded; Request ID: XYZ)\r\n\r\nThis change makes the error message a bit more user friendly and points the user in the right direction as to how to resolve it. It also opens up for catching and handling more exceptions that could happen during the certificate upload process.","created_at":"2016-01-20T11:40:11Z","updated_at":"2016-01-26T11:17:46Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a1e9ee7f1cc067e125dc58c0f372fa415f006da9","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/guardian/certificate-magic/pulls/11/commits","review_comments_url":"https://api.github.com/repos/guardian/certificate-magic/pulls/11/comments","review_comment_url":"https://api.github.com/repos/guardian/certificate-magic/pulls/comments{/number}","comments_url":"https://api.github.com/repos/guardian/certificate-magic/issues/11/comments","statuses_url":"https://api.github.com/repos/guardian/certificate-magic/statuses/8880dd18ce10d8c7c7d88ccb2a036bd4a734727a","head":{"label":"nlindblad:nl-fix-certificate-limit-error-message","ref":"nl-fix-certificate-limit-error-message","sha":"8880dd18ce10d8c7c7d88ccb2a036bd4a734727a","user":{"login":"nlindblad","id":164991,"avatar_url":"https://avatars.githubusercontent.com/u/164991?v=3","gravatar_id":"","url":"https://api.github.com/users/nlindblad","html_url":"https://github.com/nlindblad","followers_url":"https://api.github.com/users/nlindblad/followers","following_url":"https://api.github.com/users/nlindblad/following{/other_user}","gists_url":"https://api.github.com/users/nlindblad/gists{/gist_id}","starred_url":"https://api.github.com/users/nlindblad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nlindblad/subscriptions","organizations_url":"https://api.github.com/users/nlindblad/orgs","repos_url":"https://api.github.com/users/nlindblad/repos","events_url":"https://api.github.com/users/nlindblad/events{/privacy}","received_events_url":"https://api.github.com/users/nlindblad/received_events","type":"User","site_admin":false},"repo":{"id":45851348,"name":"certificate-magic","full_name":"nlindblad/certificate-magic","owner":{"login":"nlindblad","id":164991,"avatar_url":"https://avatars.githubusercontent.com/u/164991?v=3","gravatar_id":"","url":"https://api.github.com/users/nlindblad","html_url":"https://github.com/nlindblad","followers_url":"https://api.github.com/users/nlindblad/followers","following_url":"https://api.github.com/users/nlindblad/following{/other_user}","gists_url":"https://api.github.com/users/nlindblad/gists{/gist_id}","starred_url":"https://api.github.com/users/nlindblad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nlindblad/subscriptions","organizations_url":"https://api.github.com/users/nlindblad/orgs","repos_url":"https://api.github.com/users/nlindblad/repos","events_url":"https://api.github.com/users/nlindblad/events{/privacy}","received_events_url":"https://api.github.com/users/nlindblad/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/nlindblad/certificate-magic","description":"A small scala app that creates and installs certificates in AWS IAM","fork":true,"url":"https://api.github.com/repos/nlindblad/certificate-magic","forks_url":"https://api.github.com/repos/nlindblad/certificate-magic/forks","keys_url":"https://api.github.com/repos/nlindblad/certificate-magic/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nlindblad/certificate-magic/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nlindblad/certificate-magic/teams","hooks_url":"https://api.github.com/repos/nlindblad/certificate-magic/hooks","issue_events_url":"https://api.github.com/repos/nlindblad/certificate-magic/issues/events{/number}","events_url":"https://api.github.com/repos/nlindblad/certificate-magic/events","assignees_url":"https://api.github.com/repos/nlindblad/certificate-magic/assignees{/user}","branches_url":"https://api.github.com/repos/nlindblad/certificate-magic/branches{/branch}","tags_url":"https://api.github.com/repos/nlindblad/certificate-magic/tags","blobs_url":"https://api.github.com/repos/nlindblad/certificate-magic/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nlindblad/certificate-magic/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nlindblad/certificate-magic/git/refs{/sha}","trees_url":"https://api.github.com/repos/nlindblad/certificate-magic/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nlindblad/certificate-magic/statuses/{sha}","languages_url":"https://api.github.com/repos/nlindblad/certificate-magic/languages","stargazers_url":"https://api.github.com/repos/nlindblad/certificate-magic/stargazers","contributors_url":"https://api.github.com/repos/nlindblad/certificate-magic/contributors","subscribers_url":"https://api.github.com/repos/nlindblad/certificate-magic/subscribers","subscription_url":"https://api.github.com/repos/nlindblad/certificate-magic/subscription","commits_url":"https://api.github.com/repos/nlindblad/certificate-magic/commits{/sha}","git_commits_url":"https://api.github.com/repos/nlindblad/certificate-magic/git/commits{/sha}","comments_url":"https://api.github.com/repos/nlindblad/certificate-magic/comments{/number}","issue_comment_url":"https://api.github.com/repos/nlindblad/certificate-magic/issues/comments{/number}","contents_url":"https://api.github.com/repos/nlindblad/certificate-magic/contents/{+path}","compare_url":"https://api.github.com/repos/nlindblad/certificate-magic/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nlindblad/certificate-magic/merges","archive_url":"https://api.github.com/repos/nlindblad/certificate-magic/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nlindblad/certificate-magic/downloads","issues_url":"https://api.github.com/repos/nlindblad/certificate-magic/issues{/number}","pulls_url":"https://api.github.com/repos/nlindblad/certificate-magic/pulls{/number}","milestones_url":"https://api.github.com/repos/nlindblad/certificate-magic/milestones{/number}","notifications_url":"https://api.github.com/repos/nlindblad/certificate-magic/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nlindblad/certificate-magic/labels{/name}","releases_url":"https://api.github.com/repos/nlindblad/certificate-magic/releases{/id}","deployments_url":"https://api.github.com/repos/nlindblad/certificate-magic/deployments","created_at":"2015-11-09T16:35:49Z","updated_at":"2015-11-09T16:35:50Z","pushed_at":"2016-01-20T11:35:14Z","git_url":"git://github.com/nlindblad/certificate-magic.git","ssh_url":"git@github.com:nlindblad/certificate-magic.git","clone_url":"https://github.com/nlindblad/certificate-magic.git","svn_url":"https://github.com/nlindblad/certificate-magic","homepage":null,"size":29,"stargazers_count":0,"watchers_count":0,"language":"Scala","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":"guardian:master","ref":"master","sha":"ecbb5b9a1a9361866afaf9e19daef11565787d5d","user":{"login":"guardian","id":164318,"avatar_url":"https://avatars.githubusercontent.com/u/164318?v=3","gravatar_id":"","url":"https://api.github.com/users/guardian","html_url":"https://github.com/guardian","followers_url":"https://api.github.com/users/guardian/followers","following_url":"https://api.github.com/users/guardian/following{/other_user}","gists_url":"https://api.github.com/users/guardian/gists{/gist_id}","starred_url":"https://api.github.com/users/guardian/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/guardian/subscriptions","organizations_url":"https://api.github.com/users/guardian/orgs","repos_url":"https://api.github.com/users/guardian/repos","events_url":"https://api.github.com/users/guardian/events{/privacy}","received_events_url":"https://api.github.com/users/guardian/received_events","type":"Organization","site_admin":false},"repo":{"id":43685774,"name":"certificate-magic","full_name":"guardian/certificate-magic","owner":{"login":"guardian","id":164318,"avatar_url":"https://avatars.githubusercontent.com/u/164318?v=3","gravatar_id":"","url":"https://api.github.com/users/guardian","html_url":"https://github.com/guardian","followers_url":"https://api.github.com/users/guardian/followers","following_url":"https://api.github.com/users/guardian/following{/other_user}","gists_url":"https://api.github.com/users/guardian/gists{/gist_id}","starred_url":"https://api.github.com/users/guardian/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/guardian/subscriptions","organizations_url":"https://api.github.com/users/guardian/orgs","repos_url":"https://api.github.com/users/guardian/repos","events_url":"https://api.github.com/users/guardian/events{/privacy}","received_events_url":"https://api.github.com/users/guardian/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/guardian/certificate-magic","description":"A small scala app that creates and installs certificates in AWS IAM","fork":false,"url":"https://api.github.com/repos/guardian/certificate-magic","forks_url":"https://api.github.com/repos/guardian/certificate-magic/forks","keys_url":"https://api.github.com/repos/guardian/certificate-magic/keys{/key_id}","collaborators_url":"https://api.github.com/repos/guardian/certificate-magic/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/guardian/certificate-magic/teams","hooks_url":"https://api.github.com/repos/guardian/certificate-magic/hooks","issue_events_url":"https://api.github.com/repos/guardian/certificate-magic/issues/events{/number}","events_url":"https://api.github.com/repos/guardian/certificate-magic/events","assignees_url":"https://api.github.com/repos/guardian/certificate-magic/assignees{/user}","branches_url":"https://api.github.com/repos/guardian/certificate-magic/branches{/branch}","tags_url":"https://api.github.com/repos/guardian/certificate-magic/tags","blobs_url":"https://api.github.com/repos/guardian/certificate-magic/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/guardian/certificate-magic/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/guardian/certificate-magic/git/refs{/sha}","trees_url":"https://api.github.com/repos/guardian/certificate-magic/git/trees{/sha}","statuses_url":"https://api.github.com/repos/guardian/certificate-magic/statuses/{sha}","languages_url":"https://api.github.com/repos/guardian/certificate-magic/languages","stargazers_url":"https://api.github.com/repos/guardian/certificate-magic/stargazers","contributors_url":"https://api.github.com/repos/guardian/certificate-magic/contributors","subscribers_url":"https://api.github.com/repos/guardian/certificate-magic/subscribers","subscription_url":"https://api.github.com/repos/guardian/certificate-magic/subscription","commits_url":"https://api.github.com/repos/guardian/certificate-magic/commits{/sha}","git_commits_url":"https://api.github.com/repos/guardian/certificate-magic/git/commits{/sha}","comments_url":"https://api.github.com/repos/guardian/certificate-magic/comments{/number}","issue_comment_url":"https://api.github.com/repos/guardian/certificate-magic/issues/comments{/number}","contents_url":"https://api.github.com/repos/guardian/certificate-magic/contents/{+path}","compare_url":"https://api.github.com/repos/guardian/certificate-magic/compare/{base}...{head}","merges_url":"https://api.github.com/repos/guardian/certificate-magic/merges","archive_url":"https://api.github.com/repos/guardian/certificate-magic/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/guardian/certificate-magic/downloads","issues_url":"https://api.github.com/repos/guardian/certificate-magic/issues{/number}","pulls_url":"https://api.github.com/repos/guardian/certificate-magic/pulls{/number}","milestones_url":"https://api.github.com/repos/guardian/certificate-magic/milestones{/number}","notifications_url":"https://api.github.com/repos/guardian/certificate-magic/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/guardian/certificate-magic/labels{/name}","releases_url":"https://api.github.com/repos/guardian/certificate-magic/releases{/id}","deployments_url":"https://api.github.com/repos/guardian/certificate-magic/deployments","created_at":"2015-10-05T13:26:58Z","updated_at":"2015-11-30T11:35:07Z","pushed_at":"2016-01-20T11:40:11Z","git_url":"git://github.com/guardian/certificate-magic.git","ssh_url":"git@github.com:guardian/certificate-magic.git","clone_url":"https://github.com/guardian/certificate-magic.git","svn_url":"https://github.com/guardian/certificate-magic","homepage":null,"size":31,"stargazers_count":2,"watchers_count":2,"language":"Scala","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":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/guardian/certificate-magic/pulls/11"},"html":{"href":"https://github.com/guardian/certificate-magic/pull/11"},"issue":{"href":"https://api.github.com/repos/guardian/certificate-magic/issues/11"},"comments":{"href":"https://api.github.com/repos/guardian/certificate-magic/issues/11/comments"},"review_comments":{"href":"https://api.github.com/repos/guardian/certificate-magic/pulls/11/comments"},"review_comment":{"href":"https://api.github.com/repos/guardian/certificate-magic/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/guardian/certificate-magic/pulls/11/commits"},"statuses":{"href":"https://api.github.com/repos/guardian/certificate-magic/statuses/8880dd18ce10d8c7c7d88ccb2a036bd4a734727a"}}}}