{"action":"created","comment":{"url":"https://api.github.com/repos/projectcalico/libcalico/pulls/comments/70108884","id":70108884,"diff_hunk":"@@ -0,0 +1,68 @@\n+// Copyright (c) 2016 Tigera, Inc. All rights reserved.\n+\n+// Licensed under the Apache License, Version 2.0 (the \"License\");\n+// you may not use this file except in compliance with the License.\n+// You may obtain a copy of the License at\n+//\n+//     http://www.apache.org/licenses/LICENSE-2.0\n+//\n+// Unless required by applicable law or agreed to in writing, software\n+// distributed under the License is distributed on an \"AS IS\" BASIS,\n+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+// See the License for the specific language governing permissions and\n+// limitations under the License.\n+\n+package api\n+\n+import (\n+\t\"reflect\"\n+\n+\t. \"github.com/projectcalico/libcalico/lib/api/unversioned\"\n+\t. \"github.com/projectcalico/libcalico/lib/common\"\n+\t\"gopkg.in/go-playground/validator.v8\"\n+)\n+\n+type PolicyMetadata struct {\n+\tObjectMetadata\n+\tTier string `json:\"tier,omitempty\" validate:\"omitempty,name\"`\n+}\n+\n+type PolicySpec struct {\n+\tOrder        *float32 `json:\"order,omitempty\"`\n+\tIngressRules []Rule   `json:\"ingress,omitempty\" validate:\"omitempty,dive\"`\n+\tEgressRules  []Rule   `json:\"egress,omitempty\" validate:\"omitempty,dive\"`\n+\tSelector     string   `json:\"selector\" validate:\"selector\"`\n+}\n+\n+type Policy struct {\n+\tTypeMetadata\n+\tMetadata PolicyMetadata `json:\"metadata,omitempty\"`\n+\tSpec     PolicySpec     `json:\"spec,omitempty\"`\n+}\n+\n+func NewPolicy() *Policy {\n+\treturn &Policy{TypeMetadata: TypeMetadata{Kind: \"policy\", APIVersion: \"v1\"}}\n+}\n+\n+type PolicyList struct {\n+\tTypeMetadata\n+\tMetadata ListMetadata `json:\"metadata,omitempty\"`\n+\tItems    []Policy     `json:\"items\" validate:\"dive\"`\n+}\n+\n+func NewPolicyList() *PolicyList {\n+\treturn &PolicyList{TypeMetadata: TypeMetadata{Kind: \"policyList\", APIVersion: \"v1\"}}\n+}\n+\n+// Register v1 structure validators to validate cross-field dependencies in any of the\n+// required structures.\n+func init() {\n+\tRegisterStructValidator(validatePolicy, Policy{})\n+}\n+\n+func validatePolicy(v *validator.Validate, structLevel *validator.StructLevel) {\n+\tpolicy := structLevel.CurrentStruct.Interface().(Policy)\n+\tif policy.Metadata.Tier == DefaultTierName {","path":"lib/api/policy.go","position":65,"original_position":65,"commit_id":"9ba284062aa06d6eacdb4218fe5c6c8e526c0214","original_commit_id":"e09c3102d7d7c22abf9c9d5c5ba424cf9d0e3b2d","user":{"login":"caseydavenport","id":1944093,"avatar_url":"https://avatars.githubusercontent.com/u/1944093?v=3","gravatar_id":"","url":"https://api.github.com/users/caseydavenport","html_url":"https://github.com/caseydavenport","followers_url":"https://api.github.com/users/caseydavenport/followers","following_url":"https://api.github.com/users/caseydavenport/following{/other_user}","gists_url":"https://api.github.com/users/caseydavenport/gists{/gist_id}","starred_url":"https://api.github.com/users/caseydavenport/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/caseydavenport/subscriptions","organizations_url":"https://api.github.com/users/caseydavenport/orgs","repos_url":"https://api.github.com/users/caseydavenport/repos","events_url":"https://api.github.com/users/caseydavenport/events{/privacy}","received_events_url":"https://api.github.com/users/caseydavenport/received_events","type":"User","site_admin":false},"body":"Does this mean you can't explicitly say \"put this in the default tier\"?","created_at":"2016-07-08T17:20:43Z","updated_at":"2016-07-08T17:20:43Z","html_url":"https://github.com/projectcalico/libcalico/pull/130#discussion_r70108884","pull_request_url":"https://api.github.com/repos/projectcalico/libcalico/pulls/130","_links":{"self":{"href":"https://api.github.com/repos/projectcalico/libcalico/pulls/comments/70108884"},"html":{"href":"https://github.com/projectcalico/libcalico/pull/130#discussion_r70108884"},"pull_request":{"href":"https://api.github.com/repos/projectcalico/libcalico/pulls/130"}}},"pull_request":{"url":"https://api.github.com/repos/projectcalico/libcalico/pulls/130","id":76685908,"html_url":"https://github.com/projectcalico/libcalico/pull/130","diff_url":"https://github.com/projectcalico/libcalico/pull/130.diff","patch_url":"https://github.com/projectcalico/libcalico/pull/130.patch","issue_url":"https://api.github.com/repos/projectcalico/libcalico/issues/130","number":130,"state":"open","locked":false,"title":"Initial commit of generic resource processing","user":{"login":"robbrockbank","id":3227729,"avatar_url":"https://avatars.githubusercontent.com/u/3227729?v=3","gravatar_id":"","url":"https://api.github.com/users/robbrockbank","html_url":"https://github.com/robbrockbank","followers_url":"https://api.github.com/users/robbrockbank/followers","following_url":"https://api.github.com/users/robbrockbank/following{/other_user}","gists_url":"https://api.github.com/users/robbrockbank/gists{/gist_id}","starred_url":"https://api.github.com/users/robbrockbank/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/robbrockbank/subscriptions","organizations_url":"https://api.github.com/users/robbrockbank/orgs","repos_url":"https://api.github.com/users/robbrockbank/repos","events_url":"https://api.github.com/users/robbrockbank/events{/privacy}","received_events_url":"https://api.github.com/users/robbrockbank/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-07-08T00:21:39Z","updated_at":"2016-07-08T17:20:43Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8f4382867f021574d68a9dcff1c50d78bb74250d","assignee":{"login":"caseydavenport","id":1944093,"avatar_url":"https://avatars.githubusercontent.com/u/1944093?v=3","gravatar_id":"","url":"https://api.github.com/users/caseydavenport","html_url":"https://github.com/caseydavenport","followers_url":"https://api.github.com/users/caseydavenport/followers","following_url":"https://api.github.com/users/caseydavenport/following{/other_user}","gists_url":"https://api.github.com/users/caseydavenport/gists{/gist_id}","starred_url":"https://api.github.com/users/caseydavenport/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/caseydavenport/subscriptions","organizations_url":"https://api.github.com/users/caseydavenport/orgs","repos_url":"https://api.github.com/users/caseydavenport/repos","events_url":"https://api.github.com/users/caseydavenport/events{/privacy}","received_events_url":"https://api.github.com/users/caseydavenport/received_events","type":"User","site_admin":false},"assignees":[{"login":"caseydavenport","id":1944093,"avatar_url":"https://avatars.githubusercontent.com/u/1944093?v=3","gravatar_id":"","url":"https://api.github.com/users/caseydavenport","html_url":"https://github.com/caseydavenport","followers_url":"https://api.github.com/users/caseydavenport/followers","following_url":"https://api.github.com/users/caseydavenport/following{/other_user}","gists_url":"https://api.github.com/users/caseydavenport/gists{/gist_id}","starred_url":"https://api.github.com/users/caseydavenport/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/caseydavenport/subscriptions","organizations_url":"https://api.github.com/users/caseydavenport/orgs","repos_url":"https://api.github.com/users/caseydavenport/repos","events_url":"https://api.github.com/users/caseydavenport/events{/privacy}","received_events_url":"https://api.github.com/users/caseydavenport/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/projectcalico/libcalico/pulls/130/commits","review_comments_url":"https://api.github.com/repos/projectcalico/libcalico/pulls/130/comments","review_comment_url":"https://api.github.com/repos/projectcalico/libcalico/pulls/comments{/number}","comments_url":"https://api.github.com/repos/projectcalico/libcalico/issues/130/comments","statuses_url":"https://api.github.com/repos/projectcalico/libcalico/statuses/9ba284062aa06d6eacdb4218fe5c6c8e526c0214","head":{"label":"robbrockbank:generic-resource-libcalico","ref":"generic-resource-libcalico","sha":"9ba284062aa06d6eacdb4218fe5c6c8e526c0214","user":{"login":"robbrockbank","id":3227729,"avatar_url":"https://avatars.githubusercontent.com/u/3227729?v=3","gravatar_id":"","url":"https://api.github.com/users/robbrockbank","html_url":"https://github.com/robbrockbank","followers_url":"https://api.github.com/users/robbrockbank/followers","following_url":"https://api.github.com/users/robbrockbank/following{/other_user}","gists_url":"https://api.github.com/users/robbrockbank/gists{/gist_id}","starred_url":"https://api.github.com/users/robbrockbank/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/robbrockbank/subscriptions","organizations_url":"https://api.github.com/users/robbrockbank/orgs","repos_url":"https://api.github.com/users/robbrockbank/repos","events_url":"https://api.github.com/users/robbrockbank/events{/privacy}","received_events_url":"https://api.github.com/users/robbrockbank/received_events","type":"User","site_admin":false},"repo":{"id":39921489,"name":"libcalico","full_name":"robbrockbank/libcalico","owner":{"login":"robbrockbank","id":3227729,"avatar_url":"https://avatars.githubusercontent.com/u/3227729?v=3","gravatar_id":"","url":"https://api.github.com/users/robbrockbank","html_url":"https://github.com/robbrockbank","followers_url":"https://api.github.com/users/robbrockbank/followers","following_url":"https://api.github.com/users/robbrockbank/following{/other_user}","gists_url":"https://api.github.com/users/robbrockbank/gists{/gist_id}","starred_url":"https://api.github.com/users/robbrockbank/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/robbrockbank/subscriptions","organizations_url":"https://api.github.com/users/robbrockbank/orgs","repos_url":"https://api.github.com/users/robbrockbank/repos","events_url":"https://api.github.com/users/robbrockbank/events{/privacy}","received_events_url":"https://api.github.com/users/robbrockbank/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/robbrockbank/libcalico","description":"","fork":true,"url":"https://api.github.com/repos/robbrockbank/libcalico","forks_url":"https://api.github.com/repos/robbrockbank/libcalico/forks","keys_url":"https://api.github.com/repos/robbrockbank/libcalico/keys{/key_id}","collaborators_url":"https://api.github.com/repos/robbrockbank/libcalico/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/robbrockbank/libcalico/teams","hooks_url":"https://api.github.com/repos/robbrockbank/libcalico/hooks","issue_events_url":"https://api.github.com/repos/robbrockbank/libcalico/issues/events{/number}","events_url":"https://api.github.com/repos/robbrockbank/libcalico/events","assignees_url":"https://api.github.com/repos/robbrockbank/libcalico/assignees{/user}","branches_url":"https://api.github.com/repos/robbrockbank/libcalico/branches{/branch}","tags_url":"https://api.github.com/repos/robbrockbank/libcalico/tags","blobs_url":"https://api.github.com/repos/robbrockbank/libcalico/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/robbrockbank/libcalico/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/robbrockbank/libcalico/git/refs{/sha}","trees_url":"https://api.github.com/repos/robbrockbank/libcalico/git/trees{/sha}","statuses_url":"https://api.github.com/repos/robbrockbank/libcalico/statuses/{sha}","languages_url":"https://api.github.com/repos/robbrockbank/libcalico/languages","stargazers_url":"https://api.github.com/repos/robbrockbank/libcalico/stargazers","contributors_url":"https://api.github.com/repos/robbrockbank/libcalico/contributors","subscribers_url":"https://api.github.com/repos/robbrockbank/libcalico/subscribers","subscription_url":"https://api.github.com/repos/robbrockbank/libcalico/subscription","commits_url":"https://api.github.com/repos/robbrockbank/libcalico/commits{/sha}","git_commits_url":"https://api.github.com/repos/robbrockbank/libcalico/git/commits{/sha}","comments_url":"https://api.github.com/repos/robbrockbank/libcalico/comments{/number}","issue_comment_url":"https://api.github.com/repos/robbrockbank/libcalico/issues/comments{/number}","contents_url":"https://api.github.com/repos/robbrockbank/libcalico/contents/{+path}","compare_url":"https://api.github.com/repos/robbrockbank/libcalico/compare/{base}...{head}","merges_url":"https://api.github.com/repos/robbrockbank/libcalico/merges","archive_url":"https://api.github.com/repos/robbrockbank/libcalico/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/robbrockbank/libcalico/downloads","issues_url":"https://api.github.com/repos/robbrockbank/libcalico/issues{/number}","pulls_url":"https://api.github.com/repos/robbrockbank/libcalico/pulls{/number}","milestones_url":"https://api.github.com/repos/robbrockbank/libcalico/milestones{/number}","notifications_url":"https://api.github.com/repos/robbrockbank/libcalico/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/robbrockbank/libcalico/labels{/name}","releases_url":"https://api.github.com/repos/robbrockbank/libcalico/releases{/id}","deployments_url":"https://api.github.com/repos/robbrockbank/libcalico/deployments","created_at":"2015-07-29T23:40:10Z","updated_at":"2015-07-29T23:40:11Z","pushed_at":"2016-07-08T17:19:36Z","git_url":"git://github.com/robbrockbank/libcalico.git","ssh_url":"git@github.com:robbrockbank/libcalico.git","clone_url":"https://github.com/robbrockbank/libcalico.git","svn_url":"https://github.com/robbrockbank/libcalico","homepage":"http://www.projectcalico.org/","size":2235,"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":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"projectcalico:go","ref":"go","sha":"350e251a4583d06b85399f6d89368aea5741e851","user":{"login":"projectcalico","id":12304728,"avatar_url":"https://avatars.githubusercontent.com/u/12304728?v=3","gravatar_id":"","url":"https://api.github.com/users/projectcalico","html_url":"https://github.com/projectcalico","followers_url":"https://api.github.com/users/projectcalico/followers","following_url":"https://api.github.com/users/projectcalico/following{/other_user}","gists_url":"https://api.github.com/users/projectcalico/gists{/gist_id}","starred_url":"https://api.github.com/users/projectcalico/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/projectcalico/subscriptions","organizations_url":"https://api.github.com/users/projectcalico/orgs","repos_url":"https://api.github.com/users/projectcalico/repos","events_url":"https://api.github.com/users/projectcalico/events{/privacy}","received_events_url":"https://api.github.com/users/projectcalico/received_events","type":"Organization","site_admin":false},"repo":{"id":39856396,"name":"libcalico","full_name":"projectcalico/libcalico","owner":{"login":"projectcalico","id":12304728,"avatar_url":"https://avatars.githubusercontent.com/u/12304728?v=3","gravatar_id":"","url":"https://api.github.com/users/projectcalico","html_url":"https://github.com/projectcalico","followers_url":"https://api.github.com/users/projectcalico/followers","following_url":"https://api.github.com/users/projectcalico/following{/other_user}","gists_url":"https://api.github.com/users/projectcalico/gists{/gist_id}","starred_url":"https://api.github.com/users/projectcalico/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/projectcalico/subscriptions","organizations_url":"https://api.github.com/users/projectcalico/orgs","repos_url":"https://api.github.com/users/projectcalico/repos","events_url":"https://api.github.com/users/projectcalico/events{/privacy}","received_events_url":"https://api.github.com/users/projectcalico/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/projectcalico/libcalico","description":"","fork":false,"url":"https://api.github.com/repos/projectcalico/libcalico","forks_url":"https://api.github.com/repos/projectcalico/libcalico/forks","keys_url":"https://api.github.com/repos/projectcalico/libcalico/keys{/key_id}","collaborators_url":"https://api.github.com/repos/projectcalico/libcalico/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/projectcalico/libcalico/teams","hooks_url":"https://api.github.com/repos/projectcalico/libcalico/hooks","issue_events_url":"https://api.github.com/repos/projectcalico/libcalico/issues/events{/number}","events_url":"https://api.github.com/repos/projectcalico/libcalico/events","assignees_url":"https://api.github.com/repos/projectcalico/libcalico/assignees{/user}","branches_url":"https://api.github.com/repos/projectcalico/libcalico/branches{/branch}","tags_url":"https://api.github.com/repos/projectcalico/libcalico/tags","blobs_url":"https://api.github.com/repos/projectcalico/libcalico/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/projectcalico/libcalico/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/projectcalico/libcalico/git/refs{/sha}","trees_url":"https://api.github.com/repos/projectcalico/libcalico/git/trees{/sha}","statuses_url":"https://api.github.com/repos/projectcalico/libcalico/statuses/{sha}","languages_url":"https://api.github.com/repos/projectcalico/libcalico/languages","stargazers_url":"https://api.github.com/repos/projectcalico/libcalico/stargazers","contributors_url":"https://api.github.com/repos/projectcalico/libcalico/contributors","subscribers_url":"https://api.github.com/repos/projectcalico/libcalico/subscribers","subscription_url":"https://api.github.com/repos/projectcalico/libcalico/subscription","commits_url":"https://api.github.com/repos/projectcalico/libcalico/commits{/sha}","git_commits_url":"https://api.github.com/repos/projectcalico/libcalico/git/commits{/sha}","comments_url":"https://api.github.com/repos/projectcalico/libcalico/comments{/number}","issue_comment_url":"https://api.github.com/repos/projectcalico/libcalico/issues/comments{/number}","contents_url":"https://api.github.com/repos/projectcalico/libcalico/contents/{+path}","compare_url":"https://api.github.com/repos/projectcalico/libcalico/compare/{base}...{head}","merges_url":"https://api.github.com/repos/projectcalico/libcalico/merges","archive_url":"https://api.github.com/repos/projectcalico/libcalico/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/projectcalico/libcalico/downloads","issues_url":"https://api.github.com/repos/projectcalico/libcalico/issues{/number}","pulls_url":"https://api.github.com/repos/projectcalico/libcalico/pulls{/number}","milestones_url":"https://api.github.com/repos/projectcalico/libcalico/milestones{/number}","notifications_url":"https://api.github.com/repos/projectcalico/libcalico/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/projectcalico/libcalico/labels{/name}","releases_url":"https://api.github.com/repos/projectcalico/libcalico/releases{/id}","deployments_url":"https://api.github.com/repos/projectcalico/libcalico/deployments","created_at":"2015-07-28T20:33:51Z","updated_at":"2016-06-17T13:55:36Z","pushed_at":"2016-07-08T17:19:36Z","git_url":"git://github.com/projectcalico/libcalico.git","ssh_url":"git@github.com:projectcalico/libcalico.git","clone_url":"https://github.com/projectcalico/libcalico.git","svn_url":"https://github.com/projectcalico/libcalico","homepage":"http://www.projectcalico.org/","size":2730,"stargazers_count":19,"watchers_count":19,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":21,"mirror_url":null,"open_issues_count":12,"forks":21,"open_issues":12,"watchers":19,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/projectcalico/libcalico/pulls/130"},"html":{"href":"https://github.com/projectcalico/libcalico/pull/130"},"issue":{"href":"https://api.github.com/repos/projectcalico/libcalico/issues/130"},"comments":{"href":"https://api.github.com/repos/projectcalico/libcalico/issues/130/comments"},"review_comments":{"href":"https://api.github.com/repos/projectcalico/libcalico/pulls/130/comments"},"review_comment":{"href":"https://api.github.com/repos/projectcalico/libcalico/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/projectcalico/libcalico/pulls/130/commits"},"statuses":{"href":"https://api.github.com/repos/projectcalico/libcalico/statuses/9ba284062aa06d6eacdb4218fe5c6c8e526c0214"}}}}
{"actor":{"display_login":"caseydavenport"}}