{"action":"created","comment":{"url":"https://api.github.com/repos/improbable-eng/thanos/pulls/comments/216719224","pull_request_review_id":154267472,"id":216719224,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIxNjcxOTIyNA==","diff_hunk":"@@ -3,39 +3,57 @@ package client\n import (\n \t\"context\"\n \t\"fmt\"\n-\t\"runtime\"\n \n-\t\"cloud.google.com/go/storage\"\n \t\"github.com/go-kit/kit/log\"\n \t\"github.com/improbable-eng/thanos/pkg/objstore\"\n \t\"github.com/improbable-eng/thanos/pkg/objstore/gcs\"\n \t\"github.com/improbable-eng/thanos/pkg/objstore/s3\"\n \t\"github.com/pkg/errors\"\n \t\"github.com/prometheus/client_golang/prometheus\"\n-\t\"github.com/prometheus/common/version\"\n-\t\"google.golang.org/api/option\"\n+\tyaml \"gopkg.in/yaml.v2\"\n )\n \n-var ErrNotFound = errors.New(\"no valid GCS or S3 configuration supplied\")\n+type objProvider string\n+\n+const (\n+\tGCS objProvider = \"GCS\"\n+\tS3  objProvider = \"S3\"\n+)\n+\n+type BucketConfig struct {\n+\tType   objProvider `yaml:\"type\"`\n+\tConfig interface{} `yaml:\"config\"`\n+}\n+\n+var ErrNotFound = errors.New(\"not found bucket\")\n \n // NewBucket initializes and returns new object storage clients.\n-func NewBucket(logger log.Logger, gcsBucket *string, s3Config s3.Config, reg *prometheus.Registry, component string) (objstore.Bucket, error) {\n-\tif *gcsBucket != \"\" {\n-\t\tgcsOptions := option.WithUserAgent(fmt.Sprintf(\"thanos-%s/%s (%s)\", component, version.Version, runtime.Version()))\n-\t\tgcsClient, err := storage.NewClient(context.Background(), gcsOptions)\n-\t\tif err != nil {\n-\t\t\treturn nil, errors.Wrap(err, \"create GCS client\")\n-\t\t}\n-\t\treturn objstore.BucketWithMetrics(*gcsBucket, gcs.NewBucket(*gcsBucket, gcsClient, reg), reg), nil\n+func NewBucket(logger log.Logger, conf string, reg *prometheus.Registry, component string) (objstore.Bucket, error) {","path":"pkg/objstore/client/factory.go","position":42,"original_position":42,"commit_id":"c0ae0e608223445a9477d0092fc0a775dc17bd94","original_commit_id":"1c166eb70c1ed2fa9c30ea669560c0280941d54d","user":{"login":"Bplotka","id":6950331,"node_id":"MDQ6VXNlcjY5NTAzMzE=","avatar_url":"https://avatars2.githubusercontent.com/u/6950331?v=4","gravatar_id":"","url":"https://api.github.com/users/Bplotka","html_url":"https://github.com/Bplotka","followers_url":"https://api.github.com/users/Bplotka/followers","following_url":"https://api.github.com/users/Bplotka/following{/other_user}","gists_url":"https://api.github.com/users/Bplotka/gists{/gist_id}","starred_url":"https://api.github.com/users/Bplotka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Bplotka/subscriptions","organizations_url":"https://api.github.com/users/Bplotka/orgs","repos_url":"https://api.github.com/users/Bplotka/repos","events_url":"https://api.github.com/users/Bplotka/events{/privacy}","received_events_url":"https://api.github.com/users/Bplotka/received_events","type":"User","site_admin":false},"body":"yup, let's do it","created_at":"2018-09-11T15:45:15Z","updated_at":"2018-09-11T15:45:15Z","html_url":"https://github.com/improbable-eng/thanos/pull/500#discussion_r216719224","pull_request_url":"https://api.github.com/repos/improbable-eng/thanos/pulls/500","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/improbable-eng/thanos/pulls/comments/216719224"},"html":{"href":"https://github.com/improbable-eng/thanos/pull/500#discussion_r216719224"},"pull_request":{"href":"https://api.github.com/repos/improbable-eng/thanos/pulls/500"}},"in_reply_to_id":216658689},"pull_request":{"url":"https://api.github.com/repos/improbable-eng/thanos/pulls/500","id":212333280,"node_id":"MDExOlB1bGxSZXF1ZXN0MjEyMzMzMjgw","html_url":"https://github.com/improbable-eng/thanos/pull/500","diff_url":"https://github.com/improbable-eng/thanos/pull/500.diff","patch_url":"https://github.com/improbable-eng/thanos/pull/500.patch","issue_url":"https://api.github.com/repos/improbable-eng/thanos/issues/500","number":500,"state":"open","locked":false,"title":"Set unified flags for Object Store","user":{"login":"jojohappy","id":2532941,"node_id":"MDQ6VXNlcjI1MzI5NDE=","avatar_url":"https://avatars3.githubusercontent.com/u/2532941?v=4","gravatar_id":"","url":"https://api.github.com/users/jojohappy","html_url":"https://github.com/jojohappy","followers_url":"https://api.github.com/users/jojohappy/followers","following_url":"https://api.github.com/users/jojohappy/following{/other_user}","gists_url":"https://api.github.com/users/jojohappy/gists{/gist_id}","starred_url":"https://api.github.com/users/jojohappy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jojohappy/subscriptions","organizations_url":"https://api.github.com/users/jojohappy/orgs","repos_url":"https://api.github.com/users/jojohappy/repos","events_url":"https://api.github.com/users/jojohappy/events{/privacy}","received_events_url":"https://api.github.com/users/jojohappy/received_events","type":"User","site_admin":false},"body":"<!--\r\n    Keep PR title verbose enough and add prefix telling\r\n    about what components it touches e.g \"query:\" or \".*:\"\r\n-->\r\n\r\n## Changes\r\n\r\n<!-- Enumerate changes you made -->\r\nThis PR try to make some unified bucket flags for all provider.  User should set the `--provider.type` to represent which provider they use. And all flags will be reused for all provider now. This aim is to reduce the number of flags when new provider appended if it can reuse the flags have been exists. \r\n\r\n## Verification\r\n\r\n<!-- How you tested it? How do you know it works? -->\r\nUser can run the `thanos bucket ls` to verify this PR\r\n","created_at":"2018-08-31T09:58:16Z","updated_at":"2018-09-11T15:45:15Z","closed_at":null,"merged_at":null,"merge_commit_sha":"faf38aa14b5ba7baed74321690869d38c4bf79e9","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/improbable-eng/thanos/pulls/500/commits","review_comments_url":"https://api.github.com/repos/improbable-eng/thanos/pulls/500/comments","review_comment_url":"https://api.github.com/repos/improbable-eng/thanos/pulls/comments{/number}","comments_url":"https://api.github.com/repos/improbable-eng/thanos/issues/500/comments","statuses_url":"https://api.github.com/repos/improbable-eng/thanos/statuses/c0ae0e608223445a9477d0092fc0a775dc17bd94","head":{"label":"jojohappy:set_unified_flag_for_store","ref":"set_unified_flag_for_store","sha":"c0ae0e608223445a9477d0092fc0a775dc17bd94","user":{"login":"jojohappy","id":2532941,"node_id":"MDQ6VXNlcjI1MzI5NDE=","avatar_url":"https://avatars3.githubusercontent.com/u/2532941?v=4","gravatar_id":"","url":"https://api.github.com/users/jojohappy","html_url":"https://github.com/jojohappy","followers_url":"https://api.github.com/users/jojohappy/followers","following_url":"https://api.github.com/users/jojohappy/following{/other_user}","gists_url":"https://api.github.com/users/jojohappy/gists{/gist_id}","starred_url":"https://api.github.com/users/jojohappy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jojohappy/subscriptions","organizations_url":"https://api.github.com/users/jojohappy/orgs","repos_url":"https://api.github.com/users/jojohappy/repos","events_url":"https://api.github.com/users/jojohappy/events{/privacy}","received_events_url":"https://api.github.com/users/jojohappy/received_events","type":"User","site_admin":false},"repo":{"id":140850341,"node_id":"MDEwOlJlcG9zaXRvcnkxNDA4NTAzNDE=","name":"thanos","full_name":"jojohappy/thanos","owner":{"login":"jojohappy","id":2532941,"node_id":"MDQ6VXNlcjI1MzI5NDE=","avatar_url":"https://avatars3.githubusercontent.com/u/2532941?v=4","gravatar_id":"","url":"https://api.github.com/users/jojohappy","html_url":"https://github.com/jojohappy","followers_url":"https://api.github.com/users/jojohappy/followers","following_url":"https://api.github.com/users/jojohappy/following{/other_user}","gists_url":"https://api.github.com/users/jojohappy/gists{/gist_id}","starred_url":"https://api.github.com/users/jojohappy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jojohappy/subscriptions","organizations_url":"https://api.github.com/users/jojohappy/orgs","repos_url":"https://api.github.com/users/jojohappy/repos","events_url":"https://api.github.com/users/jojohappy/events{/privacy}","received_events_url":"https://api.github.com/users/jojohappy/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jojohappy/thanos","description":"Highly available Prometheus setup with long term storage capabilities.","fork":true,"url":"https://api.github.com/repos/jojohappy/thanos","forks_url":"https://api.github.com/repos/jojohappy/thanos/forks","keys_url":"https://api.github.com/repos/jojohappy/thanos/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jojohappy/thanos/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jojohappy/thanos/teams","hooks_url":"https://api.github.com/repos/jojohappy/thanos/hooks","issue_events_url":"https://api.github.com/repos/jojohappy/thanos/issues/events{/number}","events_url":"https://api.github.com/repos/jojohappy/thanos/events","assignees_url":"https://api.github.com/repos/jojohappy/thanos/assignees{/user}","branches_url":"https://api.github.com/repos/jojohappy/thanos/branches{/branch}","tags_url":"https://api.github.com/repos/jojohappy/thanos/tags","blobs_url":"https://api.github.com/repos/jojohappy/thanos/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jojohappy/thanos/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jojohappy/thanos/git/refs{/sha}","trees_url":"https://api.github.com/repos/jojohappy/thanos/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jojohappy/thanos/statuses/{sha}","languages_url":"https://api.github.com/repos/jojohappy/thanos/languages","stargazers_url":"https://api.github.com/repos/jojohappy/thanos/stargazers","contributors_url":"https://api.github.com/repos/jojohappy/thanos/contributors","subscribers_url":"https://api.github.com/repos/jojohappy/thanos/subscribers","subscription_url":"https://api.github.com/repos/jojohappy/thanos/subscription","commits_url":"https://api.github.com/repos/jojohappy/thanos/commits{/sha}","git_commits_url":"https://api.github.com/repos/jojohappy/thanos/git/commits{/sha}","comments_url":"https://api.github.com/repos/jojohappy/thanos/comments{/number}","issue_comment_url":"https://api.github.com/repos/jojohappy/thanos/issues/comments{/number}","contents_url":"https://api.github.com/repos/jojohappy/thanos/contents/{+path}","compare_url":"https://api.github.com/repos/jojohappy/thanos/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jojohappy/thanos/merges","archive_url":"https://api.github.com/repos/jojohappy/thanos/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jojohappy/thanos/downloads","issues_url":"https://api.github.com/repos/jojohappy/thanos/issues{/number}","pulls_url":"https://api.github.com/repos/jojohappy/thanos/pulls{/number}","milestones_url":"https://api.github.com/repos/jojohappy/thanos/milestones{/number}","notifications_url":"https://api.github.com/repos/jojohappy/thanos/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jojohappy/thanos/labels{/name}","releases_url":"https://api.github.com/repos/jojohappy/thanos/releases{/id}","deployments_url":"https://api.github.com/repos/jojohappy/thanos/deployments","created_at":"2018-07-13T13:27:57Z","updated_at":"2018-08-17T09:02:37Z","pushed_at":"2018-09-11T15:27:37Z","git_url":"git://github.com/jojohappy/thanos.git","ssh_url":"git@github.com:jojohappy/thanos.git","clone_url":"https://github.com/jojohappy/thanos.git","svn_url":"https://github.com/jojohappy/thanos","homepage":"","size":55209,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"improbable-eng:master","ref":"master","sha":"c0a2e8f32df176975e05d3e2e5c06ec09554db2b","user":{"login":"improbable-eng","id":26084283,"node_id":"MDEyOk9yZ2FuaXphdGlvbjI2MDg0Mjgz","avatar_url":"https://avatars2.githubusercontent.com/u/26084283?v=4","gravatar_id":"","url":"https://api.github.com/users/improbable-eng","html_url":"https://github.com/improbable-eng","followers_url":"https://api.github.com/users/improbable-eng/followers","following_url":"https://api.github.com/users/improbable-eng/following{/other_user}","gists_url":"https://api.github.com/users/improbable-eng/gists{/gist_id}","starred_url":"https://api.github.com/users/improbable-eng/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/improbable-eng/subscriptions","organizations_url":"https://api.github.com/users/improbable-eng/orgs","repos_url":"https://api.github.com/users/improbable-eng/repos","events_url":"https://api.github.com/users/improbable-eng/events{/privacy}","received_events_url":"https://api.github.com/users/improbable-eng/received_events","type":"Organization","site_admin":false},"repo":{"id":109162639,"node_id":"MDEwOlJlcG9zaXRvcnkxMDkxNjI2Mzk=","name":"thanos","full_name":"improbable-eng/thanos","owner":{"login":"improbable-eng","id":26084283,"node_id":"MDEyOk9yZ2FuaXphdGlvbjI2MDg0Mjgz","avatar_url":"https://avatars2.githubusercontent.com/u/26084283?v=4","gravatar_id":"","url":"https://api.github.com/users/improbable-eng","html_url":"https://github.com/improbable-eng","followers_url":"https://api.github.com/users/improbable-eng/followers","following_url":"https://api.github.com/users/improbable-eng/following{/other_user}","gists_url":"https://api.github.com/users/improbable-eng/gists{/gist_id}","starred_url":"https://api.github.com/users/improbable-eng/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/improbable-eng/subscriptions","organizations_url":"https://api.github.com/users/improbable-eng/orgs","repos_url":"https://api.github.com/users/improbable-eng/repos","events_url":"https://api.github.com/users/improbable-eng/events{/privacy}","received_events_url":"https://api.github.com/users/improbable-eng/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/improbable-eng/thanos","description":"Highly available Prometheus setup with long term storage capabilities.","fork":false,"url":"https://api.github.com/repos/improbable-eng/thanos","forks_url":"https://api.github.com/repos/improbable-eng/thanos/forks","keys_url":"https://api.github.com/repos/improbable-eng/thanos/keys{/key_id}","collaborators_url":"https://api.github.com/repos/improbable-eng/thanos/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/improbable-eng/thanos/teams","hooks_url":"https://api.github.com/repos/improbable-eng/thanos/hooks","issue_events_url":"https://api.github.com/repos/improbable-eng/thanos/issues/events{/number}","events_url":"https://api.github.com/repos/improbable-eng/thanos/events","assignees_url":"https://api.github.com/repos/improbable-eng/thanos/assignees{/user}","branches_url":"https://api.github.com/repos/improbable-eng/thanos/branches{/branch}","tags_url":"https://api.github.com/repos/improbable-eng/thanos/tags","blobs_url":"https://api.github.com/repos/improbable-eng/thanos/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/improbable-eng/thanos/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/improbable-eng/thanos/git/refs{/sha}","trees_url":"https://api.github.com/repos/improbable-eng/thanos/git/trees{/sha}","statuses_url":"https://api.github.com/repos/improbable-eng/thanos/statuses/{sha}","languages_url":"https://api.github.com/repos/improbable-eng/thanos/languages","stargazers_url":"https://api.github.com/repos/improbable-eng/thanos/stargazers","contributors_url":"https://api.github.com/repos/improbable-eng/thanos/contributors","subscribers_url":"https://api.github.com/repos/improbable-eng/thanos/subscribers","subscription_url":"https://api.github.com/repos/improbable-eng/thanos/subscription","commits_url":"https://api.github.com/repos/improbable-eng/thanos/commits{/sha}","git_commits_url":"https://api.github.com/repos/improbable-eng/thanos/git/commits{/sha}","comments_url":"https://api.github.com/repos/improbable-eng/thanos/comments{/number}","issue_comment_url":"https://api.github.com/repos/improbable-eng/thanos/issues/comments{/number}","contents_url":"https://api.github.com/repos/improbable-eng/thanos/contents/{+path}","compare_url":"https://api.github.com/repos/improbable-eng/thanos/compare/{base}...{head}","merges_url":"https://api.github.com/repos/improbable-eng/thanos/merges","archive_url":"https://api.github.com/repos/improbable-eng/thanos/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/improbable-eng/thanos/downloads","issues_url":"https://api.github.com/repos/improbable-eng/thanos/issues{/number}","pulls_url":"https://api.github.com/repos/improbable-eng/thanos/pulls{/number}","milestones_url":"https://api.github.com/repos/improbable-eng/thanos/milestones{/number}","notifications_url":"https://api.github.com/repos/improbable-eng/thanos/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/improbable-eng/thanos/labels{/name}","releases_url":"https://api.github.com/repos/improbable-eng/thanos/releases{/id}","deployments_url":"https://api.github.com/repos/improbable-eng/thanos/deployments","created_at":"2017-11-01T17:38:03Z","updated_at":"2018-09-11T11:45:57Z","pushed_at":"2018-09-11T15:27:39Z","git_url":"git://github.com/improbable-eng/thanos.git","ssh_url":"git@github.com:improbable-eng/thanos.git","clone_url":"https://github.com/improbable-eng/thanos.git","svn_url":"https://github.com/improbable-eng/thanos","homepage":"","size":55178,"stargazers_count":1963,"watchers_count":1963,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":137,"mirror_url":null,"archived":false,"open_issues_count":88,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":137,"open_issues":88,"watchers":1963,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/improbable-eng/thanos/pulls/500"},"html":{"href":"https://github.com/improbable-eng/thanos/pull/500"},"issue":{"href":"https://api.github.com/repos/improbable-eng/thanos/issues/500"},"comments":{"href":"https://api.github.com/repos/improbable-eng/thanos/issues/500/comments"},"review_comments":{"href":"https://api.github.com/repos/improbable-eng/thanos/pulls/500/comments"},"review_comment":{"href":"https://api.github.com/repos/improbable-eng/thanos/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/improbable-eng/thanos/pulls/500/commits"},"statuses":{"href":"https://api.github.com/repos/improbable-eng/thanos/statuses/c0ae0e608223445a9477d0092fc0a775dc17bd94"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"Bplotka"}}