{"action":"created","comment":{"url":"https://api.github.com/repos/spinnaker/front50/pulls/comments/64151690","id":64151690,"diff_hunk":"@@ -0,0 +1,174 @@\n+/*\n+ * Copyright 2016 Google, Inc.\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+\n+package com.netflix.spinnaker.front50.config;\n+\n+import com.netflix.spinnaker.front50.model.*;\n+import com.google.api.services.storage.Storage;\n+import com.google.api.services.storage.StorageScopes;\n+import com.google.api.services.storage.model.Bucket;\n+import com.google.api.client.googleapis.auth.oauth2.GoogleCredential;\n+import com.google.api.client.googleapis.javanet.GoogleNetHttpTransport;\n+import com.google.api.client.http.HttpResponseException;\n+import com.google.api.client.http.HttpTransport;\n+import com.google.api.client.json.JsonFactory;\n+import com.google.api.client.json.jackson2.JacksonFactory;\n+\n+import com.fasterxml.jackson.databind.ObjectMapper;\n+import org.springframework.beans.factory.annotation.Value;\n+import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;\n+import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;\n+import org.springframework.context.annotation.Bean;\n+import org.springframework.context.annotation.Configuration;\n+import org.springframework.web.client.RestTemplate;\n+import org.slf4j.Logger;\n+import org.slf4j.LoggerFactory;\n+import rx.schedulers.Schedulers;\n+\n+import java.io.FileInputStream;\n+import java.io.IOException;\n+import java.util.concurrent.Executors;\n+import java.util.Collections;\n+\n+@Configuration\n+public class GcsConfig {\n+  // Refresh every 10 minutes. In practice this either doesnt matter because refreshes are fast enough,\n+  // or should be finer tuned. But it seems silly to refresh at a fast rate when changes are generally infrequent.\n+  // Actual queries always check to see if the cache is out of date anyway. So this is mostly for the benefit of\n+  // keeping other replicas up to date so that last-minute updates have fewer changes in them.\n+  private static int APPLICATION_REFRESH_INTERVAL = 10 * 60;\n+  private static int PROJECT_REFRESH_INTERVAL = 10 * 60;\n+  private static int NOTIFICATION_REFRESH_INTERVAL = 10 * 60;\n+  private static int PIPELINE_REFRESH_INTERVAL = 10 * 60;\n+  private static int PIPELINE_STRATEGY_REFRESH_INTERVAL = 10 * 60;\n+\n+  @Value(\"${spinnaker.gcs.bucket}\")\n+  private String bucket;\n+\n+  @Value(\"${spinnaker.gcs.rootFolder}\")\n+  private String rootFolder;\n+\n+  @Value(\"${providers.google.primaryCredentials.jsonPath}\")","path":"front50-gcs/src/main/java/com/netflix/spinnaker/front50/config/GcsConfig.java","position":64,"original_position":64,"commit_id":"d981ff6d37d616c89fb30849067ed51df28a0b8c","original_commit_id":"d981ff6d37d616c89fb30849067ed51df28a0b8c","user":{"login":"ajordens","id":388652,"avatar_url":"https://avatars.githubusercontent.com/u/388652?v=3","gravatar_id":"","url":"https://api.github.com/users/ajordens","html_url":"https://github.com/ajordens","followers_url":"https://api.github.com/users/ajordens/followers","following_url":"https://api.github.com/users/ajordens/following{/other_user}","gists_url":"https://api.github.com/users/ajordens/gists{/gist_id}","starred_url":"https://api.github.com/users/ajordens/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ajordens/subscriptions","organizations_url":"https://api.github.com/users/ajordens/orgs","repos_url":"https://api.github.com/users/ajordens/repos","events_url":"https://api.github.com/users/ajordens/events{/privacy}","received_events_url":"https://api.github.com/users/ajordens/received_events","type":"User","site_admin":false},"body":"`providers.google` seems like an odd configuration path ... certainly for `front50`. Is this config path used in other services?\r\n\r\nWhy wouldn't you keep this under `spinnaker.gcs`?\r\n","created_at":"2016-05-22T15:38:33Z","updated_at":"2016-05-22T15:38:33Z","html_url":"https://github.com/spinnaker/front50/pull/93#discussion_r64151690","pull_request_url":"https://api.github.com/repos/spinnaker/front50/pulls/93","_links":{"self":{"href":"https://api.github.com/repos/spinnaker/front50/pulls/comments/64151690"},"html":{"href":"https://github.com/spinnaker/front50/pull/93#discussion_r64151690"},"pull_request":{"href":"https://api.github.com/repos/spinnaker/front50/pulls/93"}}},"pull_request":{"url":"https://api.github.com/repos/spinnaker/front50/pulls/93","id":70738135,"html_url":"https://github.com/spinnaker/front50/pull/93","diff_url":"https://github.com/spinnaker/front50/pull/93.diff","patch_url":"https://github.com/spinnaker/front50/pull/93.patch","issue_url":"https://api.github.com/repos/spinnaker/front50/issues/93","number":93,"state":"open","locked":false,"title":"Added Google Cloud Storage alternative to Cassandra.","user":{"login":"ewiseblatt","id":4367384,"avatar_url":"https://avatars.githubusercontent.com/u/4367384?v=3","gravatar_id":"","url":"https://api.github.com/users/ewiseblatt","html_url":"https://github.com/ewiseblatt","followers_url":"https://api.github.com/users/ewiseblatt/followers","following_url":"https://api.github.com/users/ewiseblatt/following{/other_user}","gists_url":"https://api.github.com/users/ewiseblatt/gists{/gist_id}","starred_url":"https://api.github.com/users/ewiseblatt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ewiseblatt/subscriptions","organizations_url":"https://api.github.com/users/ewiseblatt/orgs","repos_url":"https://api.github.com/users/ewiseblatt/repos","events_url":"https://api.github.com/users/ewiseblatt/events{/privacy}","received_events_url":"https://api.github.com/users/ewiseblatt/received_events","type":"User","site_admin":false},"body":"@duftler, @ajordens \r\n\r\nI'm not going to refactor.\r\n\r\nAlso, it turns out you cannot batch operations that upload/download storage content.\r\nThat's too bad, since the content is small and the size of the JSON data that would otherwise be in a batched query/response.","created_at":"2016-05-19T18:00:22Z","updated_at":"2016-05-22T15:38:33Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0ef12163a9fb37ed314c4cc68c9ddcc9b33068cc","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/spinnaker/front50/pulls/93/commits","review_comments_url":"https://api.github.com/repos/spinnaker/front50/pulls/93/comments","review_comment_url":"https://api.github.com/repos/spinnaker/front50/pulls/comments{/number}","comments_url":"https://api.github.com/repos/spinnaker/front50/issues/93/comments","statuses_url":"https://api.github.com/repos/spinnaker/front50/statuses/d981ff6d37d616c89fb30849067ed51df28a0b8c","head":{"label":"ewiseblatt:gcs","ref":"gcs","sha":"d981ff6d37d616c89fb30849067ed51df28a0b8c","user":{"login":"ewiseblatt","id":4367384,"avatar_url":"https://avatars.githubusercontent.com/u/4367384?v=3","gravatar_id":"","url":"https://api.github.com/users/ewiseblatt","html_url":"https://github.com/ewiseblatt","followers_url":"https://api.github.com/users/ewiseblatt/followers","following_url":"https://api.github.com/users/ewiseblatt/following{/other_user}","gists_url":"https://api.github.com/users/ewiseblatt/gists{/gist_id}","starred_url":"https://api.github.com/users/ewiseblatt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ewiseblatt/subscriptions","organizations_url":"https://api.github.com/users/ewiseblatt/orgs","repos_url":"https://api.github.com/users/ewiseblatt/repos","events_url":"https://api.github.com/users/ewiseblatt/events{/privacy}","received_events_url":"https://api.github.com/users/ewiseblatt/received_events","type":"User","site_admin":false},"repo":{"id":53951035,"name":"front50","full_name":"ewiseblatt/front50","owner":{"login":"ewiseblatt","id":4367384,"avatar_url":"https://avatars.githubusercontent.com/u/4367384?v=3","gravatar_id":"","url":"https://api.github.com/users/ewiseblatt","html_url":"https://github.com/ewiseblatt","followers_url":"https://api.github.com/users/ewiseblatt/followers","following_url":"https://api.github.com/users/ewiseblatt/following{/other_user}","gists_url":"https://api.github.com/users/ewiseblatt/gists{/gist_id}","starred_url":"https://api.github.com/users/ewiseblatt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ewiseblatt/subscriptions","organizations_url":"https://api.github.com/users/ewiseblatt/orgs","repos_url":"https://api.github.com/users/ewiseblatt/repos","events_url":"https://api.github.com/users/ewiseblatt/events{/privacy}","received_events_url":"https://api.github.com/users/ewiseblatt/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ewiseblatt/front50","description":"Cross-Application Persistence Service","fork":true,"url":"https://api.github.com/repos/ewiseblatt/front50","forks_url":"https://api.github.com/repos/ewiseblatt/front50/forks","keys_url":"https://api.github.com/repos/ewiseblatt/front50/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ewiseblatt/front50/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ewiseblatt/front50/teams","hooks_url":"https://api.github.com/repos/ewiseblatt/front50/hooks","issue_events_url":"https://api.github.com/repos/ewiseblatt/front50/issues/events{/number}","events_url":"https://api.github.com/repos/ewiseblatt/front50/events","assignees_url":"https://api.github.com/repos/ewiseblatt/front50/assignees{/user}","branches_url":"https://api.github.com/repos/ewiseblatt/front50/branches{/branch}","tags_url":"https://api.github.com/repos/ewiseblatt/front50/tags","blobs_url":"https://api.github.com/repos/ewiseblatt/front50/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ewiseblatt/front50/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ewiseblatt/front50/git/refs{/sha}","trees_url":"https://api.github.com/repos/ewiseblatt/front50/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ewiseblatt/front50/statuses/{sha}","languages_url":"https://api.github.com/repos/ewiseblatt/front50/languages","stargazers_url":"https://api.github.com/repos/ewiseblatt/front50/stargazers","contributors_url":"https://api.github.com/repos/ewiseblatt/front50/contributors","subscribers_url":"https://api.github.com/repos/ewiseblatt/front50/subscribers","subscription_url":"https://api.github.com/repos/ewiseblatt/front50/subscription","commits_url":"https://api.github.com/repos/ewiseblatt/front50/commits{/sha}","git_commits_url":"https://api.github.com/repos/ewiseblatt/front50/git/commits{/sha}","comments_url":"https://api.github.com/repos/ewiseblatt/front50/comments{/number}","issue_comment_url":"https://api.github.com/repos/ewiseblatt/front50/issues/comments{/number}","contents_url":"https://api.github.com/repos/ewiseblatt/front50/contents/{+path}","compare_url":"https://api.github.com/repos/ewiseblatt/front50/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ewiseblatt/front50/merges","archive_url":"https://api.github.com/repos/ewiseblatt/front50/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ewiseblatt/front50/downloads","issues_url":"https://api.github.com/repos/ewiseblatt/front50/issues{/number}","pulls_url":"https://api.github.com/repos/ewiseblatt/front50/pulls{/number}","milestones_url":"https://api.github.com/repos/ewiseblatt/front50/milestones{/number}","notifications_url":"https://api.github.com/repos/ewiseblatt/front50/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ewiseblatt/front50/labels{/name}","releases_url":"https://api.github.com/repos/ewiseblatt/front50/releases{/id}","deployments_url":"https://api.github.com/repos/ewiseblatt/front50/deployments","created_at":"2016-03-15T14:25:55Z","updated_at":"2016-03-15T14:25:56Z","pushed_at":"2016-05-19T17:55:26Z","git_url":"git://github.com/ewiseblatt/front50.git","ssh_url":"git@github.com:ewiseblatt/front50.git","clone_url":"https://github.com/ewiseblatt/front50.git","svn_url":"https://github.com/ewiseblatt/front50","homepage":"","size":720,"stargazers_count":0,"watchers_count":0,"language":"Groovy","has_issues":false,"has_downloads":true,"has_wiki":false,"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":"spinnaker:master","ref":"master","sha":"41b614b11d95caef22f84c8f75b2a45f73f0e965","user":{"login":"spinnaker","id":7634182,"avatar_url":"https://avatars.githubusercontent.com/u/7634182?v=3","gravatar_id":"","url":"https://api.github.com/users/spinnaker","html_url":"https://github.com/spinnaker","followers_url":"https://api.github.com/users/spinnaker/followers","following_url":"https://api.github.com/users/spinnaker/following{/other_user}","gists_url":"https://api.github.com/users/spinnaker/gists{/gist_id}","starred_url":"https://api.github.com/users/spinnaker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spinnaker/subscriptions","organizations_url":"https://api.github.com/users/spinnaker/orgs","repos_url":"https://api.github.com/users/spinnaker/repos","events_url":"https://api.github.com/users/spinnaker/events{/privacy}","received_events_url":"https://api.github.com/users/spinnaker/received_events","type":"Organization","site_admin":false},"repo":{"id":21367721,"name":"front50","full_name":"spinnaker/front50","owner":{"login":"spinnaker","id":7634182,"avatar_url":"https://avatars.githubusercontent.com/u/7634182?v=3","gravatar_id":"","url":"https://api.github.com/users/spinnaker","html_url":"https://github.com/spinnaker","followers_url":"https://api.github.com/users/spinnaker/followers","following_url":"https://api.github.com/users/spinnaker/following{/other_user}","gists_url":"https://api.github.com/users/spinnaker/gists{/gist_id}","starred_url":"https://api.github.com/users/spinnaker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spinnaker/subscriptions","organizations_url":"https://api.github.com/users/spinnaker/orgs","repos_url":"https://api.github.com/users/spinnaker/repos","events_url":"https://api.github.com/users/spinnaker/events{/privacy}","received_events_url":"https://api.github.com/users/spinnaker/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/spinnaker/front50","description":"Cross-Application Persistence Service","fork":false,"url":"https://api.github.com/repos/spinnaker/front50","forks_url":"https://api.github.com/repos/spinnaker/front50/forks","keys_url":"https://api.github.com/repos/spinnaker/front50/keys{/key_id}","collaborators_url":"https://api.github.com/repos/spinnaker/front50/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/spinnaker/front50/teams","hooks_url":"https://api.github.com/repos/spinnaker/front50/hooks","issue_events_url":"https://api.github.com/repos/spinnaker/front50/issues/events{/number}","events_url":"https://api.github.com/repos/spinnaker/front50/events","assignees_url":"https://api.github.com/repos/spinnaker/front50/assignees{/user}","branches_url":"https://api.github.com/repos/spinnaker/front50/branches{/branch}","tags_url":"https://api.github.com/repos/spinnaker/front50/tags","blobs_url":"https://api.github.com/repos/spinnaker/front50/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/spinnaker/front50/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/spinnaker/front50/git/refs{/sha}","trees_url":"https://api.github.com/repos/spinnaker/front50/git/trees{/sha}","statuses_url":"https://api.github.com/repos/spinnaker/front50/statuses/{sha}","languages_url":"https://api.github.com/repos/spinnaker/front50/languages","stargazers_url":"https://api.github.com/repos/spinnaker/front50/stargazers","contributors_url":"https://api.github.com/repos/spinnaker/front50/contributors","subscribers_url":"https://api.github.com/repos/spinnaker/front50/subscribers","subscription_url":"https://api.github.com/repos/spinnaker/front50/subscription","commits_url":"https://api.github.com/repos/spinnaker/front50/commits{/sha}","git_commits_url":"https://api.github.com/repos/spinnaker/front50/git/commits{/sha}","comments_url":"https://api.github.com/repos/spinnaker/front50/comments{/number}","issue_comment_url":"https://api.github.com/repos/spinnaker/front50/issues/comments{/number}","contents_url":"https://api.github.com/repos/spinnaker/front50/contents/{+path}","compare_url":"https://api.github.com/repos/spinnaker/front50/compare/{base}...{head}","merges_url":"https://api.github.com/repos/spinnaker/front50/merges","archive_url":"https://api.github.com/repos/spinnaker/front50/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/spinnaker/front50/downloads","issues_url":"https://api.github.com/repos/spinnaker/front50/issues{/number}","pulls_url":"https://api.github.com/repos/spinnaker/front50/pulls{/number}","milestones_url":"https://api.github.com/repos/spinnaker/front50/milestones{/number}","notifications_url":"https://api.github.com/repos/spinnaker/front50/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/spinnaker/front50/labels{/name}","releases_url":"https://api.github.com/repos/spinnaker/front50/releases{/id}","deployments_url":"https://api.github.com/repos/spinnaker/front50/deployments","created_at":"2014-06-30T22:17:10Z","updated_at":"2016-05-17T04:18:00Z","pushed_at":"2016-05-19T18:00:22Z","git_url":"git://github.com/spinnaker/front50.git","ssh_url":"git@github.com:spinnaker/front50.git","clone_url":"https://github.com/spinnaker/front50.git","svn_url":"https://github.com/spinnaker/front50","homepage":"","size":957,"stargazers_count":10,"watchers_count":10,"language":"Groovy","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":27,"mirror_url":null,"open_issues_count":2,"forks":27,"open_issues":2,"watchers":10,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/spinnaker/front50/pulls/93"},"html":{"href":"https://github.com/spinnaker/front50/pull/93"},"issue":{"href":"https://api.github.com/repos/spinnaker/front50/issues/93"},"comments":{"href":"https://api.github.com/repos/spinnaker/front50/issues/93/comments"},"review_comments":{"href":"https://api.github.com/repos/spinnaker/front50/pulls/93/comments"},"review_comment":{"href":"https://api.github.com/repos/spinnaker/front50/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/spinnaker/front50/pulls/93/commits"},"statuses":{"href":"https://api.github.com/repos/spinnaker/front50/statuses/d981ff6d37d616c89fb30849067ed51df28a0b8c"}}}}
{"actor":{"display_login":"ajordens"}}