{"action":"created","comment":{"url":"https://api.github.com/repos/newrelic/infra-integrations-sdk/pulls/comments/189197961","pull_request_review_id":121331186,"id":189197961,"diff_hunk":"@@ -0,0 +1,68 @@\n+package http\n+\n+import (\n+\t\"crypto/tls\"\n+\t\"crypto/x509\"\n+\t\"io/ioutil\"\n+\t\"net\"\n+\t\"net/http\"\n+\t\"path/filepath\"\n+\t\"strings\"\n+\t\"time\"\n+)\n+\n+// NewWithCert creates a new http.Client with a custom certificate\n+func NewWithCert(CABundleFile, CABundleDir string) (*http.Client, error) {\n+\t// go default http transport settings\n+\ttransport := &http.Transport{\n+\t\tProxy:                 http.ProxyFromEnvironment,\n+\t\tDialContext:           (&net.Dialer{Timeout: 30 * time.Second, KeepAlive: 30 * time.Second}).DialContext,\n+\t\tMaxIdleConns:          100,\n+\t\tIdleConnTimeout:       90 * time.Second,\n+\t\tTLSHandshakeTimeout:   10 * time.Second,\n+\t\tExpectContinueTimeout: 1 * time.Second,\n+\t}\n+\n+\tif CABundleFile != \"\" || CABundleDir != \"\" {\n+\t\tcerts, err := getCertPool(CABundleFile, CABundleDir)\n+\t\tif err != nil {\n+\t\t\treturn nil, err\n+\t\t}\n+\t\ttransport.TLSClientConfig = &tls.Config{RootCAs: certs}\n+\t}\n+\n+\treturn &http.Client{\n+\t\tTransport: transport,\n+\t}, nil\n+}\n+\n+func getCertPool(certFile string, certDirectory string) (*x509.CertPool, error) {\n+\tcaCertPool := x509.NewCertPool()\n+\tif certFile != \"\" {\n+\t\tcaCert, err := ioutil.ReadFile(certFile)\n+\t\tif err != nil {\n+\t\t\treturn nil, err\n+\t\t}\n+\n+\t\t_ = caCertPool.AppendCertsFromPEM(caCert)","path":"http/client.go","position":38,"original_position":47,"commit_id":"49fe027dce263278acba1f2615c26832cac2c23b","original_commit_id":"e35188e7396c9f7e92c5937f3532cd4508311cd9","user":{"login":"varas","id":1300852,"avatar_url":"https://avatars0.githubusercontent.com/u/1300852?v=4","gravatar_id":"","url":"https://api.github.com/users/varas","html_url":"https://github.com/varas","followers_url":"https://api.github.com/users/varas/followers","following_url":"https://api.github.com/users/varas/following{/other_user}","gists_url":"https://api.github.com/users/varas/gists{/gist_id}","starred_url":"https://api.github.com/users/varas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/varas/subscriptions","organizations_url":"https://api.github.com/users/varas/orgs","repos_url":"https://api.github.com/users/varas/repos","events_url":"https://api.github.com/users/varas/events{/privacy}","received_events_url":"https://api.github.com/users/varas/received_events","type":"User","site_admin":false},"body":"That func just returns if the cert was added to the pool","created_at":"2018-05-18T08:33:26Z","updated_at":"2018-05-18T08:33:27Z","html_url":"https://github.com/newrelic/infra-integrations-sdk/pull/83#discussion_r189197961","pull_request_url":"https://api.github.com/repos/newrelic/infra-integrations-sdk/pulls/83","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/newrelic/infra-integrations-sdk/pulls/comments/189197961"},"html":{"href":"https://github.com/newrelic/infra-integrations-sdk/pull/83#discussion_r189197961"},"pull_request":{"href":"https://api.github.com/repos/newrelic/infra-integrations-sdk/pulls/83"}},"in_reply_to_id":189135627},"pull_request":{"url":"https://api.github.com/repos/newrelic/infra-integrations-sdk/pulls/83","id":188396602,"html_url":"https://github.com/newrelic/infra-integrations-sdk/pull/83","diff_url":"https://github.com/newrelic/infra-integrations-sdk/pull/83.diff","patch_url":"https://github.com/newrelic/infra-integrations-sdk/pull/83.patch","issue_url":"https://api.github.com/repos/newrelic/infra-integrations-sdk/issues/83","number":83,"state":"open","locked":false,"title":"Http client wrapper","user":{"login":"xino12","id":1876430,"avatar_url":"https://avatars0.githubusercontent.com/u/1876430?v=4","gravatar_id":"","url":"https://api.github.com/users/xino12","html_url":"https://github.com/xino12","followers_url":"https://api.github.com/users/xino12/followers","following_url":"https://api.github.com/users/xino12/following{/other_user}","gists_url":"https://api.github.com/users/xino12/gists{/gist_id}","starred_url":"https://api.github.com/users/xino12/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xino12/subscriptions","organizations_url":"https://api.github.com/users/xino12/orgs","repos_url":"https://api.github.com/users/xino12/repos","events_url":"https://api.github.com/users/xino12/events{/privacy}","received_events_url":"https://api.github.com/users/xino12/received_events","type":"User","site_admin":false},"body":"#### Description of the changes\r\nCreate wrapper to ease the task of creating a http client with custom certs.\r\n\r\n#### PR Review Checklist\r\n### Author\r\n\r\n- [x] add a risk label after carefully considering the \"blast radius\" of your changes\r\n- [x] describe the _intent_ of your changes in the description. don't just rewrite your code in prose\r\n- [x] assign at least one reviewer\r\n\r\n### Reviewer\r\n\r\n- [ ] review code for readability\r\n- [ ] verify that high risk behavior changes are well tested\r\n- [ ] check license for any new external dependency\r\n- [ ] ask questions about anything that isn't clear and obvious\r\n- [ ] approve the PR when you consider it's good to merge\r\n","created_at":"2018-05-16T11:09:15Z","updated_at":"2018-05-18T08:33:27Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ae47d75be74ead3b21bed51363231c3b5c22b095","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":610576101,"url":"https://api.github.com/repos/newrelic/infra-integrations-sdk/labels/risk:low","name":"risk:low","color":"0e8a16","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/newrelic/infra-integrations-sdk/pulls/83/commits","review_comments_url":"https://api.github.com/repos/newrelic/infra-integrations-sdk/pulls/83/comments","review_comment_url":"https://api.github.com/repos/newrelic/infra-integrations-sdk/pulls/comments{/number}","comments_url":"https://api.github.com/repos/newrelic/infra-integrations-sdk/issues/83/comments","statuses_url":"https://api.github.com/repos/newrelic/infra-integrations-sdk/statuses/49fe027dce263278acba1f2615c26832cac2c23b","head":{"label":"newrelic:httpClientWrapper","ref":"httpClientWrapper","sha":"49fe027dce263278acba1f2615c26832cac2c23b","user":{"login":"newrelic","id":31739,"avatar_url":"https://avatars0.githubusercontent.com/u/31739?v=4","gravatar_id":"","url":"https://api.github.com/users/newrelic","html_url":"https://github.com/newrelic","followers_url":"https://api.github.com/users/newrelic/followers","following_url":"https://api.github.com/users/newrelic/following{/other_user}","gists_url":"https://api.github.com/users/newrelic/gists{/gist_id}","starred_url":"https://api.github.com/users/newrelic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/newrelic/subscriptions","organizations_url":"https://api.github.com/users/newrelic/orgs","repos_url":"https://api.github.com/users/newrelic/repos","events_url":"https://api.github.com/users/newrelic/events{/privacy}","received_events_url":"https://api.github.com/users/newrelic/received_events","type":"Organization","site_admin":false},"repo":{"id":91324707,"name":"infra-integrations-sdk","full_name":"newrelic/infra-integrations-sdk","owner":{"login":"newrelic","id":31739,"avatar_url":"https://avatars0.githubusercontent.com/u/31739?v=4","gravatar_id":"","url":"https://api.github.com/users/newrelic","html_url":"https://github.com/newrelic","followers_url":"https://api.github.com/users/newrelic/followers","following_url":"https://api.github.com/users/newrelic/following{/other_user}","gists_url":"https://api.github.com/users/newrelic/gists{/gist_id}","starred_url":"https://api.github.com/users/newrelic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/newrelic/subscriptions","organizations_url":"https://api.github.com/users/newrelic/orgs","repos_url":"https://api.github.com/users/newrelic/repos","events_url":"https://api.github.com/users/newrelic/events{/privacy}","received_events_url":"https://api.github.com/users/newrelic/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/newrelic/infra-integrations-sdk","description":"New Relic Infrastructure Integrations SDK","fork":false,"url":"https://api.github.com/repos/newrelic/infra-integrations-sdk","forks_url":"https://api.github.com/repos/newrelic/infra-integrations-sdk/forks","keys_url":"https://api.github.com/repos/newrelic/infra-integrations-sdk/keys{/key_id}","collaborators_url":"https://api.github.com/repos/newrelic/infra-integrations-sdk/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/newrelic/infra-integrations-sdk/teams","hooks_url":"https://api.github.com/repos/newrelic/infra-integrations-sdk/hooks","issue_events_url":"https://api.github.com/repos/newrelic/infra-integrations-sdk/issues/events{/number}","events_url":"https://api.github.com/repos/newrelic/infra-integrations-sdk/events","assignees_url":"https://api.github.com/repos/newrelic/infra-integrations-sdk/assignees{/user}","branches_url":"https://api.github.com/repos/newrelic/infra-integrations-sdk/branches{/branch}","tags_url":"https://api.github.com/repos/newrelic/infra-integrations-sdk/tags","blobs_url":"https://api.github.com/repos/newrelic/infra-integrations-sdk/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/newrelic/infra-integrations-sdk/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/newrelic/infra-integrations-sdk/git/refs{/sha}","trees_url":"https://api.github.com/repos/newrelic/infra-integrations-sdk/git/trees{/sha}","statuses_url":"https://api.github.com/repos/newrelic/infra-integrations-sdk/statuses/{sha}","languages_url":"https://api.github.com/repos/newrelic/infra-integrations-sdk/languages","stargazers_url":"https://api.github.com/repos/newrelic/infra-integrations-sdk/stargazers","contributors_url":"https://api.github.com/repos/newrelic/infra-integrations-sdk/contributors","subscribers_url":"https://api.github.com/repos/newrelic/infra-integrations-sdk/subscribers","subscription_url":"https://api.github.com/repos/newrelic/infra-integrations-sdk/subscription","commits_url":"https://api.github.com/repos/newrelic/infra-integrations-sdk/commits{/sha}","git_commits_url":"https://api.github.com/repos/newrelic/infra-integrations-sdk/git/commits{/sha}","comments_url":"https://api.github.com/repos/newrelic/infra-integrations-sdk/comments{/number}","issue_comment_url":"https://api.github.com/repos/newrelic/infra-integrations-sdk/issues/comments{/number}","contents_url":"https://api.github.com/repos/newrelic/infra-integrations-sdk/contents/{+path}","compare_url":"https://api.github.com/repos/newrelic/infra-integrations-sdk/compare/{base}...{head}","merges_url":"https://api.github.com/repos/newrelic/infra-integrations-sdk/merges","archive_url":"https://api.github.com/repos/newrelic/infra-integrations-sdk/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/newrelic/infra-integrations-sdk/downloads","issues_url":"https://api.github.com/repos/newrelic/infra-integrations-sdk/issues{/number}","pulls_url":"https://api.github.com/repos/newrelic/infra-integrations-sdk/pulls{/number}","milestones_url":"https://api.github.com/repos/newrelic/infra-integrations-sdk/milestones{/number}","notifications_url":"https://api.github.com/repos/newrelic/infra-integrations-sdk/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/newrelic/infra-integrations-sdk/labels{/name}","releases_url":"https://api.github.com/repos/newrelic/infra-integrations-sdk/releases{/id}","deployments_url":"https://api.github.com/repos/newrelic/infra-integrations-sdk/deployments","created_at":"2017-05-15T10:19:47Z","updated_at":"2018-05-17T11:04:11Z","pushed_at":"2018-05-18T08:20:36Z","git_url":"git://github.com/newrelic/infra-integrations-sdk.git","ssh_url":"git@github.com:newrelic/infra-integrations-sdk.git","clone_url":"https://github.com/newrelic/infra-integrations-sdk.git","svn_url":"https://github.com/newrelic/infra-integrations-sdk","homepage":"","size":1121,"stargazers_count":15,"watchers_count":15,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":11,"mirror_url":null,"archived":false,"open_issues_count":5,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":11,"open_issues":5,"watchers":15,"default_branch":"master"}},"base":{"label":"newrelic:master","ref":"master","sha":"be43337ab4e1949e45f283c4433e6842348dd28d","user":{"login":"newrelic","id":31739,"avatar_url":"https://avatars0.githubusercontent.com/u/31739?v=4","gravatar_id":"","url":"https://api.github.com/users/newrelic","html_url":"https://github.com/newrelic","followers_url":"https://api.github.com/users/newrelic/followers","following_url":"https://api.github.com/users/newrelic/following{/other_user}","gists_url":"https://api.github.com/users/newrelic/gists{/gist_id}","starred_url":"https://api.github.com/users/newrelic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/newrelic/subscriptions","organizations_url":"https://api.github.com/users/newrelic/orgs","repos_url":"https://api.github.com/users/newrelic/repos","events_url":"https://api.github.com/users/newrelic/events{/privacy}","received_events_url":"https://api.github.com/users/newrelic/received_events","type":"Organization","site_admin":false},"repo":{"id":91324707,"name":"infra-integrations-sdk","full_name":"newrelic/infra-integrations-sdk","owner":{"login":"newrelic","id":31739,"avatar_url":"https://avatars0.githubusercontent.com/u/31739?v=4","gravatar_id":"","url":"https://api.github.com/users/newrelic","html_url":"https://github.com/newrelic","followers_url":"https://api.github.com/users/newrelic/followers","following_url":"https://api.github.com/users/newrelic/following{/other_user}","gists_url":"https://api.github.com/users/newrelic/gists{/gist_id}","starred_url":"https://api.github.com/users/newrelic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/newrelic/subscriptions","organizations_url":"https://api.github.com/users/newrelic/orgs","repos_url":"https://api.github.com/users/newrelic/repos","events_url":"https://api.github.com/users/newrelic/events{/privacy}","received_events_url":"https://api.github.com/users/newrelic/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/newrelic/infra-integrations-sdk","description":"New Relic Infrastructure Integrations SDK","fork":false,"url":"https://api.github.com/repos/newrelic/infra-integrations-sdk","forks_url":"https://api.github.com/repos/newrelic/infra-integrations-sdk/forks","keys_url":"https://api.github.com/repos/newrelic/infra-integrations-sdk/keys{/key_id}","collaborators_url":"https://api.github.com/repos/newrelic/infra-integrations-sdk/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/newrelic/infra-integrations-sdk/teams","hooks_url":"https://api.github.com/repos/newrelic/infra-integrations-sdk/hooks","issue_events_url":"https://api.github.com/repos/newrelic/infra-integrations-sdk/issues/events{/number}","events_url":"https://api.github.com/repos/newrelic/infra-integrations-sdk/events","assignees_url":"https://api.github.com/repos/newrelic/infra-integrations-sdk/assignees{/user}","branches_url":"https://api.github.com/repos/newrelic/infra-integrations-sdk/branches{/branch}","tags_url":"https://api.github.com/repos/newrelic/infra-integrations-sdk/tags","blobs_url":"https://api.github.com/repos/newrelic/infra-integrations-sdk/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/newrelic/infra-integrations-sdk/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/newrelic/infra-integrations-sdk/git/refs{/sha}","trees_url":"https://api.github.com/repos/newrelic/infra-integrations-sdk/git/trees{/sha}","statuses_url":"https://api.github.com/repos/newrelic/infra-integrations-sdk/statuses/{sha}","languages_url":"https://api.github.com/repos/newrelic/infra-integrations-sdk/languages","stargazers_url":"https://api.github.com/repos/newrelic/infra-integrations-sdk/stargazers","contributors_url":"https://api.github.com/repos/newrelic/infra-integrations-sdk/contributors","subscribers_url":"https://api.github.com/repos/newrelic/infra-integrations-sdk/subscribers","subscription_url":"https://api.github.com/repos/newrelic/infra-integrations-sdk/subscription","commits_url":"https://api.github.com/repos/newrelic/infra-integrations-sdk/commits{/sha}","git_commits_url":"https://api.github.com/repos/newrelic/infra-integrations-sdk/git/commits{/sha}","comments_url":"https://api.github.com/repos/newrelic/infra-integrations-sdk/comments{/number}","issue_comment_url":"https://api.github.com/repos/newrelic/infra-integrations-sdk/issues/comments{/number}","contents_url":"https://api.github.com/repos/newrelic/infra-integrations-sdk/contents/{+path}","compare_url":"https://api.github.com/repos/newrelic/infra-integrations-sdk/compare/{base}...{head}","merges_url":"https://api.github.com/repos/newrelic/infra-integrations-sdk/merges","archive_url":"https://api.github.com/repos/newrelic/infra-integrations-sdk/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/newrelic/infra-integrations-sdk/downloads","issues_url":"https://api.github.com/repos/newrelic/infra-integrations-sdk/issues{/number}","pulls_url":"https://api.github.com/repos/newrelic/infra-integrations-sdk/pulls{/number}","milestones_url":"https://api.github.com/repos/newrelic/infra-integrations-sdk/milestones{/number}","notifications_url":"https://api.github.com/repos/newrelic/infra-integrations-sdk/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/newrelic/infra-integrations-sdk/labels{/name}","releases_url":"https://api.github.com/repos/newrelic/infra-integrations-sdk/releases{/id}","deployments_url":"https://api.github.com/repos/newrelic/infra-integrations-sdk/deployments","created_at":"2017-05-15T10:19:47Z","updated_at":"2018-05-17T11:04:11Z","pushed_at":"2018-05-18T08:20:36Z","git_url":"git://github.com/newrelic/infra-integrations-sdk.git","ssh_url":"git@github.com:newrelic/infra-integrations-sdk.git","clone_url":"https://github.com/newrelic/infra-integrations-sdk.git","svn_url":"https://github.com/newrelic/infra-integrations-sdk","homepage":"","size":1121,"stargazers_count":15,"watchers_count":15,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":11,"mirror_url":null,"archived":false,"open_issues_count":5,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":11,"open_issues":5,"watchers":15,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/newrelic/infra-integrations-sdk/pulls/83"},"html":{"href":"https://github.com/newrelic/infra-integrations-sdk/pull/83"},"issue":{"href":"https://api.github.com/repos/newrelic/infra-integrations-sdk/issues/83"},"comments":{"href":"https://api.github.com/repos/newrelic/infra-integrations-sdk/issues/83/comments"},"review_comments":{"href":"https://api.github.com/repos/newrelic/infra-integrations-sdk/pulls/83/comments"},"review_comment":{"href":"https://api.github.com/repos/newrelic/infra-integrations-sdk/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/newrelic/infra-integrations-sdk/pulls/83/commits"},"statuses":{"href":"https://api.github.com/repos/newrelic/infra-integrations-sdk/statuses/49fe027dce263278acba1f2615c26832cac2c23b"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"varas"}}