{"action":"created","comment":{"url":"https://api.github.com/repos/fsouza/go-dockerclient/pulls/comments/36323442","id":36323442,"diff_hunk":"@@ -0,0 +1,76 @@\n+// Copyright 2015 go-dockerclient authors. All rights reserved.\n+// Use of this source code is governed by a BSD-style\n+// license that can be found in the LICENSE file.\n+\n+package docker\n+\n+import (\n+\t\"encoding/json\"\n+\t\"net/http\"\n+)\n+\n+// Network represents a network.\n+type Network struct {\n+\tName      string      `json:\"name\"`\n+\tID        string      `json:\"id\"`\n+\tType      string      `json:\"type\"`\n+\tEndpoints []*Endpoint `json:\"endpoints\"`\n+}\n+\n+// Endpoint represents an endpoint.\n+type Endpoint struct {\n+\tName    string `json:\"name\"`\n+\tID      string `json:\"id\"`\n+\tNetwork string `json:\"network\"`\n+}\n+\n+// Service represents a service.\n+type Service struct {\n+\tID string `json:\"id\"`\n+}\n+\n+// ListNetworks returns all networks.\n+func (c *Client) ListNetworks() ([]Network, error) {\n+\tpath := \"/networks\"\n+\tbody, _, err := c.do(\"GET\", path, doOptions{})\n+\tif err != nil {\n+\t\treturn nil, err\n+\t}\n+\tvar networks []Network\n+\terr = json.Unmarshal(body, &networks)\n+\tif err != nil {\n+\t\treturn nil, err\n+\t}\n+\treturn networks, nil\n+}\n+\n+// NetworkInfo returns information about a network by its ID.\n+func (c *Client) NetworkInfo(id string) (*Network, error) {\n+\tpath := \"/networks/\" + id\n+\tbody, status, err := c.do(\"GET\", path, doOptions{})\n+\tif status == http.StatusNotFound {\n+\t\treturn nil, &NoSuchNetwork{ID: path}\n+\t}\n+\tif err != nil {\n+\t\treturn nil, err\n+\t}\n+\tvar network Network\n+\terr = json.Unmarshal(body, &network)\n+\tif err != nil {\n+\t\treturn nil, err\n+\t}\n+\treturn &network, nil\n+}\n+\n+// NoSuchNetwork is the error returned when a given network does not exist.\n+type NoSuchNetwork struct {\n+\tID  string\n+\tErr error\n+}\n+\n+func (err *NoSuchNetwork) Error() string {\n+\tif err.Err != nil {\n+\t\treturn err.Err.Error()\n+\t}\n+\treturn \"No such network: \" + err.ID","path":"network.go","position":75,"original_position":75,"commit_id":"9086070361d5587463386a54986cde9f172a7998","original_commit_id":"9086070361d5587463386a54986cde9f172a7998","user":{"login":"peter-edge","id":4228796,"avatar_url":"https://avatars.githubusercontent.com/u/4228796?v=3","gravatar_id":"","url":"https://api.github.com/users/peter-edge","html_url":"https://github.com/peter-edge","followers_url":"https://api.github.com/users/peter-edge/followers","following_url":"https://api.github.com/users/peter-edge/following{/other_user}","gists_url":"https://api.github.com/users/peter-edge/gists{/gist_id}","starred_url":"https://api.github.com/users/peter-edge/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/peter-edge/subscriptions","organizations_url":"https://api.github.com/users/peter-edge/orgs","repos_url":"https://api.github.com/users/peter-edge/repos","events_url":"https://api.github.com/users/peter-edge/events{/privacy}","received_events_url":"https://api.github.com/users/peter-edge/received_events","type":"User","site_admin":false},"body":"nit: i usually like `fmt.Sprintf(\"foo: %s\", err.ID)` but no biggie","created_at":"2015-08-05T16:38:31Z","updated_at":"2015-08-05T16:38:31Z","html_url":"https://github.com/fsouza/go-dockerclient/pull/343#discussion_r36323442","pull_request_url":"https://api.github.com/repos/fsouza/go-dockerclient/pulls/343","_links":{"self":{"href":"https://api.github.com/repos/fsouza/go-dockerclient/pulls/comments/36323442"},"html":{"href":"https://github.com/fsouza/go-dockerclient/pull/343#discussion_r36323442"},"pull_request":{"href":"https://api.github.com/repos/fsouza/go-dockerclient/pulls/343"}}},"pull_request":{"url":"https://api.github.com/repos/fsouza/go-dockerclient/pulls/343","id":41593763,"html_url":"https://github.com/fsouza/go-dockerclient/pull/343","diff_url":"https://github.com/fsouza/go-dockerclient/pull/343.diff","patch_url":"https://github.com/fsouza/go-dockerclient/pull/343.patch","issue_url":"https://api.github.com/repos/fsouza/go-dockerclient/issues/343","number":343,"state":"open","locked":false,"title":"Rudimentary docker network support","user":{"login":"dcbw","id":10926354,"avatar_url":"https://avatars.githubusercontent.com/u/10926354?v=3","gravatar_id":"","url":"https://api.github.com/users/dcbw","html_url":"https://github.com/dcbw","followers_url":"https://api.github.com/users/dcbw/followers","following_url":"https://api.github.com/users/dcbw/following{/other_user}","gists_url":"https://api.github.com/users/dcbw/gists{/gist_id}","starred_url":"https://api.github.com/users/dcbw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dcbw/subscriptions","organizations_url":"https://api.github.com/users/dcbw/orgs","repos_url":"https://api.github.com/users/dcbw/repos","events_url":"https://api.github.com/users/dcbw/events{/privacy}","received_events_url":"https://api.github.com/users/dcbw/received_events","type":"User","site_admin":false},"body":"Start adding support for docker's network API (which is just a passthrough to libnetwork's API).","created_at":"2015-08-04T17:12:31Z","updated_at":"2015-08-05T16:38:31Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f6d075a946ed2b2a38c2c93d7faf0712bd932703","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/fsouza/go-dockerclient/pulls/343/commits","review_comments_url":"https://api.github.com/repos/fsouza/go-dockerclient/pulls/343/comments","review_comment_url":"https://api.github.com/repos/fsouza/go-dockerclient/pulls/comments{/number}","comments_url":"https://api.github.com/repos/fsouza/go-dockerclient/issues/343/comments","statuses_url":"https://api.github.com/repos/fsouza/go-dockerclient/statuses/9086070361d5587463386a54986cde9f172a7998","head":{"label":"dcbw:master","ref":"master","sha":"9086070361d5587463386a54986cde9f172a7998","user":{"login":"dcbw","id":10926354,"avatar_url":"https://avatars.githubusercontent.com/u/10926354?v=3","gravatar_id":"","url":"https://api.github.com/users/dcbw","html_url":"https://github.com/dcbw","followers_url":"https://api.github.com/users/dcbw/followers","following_url":"https://api.github.com/users/dcbw/following{/other_user}","gists_url":"https://api.github.com/users/dcbw/gists{/gist_id}","starred_url":"https://api.github.com/users/dcbw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dcbw/subscriptions","organizations_url":"https://api.github.com/users/dcbw/orgs","repos_url":"https://api.github.com/users/dcbw/repos","events_url":"https://api.github.com/users/dcbw/events{/privacy}","received_events_url":"https://api.github.com/users/dcbw/received_events","type":"User","site_admin":false},"repo":{"id":39907758,"name":"go-dockerclient","full_name":"dcbw/go-dockerclient","owner":{"login":"dcbw","id":10926354,"avatar_url":"https://avatars.githubusercontent.com/u/10926354?v=3","gravatar_id":"","url":"https://api.github.com/users/dcbw","html_url":"https://github.com/dcbw","followers_url":"https://api.github.com/users/dcbw/followers","following_url":"https://api.github.com/users/dcbw/following{/other_user}","gists_url":"https://api.github.com/users/dcbw/gists{/gist_id}","starred_url":"https://api.github.com/users/dcbw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dcbw/subscriptions","organizations_url":"https://api.github.com/users/dcbw/orgs","repos_url":"https://api.github.com/users/dcbw/repos","events_url":"https://api.github.com/users/dcbw/events{/privacy}","received_events_url":"https://api.github.com/users/dcbw/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/dcbw/go-dockerclient","description":"Go HTTP client for the Docker remote API.","fork":true,"url":"https://api.github.com/repos/dcbw/go-dockerclient","forks_url":"https://api.github.com/repos/dcbw/go-dockerclient/forks","keys_url":"https://api.github.com/repos/dcbw/go-dockerclient/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dcbw/go-dockerclient/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dcbw/go-dockerclient/teams","hooks_url":"https://api.github.com/repos/dcbw/go-dockerclient/hooks","issue_events_url":"https://api.github.com/repos/dcbw/go-dockerclient/issues/events{/number}","events_url":"https://api.github.com/repos/dcbw/go-dockerclient/events","assignees_url":"https://api.github.com/repos/dcbw/go-dockerclient/assignees{/user}","branches_url":"https://api.github.com/repos/dcbw/go-dockerclient/branches{/branch}","tags_url":"https://api.github.com/repos/dcbw/go-dockerclient/tags","blobs_url":"https://api.github.com/repos/dcbw/go-dockerclient/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dcbw/go-dockerclient/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dcbw/go-dockerclient/git/refs{/sha}","trees_url":"https://api.github.com/repos/dcbw/go-dockerclient/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dcbw/go-dockerclient/statuses/{sha}","languages_url":"https://api.github.com/repos/dcbw/go-dockerclient/languages","stargazers_url":"https://api.github.com/repos/dcbw/go-dockerclient/stargazers","contributors_url":"https://api.github.com/repos/dcbw/go-dockerclient/contributors","subscribers_url":"https://api.github.com/repos/dcbw/go-dockerclient/subscribers","subscription_url":"https://api.github.com/repos/dcbw/go-dockerclient/subscription","commits_url":"https://api.github.com/repos/dcbw/go-dockerclient/commits{/sha}","git_commits_url":"https://api.github.com/repos/dcbw/go-dockerclient/git/commits{/sha}","comments_url":"https://api.github.com/repos/dcbw/go-dockerclient/comments{/number}","issue_comment_url":"https://api.github.com/repos/dcbw/go-dockerclient/issues/comments{/number}","contents_url":"https://api.github.com/repos/dcbw/go-dockerclient/contents/{+path}","compare_url":"https://api.github.com/repos/dcbw/go-dockerclient/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dcbw/go-dockerclient/merges","archive_url":"https://api.github.com/repos/dcbw/go-dockerclient/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dcbw/go-dockerclient/downloads","issues_url":"https://api.github.com/repos/dcbw/go-dockerclient/issues{/number}","pulls_url":"https://api.github.com/repos/dcbw/go-dockerclient/pulls{/number}","milestones_url":"https://api.github.com/repos/dcbw/go-dockerclient/milestones{/number}","notifications_url":"https://api.github.com/repos/dcbw/go-dockerclient/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dcbw/go-dockerclient/labels{/name}","releases_url":"https://api.github.com/repos/dcbw/go-dockerclient/releases{/id}","created_at":"2015-07-29T17:49:31Z","updated_at":"2015-07-29T17:49:32Z","pushed_at":"2015-08-04T18:16:15Z","git_url":"git://github.com/dcbw/go-dockerclient.git","ssh_url":"git@github.com:dcbw/go-dockerclient.git","clone_url":"https://github.com/dcbw/go-dockerclient.git","svn_url":"https://github.com/dcbw/go-dockerclient","homepage":"https://godoc.org/github.com/fsouza/go-dockerclient","size":1445,"stargazers_count":0,"watchers_count":0,"language":"Go","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":"fsouza:master","ref":"master","sha":"933433faa3e1c0bbc825b251143f8e77affbf797","user":{"login":"fsouza","id":108725,"avatar_url":"https://avatars.githubusercontent.com/u/108725?v=3","gravatar_id":"","url":"https://api.github.com/users/fsouza","html_url":"https://github.com/fsouza","followers_url":"https://api.github.com/users/fsouza/followers","following_url":"https://api.github.com/users/fsouza/following{/other_user}","gists_url":"https://api.github.com/users/fsouza/gists{/gist_id}","starred_url":"https://api.github.com/users/fsouza/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fsouza/subscriptions","organizations_url":"https://api.github.com/users/fsouza/orgs","repos_url":"https://api.github.com/users/fsouza/repos","events_url":"https://api.github.com/users/fsouza/events{/privacy}","received_events_url":"https://api.github.com/users/fsouza/received_events","type":"User","site_admin":false},"repo":{"id":9998516,"name":"go-dockerclient","full_name":"fsouza/go-dockerclient","owner":{"login":"fsouza","id":108725,"avatar_url":"https://avatars.githubusercontent.com/u/108725?v=3","gravatar_id":"","url":"https://api.github.com/users/fsouza","html_url":"https://github.com/fsouza","followers_url":"https://api.github.com/users/fsouza/followers","following_url":"https://api.github.com/users/fsouza/following{/other_user}","gists_url":"https://api.github.com/users/fsouza/gists{/gist_id}","starred_url":"https://api.github.com/users/fsouza/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fsouza/subscriptions","organizations_url":"https://api.github.com/users/fsouza/orgs","repos_url":"https://api.github.com/users/fsouza/repos","events_url":"https://api.github.com/users/fsouza/events{/privacy}","received_events_url":"https://api.github.com/users/fsouza/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/fsouza/go-dockerclient","description":"Go HTTP client for the Docker remote API.","fork":false,"url":"https://api.github.com/repos/fsouza/go-dockerclient","forks_url":"https://api.github.com/repos/fsouza/go-dockerclient/forks","keys_url":"https://api.github.com/repos/fsouza/go-dockerclient/keys{/key_id}","collaborators_url":"https://api.github.com/repos/fsouza/go-dockerclient/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/fsouza/go-dockerclient/teams","hooks_url":"https://api.github.com/repos/fsouza/go-dockerclient/hooks","issue_events_url":"https://api.github.com/repos/fsouza/go-dockerclient/issues/events{/number}","events_url":"https://api.github.com/repos/fsouza/go-dockerclient/events","assignees_url":"https://api.github.com/repos/fsouza/go-dockerclient/assignees{/user}","branches_url":"https://api.github.com/repos/fsouza/go-dockerclient/branches{/branch}","tags_url":"https://api.github.com/repos/fsouza/go-dockerclient/tags","blobs_url":"https://api.github.com/repos/fsouza/go-dockerclient/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/fsouza/go-dockerclient/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/fsouza/go-dockerclient/git/refs{/sha}","trees_url":"https://api.github.com/repos/fsouza/go-dockerclient/git/trees{/sha}","statuses_url":"https://api.github.com/repos/fsouza/go-dockerclient/statuses/{sha}","languages_url":"https://api.github.com/repos/fsouza/go-dockerclient/languages","stargazers_url":"https://api.github.com/repos/fsouza/go-dockerclient/stargazers","contributors_url":"https://api.github.com/repos/fsouza/go-dockerclient/contributors","subscribers_url":"https://api.github.com/repos/fsouza/go-dockerclient/subscribers","subscription_url":"https://api.github.com/repos/fsouza/go-dockerclient/subscription","commits_url":"https://api.github.com/repos/fsouza/go-dockerclient/commits{/sha}","git_commits_url":"https://api.github.com/repos/fsouza/go-dockerclient/git/commits{/sha}","comments_url":"https://api.github.com/repos/fsouza/go-dockerclient/comments{/number}","issue_comment_url":"https://api.github.com/repos/fsouza/go-dockerclient/issues/comments{/number}","contents_url":"https://api.github.com/repos/fsouza/go-dockerclient/contents/{+path}","compare_url":"https://api.github.com/repos/fsouza/go-dockerclient/compare/{base}...{head}","merges_url":"https://api.github.com/repos/fsouza/go-dockerclient/merges","archive_url":"https://api.github.com/repos/fsouza/go-dockerclient/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/fsouza/go-dockerclient/downloads","issues_url":"https://api.github.com/repos/fsouza/go-dockerclient/issues{/number}","pulls_url":"https://api.github.com/repos/fsouza/go-dockerclient/pulls{/number}","milestones_url":"https://api.github.com/repos/fsouza/go-dockerclient/milestones{/number}","notifications_url":"https://api.github.com/repos/fsouza/go-dockerclient/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/fsouza/go-dockerclient/labels{/name}","releases_url":"https://api.github.com/repos/fsouza/go-dockerclient/releases{/id}","created_at":"2013-05-11T11:21:31Z","updated_at":"2015-08-05T04:54:54Z","pushed_at":"2015-08-05T15:48:21Z","git_url":"git://github.com/fsouza/go-dockerclient.git","ssh_url":"git@github.com:fsouza/go-dockerclient.git","clone_url":"https://github.com/fsouza/go-dockerclient.git","svn_url":"https://github.com/fsouza/go-dockerclient","homepage":"https://godoc.org/github.com/fsouza/go-dockerclient","size":3755,"stargazers_count":444,"watchers_count":444,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":170,"mirror_url":null,"open_issues_count":33,"forks":170,"open_issues":33,"watchers":444,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/fsouza/go-dockerclient/pulls/343"},"html":{"href":"https://github.com/fsouza/go-dockerclient/pull/343"},"issue":{"href":"https://api.github.com/repos/fsouza/go-dockerclient/issues/343"},"comments":{"href":"https://api.github.com/repos/fsouza/go-dockerclient/issues/343/comments"},"review_comments":{"href":"https://api.github.com/repos/fsouza/go-dockerclient/pulls/343/comments"},"review_comment":{"href":"https://api.github.com/repos/fsouza/go-dockerclient/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/fsouza/go-dockerclient/pulls/343/commits"},"statuses":{"href":"https://api.github.com/repos/fsouza/go-dockerclient/statuses/9086070361d5587463386a54986cde9f172a7998"}}}}