{"action":"created","comment":{"url":"https://api.github.com/repos/spinnaker/clouddriver/pulls/comments/57970974","id":57970974,"diff_hunk":"@@ -31,51 +32,51 @@ import com.netflix.spinnaker.cats.agent.AgentDataType\n import com.netflix.spinnaker.cats.agent.CacheResult\n import com.netflix.spinnaker.cats.agent.CachingAgent\n import com.netflix.spinnaker.cats.agent.DefaultCacheResult\n+import com.netflix.spinnaker.cats.cache.Cache\n import com.netflix.spinnaker.cats.cache.CacheData\n import com.netflix.spinnaker.cats.provider.ProviderCache\n+import com.netflix.spinnaker.clouddriver.aws.data.Keys\n import com.netflix.spinnaker.clouddriver.aws.security.AmazonClientProvider\n import com.netflix.spinnaker.clouddriver.aws.security.AmazonCredentials\n import com.netflix.spinnaker.clouddriver.aws.security.NetflixAmazonCredentials\n import com.netflix.spinnaker.clouddriver.aws.model.AmazonReservationReport\n import com.netflix.spinnaker.clouddriver.aws.provider.AwsProvider\n+import com.netflix.spinnaker.clouddriver.cache.CustomScheduledAgent\n import groovy.util.logging.Slf4j\n+import org.springframework.beans.factory.annotation.Autowired\n+import org.springframework.context.ApplicationContext\n import rx.Observable\n import rx.Scheduler\n \n import java.util.concurrent.ConcurrentHashMap\n+import java.util.concurrent.TimeUnit\n import java.util.concurrent.atomic.AtomicInteger\n \n import static com.netflix.spinnaker.cats.agent.AgentDataType.Authority.AUTHORITATIVE\n import static com.netflix.spinnaker.clouddriver.aws.data.Keys.Namespace.RESERVATION_REPORTS\n+import static com.netflix.spinnaker.clouddriver.aws.data.Keys.Namespace.RESERVED_INSTANCES\n \n @Slf4j\n-class ReservationReportCachingAgent implements CachingAgent {\n-  private static final Collection<AgentDataType> types = Collections.unmodifiableCollection([\n+class ReservationReportCachingAgent implements CachingAgent, CustomScheduledAgent {\n+  private static final long DEFAULT_POLL_INTERVAL_MILLIS = TimeUnit.MINUTES.toMillis(1)\n+  private static final long DEFAULT_TIMEOUT_MILLIS = TimeUnit.MINUTES.toMillis(5)\n+\n+  final Collection<AgentDataType> types = Collections.unmodifiableCollection([\n     AUTHORITATIVE.forType(RESERVATION_REPORTS.ns)\n   ])\n \n   private final Scheduler scheduler\n+  private Cache cacheView\n \n-  @Override\n-  String getProviderName() {\n-    AwsProvider.PROVIDER_NAME\n-  }\n-\n-  @Override\n-  String getAgentType() {\n-    \"${ReservationReportCachingAgent.simpleName}\"\n-  }\n-\n-  @Override\n-  Collection<AgentDataType> getProvidedDataTypes() {\n-    types\n-  }\n \n   final AmazonClientProvider amazonClientProvider\n   final Collection<NetflixAmazonCredentials> accounts\n   final ObjectMapper objectMapper\n   final AccountReservationDetailSerializer accountReservationDetailSerializer\n \n+  @Autowired","path":"clouddriver-aws/src/main/groovy/com/netflix/spinnaker/clouddriver/aws/provider/agent/ReservationReportCachingAgent.groovy","position":70,"original_position":70,"commit_id":"82d4596a58543ac1183f6fbfc64cfc0da5c8f433","original_commit_id":"82d4596a58543ac1183f6fbfc64cfc0da5c8f433","user":{"login":"cfieber","id":301292,"avatar_url":"https://avatars.githubusercontent.com/u/301292?v=3","gravatar_id":"","url":"https://api.github.com/users/cfieber","html_url":"https://github.com/cfieber","followers_url":"https://api.github.com/users/cfieber/followers","following_url":"https://api.github.com/users/cfieber/following{/other_user}","gists_url":"https://api.github.com/users/cfieber/gists{/gist_id}","starred_url":"https://api.github.com/users/cfieber/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cfieber/subscriptions","organizations_url":"https://api.github.com/users/cfieber/orgs","repos_url":"https://api.github.com/users/cfieber/repos","events_url":"https://api.github.com/users/cfieber/events{/privacy}","received_events_url":"https://api.github.com/users/cfieber/received_events","type":"User","site_admin":false},"body":"could probably actually just inject the Cache directly","created_at":"2016-03-30T21:56:31Z","updated_at":"2016-03-30T21:56:31Z","html_url":"https://github.com/spinnaker/clouddriver/pull/492#discussion_r57970974","pull_request_url":"https://api.github.com/repos/spinnaker/clouddriver/pulls/492","_links":{"self":{"href":"https://api.github.com/repos/spinnaker/clouddriver/pulls/comments/57970974"},"html":{"href":"https://github.com/spinnaker/clouddriver/pull/492#discussion_r57970974"},"pull_request":{"href":"https://api.github.com/repos/spinnaker/clouddriver/pulls/492"}}},"pull_request":{"url":"https://api.github.com/repos/spinnaker/clouddriver/pulls/492","id":64702170,"html_url":"https://github.com/spinnaker/clouddriver/pull/492","diff_url":"https://github.com/spinnaker/clouddriver/pull/492.diff","patch_url":"https://github.com/spinnaker/clouddriver/pull/492.patch","issue_url":"https://api.github.com/repos/spinnaker/clouddriver/issues/492","number":492,"state":"open","locked":false,"title":"Introduced a ReservedInstances caching agent (runs every 10 minutes)","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":"- Updated ReservationReport caching agent to use the cached ReservedInstances data rather than calling AWS directly\r\n- Adjusted ReservationReport caching agent to only run every minute","created_at":"2016-03-30T21:42:14Z","updated_at":"2016-03-30T21:56:31Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6f300b3101120491d79a2473ccd92a77b73585e8","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/spinnaker/clouddriver/pulls/492/commits","review_comments_url":"https://api.github.com/repos/spinnaker/clouddriver/pulls/492/comments","review_comment_url":"https://api.github.com/repos/spinnaker/clouddriver/pulls/comments{/number}","comments_url":"https://api.github.com/repos/spinnaker/clouddriver/issues/492/comments","statuses_url":"https://api.github.com/repos/spinnaker/clouddriver/statuses/82d4596a58543ac1183f6fbfc64cfc0da5c8f433","head":{"label":"ajordens:reserved-instances-caching-agent","ref":"reserved-instances-caching-agent","sha":"82d4596a58543ac1183f6fbfc64cfc0da5c8f433","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},"repo":{"id":46809140,"name":"clouddriver","full_name":"ajordens/clouddriver","owner":{"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},"private":false,"html_url":"https://github.com/ajordens/clouddriver","description":"read and write operations across cloud providers","fork":true,"url":"https://api.github.com/repos/ajordens/clouddriver","forks_url":"https://api.github.com/repos/ajordens/clouddriver/forks","keys_url":"https://api.github.com/repos/ajordens/clouddriver/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ajordens/clouddriver/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ajordens/clouddriver/teams","hooks_url":"https://api.github.com/repos/ajordens/clouddriver/hooks","issue_events_url":"https://api.github.com/repos/ajordens/clouddriver/issues/events{/number}","events_url":"https://api.github.com/repos/ajordens/clouddriver/events","assignees_url":"https://api.github.com/repos/ajordens/clouddriver/assignees{/user}","branches_url":"https://api.github.com/repos/ajordens/clouddriver/branches{/branch}","tags_url":"https://api.github.com/repos/ajordens/clouddriver/tags","blobs_url":"https://api.github.com/repos/ajordens/clouddriver/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ajordens/clouddriver/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ajordens/clouddriver/git/refs{/sha}","trees_url":"https://api.github.com/repos/ajordens/clouddriver/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ajordens/clouddriver/statuses/{sha}","languages_url":"https://api.github.com/repos/ajordens/clouddriver/languages","stargazers_url":"https://api.github.com/repos/ajordens/clouddriver/stargazers","contributors_url":"https://api.github.com/repos/ajordens/clouddriver/contributors","subscribers_url":"https://api.github.com/repos/ajordens/clouddriver/subscribers","subscription_url":"https://api.github.com/repos/ajordens/clouddriver/subscription","commits_url":"https://api.github.com/repos/ajordens/clouddriver/commits{/sha}","git_commits_url":"https://api.github.com/repos/ajordens/clouddriver/git/commits{/sha}","comments_url":"https://api.github.com/repos/ajordens/clouddriver/comments{/number}","issue_comment_url":"https://api.github.com/repos/ajordens/clouddriver/issues/comments{/number}","contents_url":"https://api.github.com/repos/ajordens/clouddriver/contents/{+path}","compare_url":"https://api.github.com/repos/ajordens/clouddriver/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ajordens/clouddriver/merges","archive_url":"https://api.github.com/repos/ajordens/clouddriver/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ajordens/clouddriver/downloads","issues_url":"https://api.github.com/repos/ajordens/clouddriver/issues{/number}","pulls_url":"https://api.github.com/repos/ajordens/clouddriver/pulls{/number}","milestones_url":"https://api.github.com/repos/ajordens/clouddriver/milestones{/number}","notifications_url":"https://api.github.com/repos/ajordens/clouddriver/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ajordens/clouddriver/labels{/name}","releases_url":"https://api.github.com/repos/ajordens/clouddriver/releases{/id}","deployments_url":"https://api.github.com/repos/ajordens/clouddriver/deployments","created_at":"2015-11-24T17:59:48Z","updated_at":"2016-01-28T00:19:31Z","pushed_at":"2016-03-30T21:40:53Z","git_url":"git://github.com/ajordens/clouddriver.git","ssh_url":"git@github.com:ajordens/clouddriver.git","clone_url":"https://github.com/ajordens/clouddriver.git","svn_url":"https://github.com/ajordens/clouddriver","homepage":null,"size":25528,"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":"918516c79e04a09f52db59c7c2f4458d79dc323e","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":37556951,"name":"clouddriver","full_name":"spinnaker/clouddriver","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/clouddriver","description":"read and write operations across cloud providers","fork":false,"url":"https://api.github.com/repos/spinnaker/clouddriver","forks_url":"https://api.github.com/repos/spinnaker/clouddriver/forks","keys_url":"https://api.github.com/repos/spinnaker/clouddriver/keys{/key_id}","collaborators_url":"https://api.github.com/repos/spinnaker/clouddriver/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/spinnaker/clouddriver/teams","hooks_url":"https://api.github.com/repos/spinnaker/clouddriver/hooks","issue_events_url":"https://api.github.com/repos/spinnaker/clouddriver/issues/events{/number}","events_url":"https://api.github.com/repos/spinnaker/clouddriver/events","assignees_url":"https://api.github.com/repos/spinnaker/clouddriver/assignees{/user}","branches_url":"https://api.github.com/repos/spinnaker/clouddriver/branches{/branch}","tags_url":"https://api.github.com/repos/spinnaker/clouddriver/tags","blobs_url":"https://api.github.com/repos/spinnaker/clouddriver/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/spinnaker/clouddriver/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/spinnaker/clouddriver/git/refs{/sha}","trees_url":"https://api.github.com/repos/spinnaker/clouddriver/git/trees{/sha}","statuses_url":"https://api.github.com/repos/spinnaker/clouddriver/statuses/{sha}","languages_url":"https://api.github.com/repos/spinnaker/clouddriver/languages","stargazers_url":"https://api.github.com/repos/spinnaker/clouddriver/stargazers","contributors_url":"https://api.github.com/repos/spinnaker/clouddriver/contributors","subscribers_url":"https://api.github.com/repos/spinnaker/clouddriver/subscribers","subscription_url":"https://api.github.com/repos/spinnaker/clouddriver/subscription","commits_url":"https://api.github.com/repos/spinnaker/clouddriver/commits{/sha}","git_commits_url":"https://api.github.com/repos/spinnaker/clouddriver/git/commits{/sha}","comments_url":"https://api.github.com/repos/spinnaker/clouddriver/comments{/number}","issue_comment_url":"https://api.github.com/repos/spinnaker/clouddriver/issues/comments{/number}","contents_url":"https://api.github.com/repos/spinnaker/clouddriver/contents/{+path}","compare_url":"https://api.github.com/repos/spinnaker/clouddriver/compare/{base}...{head}","merges_url":"https://api.github.com/repos/spinnaker/clouddriver/merges","archive_url":"https://api.github.com/repos/spinnaker/clouddriver/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/spinnaker/clouddriver/downloads","issues_url":"https://api.github.com/repos/spinnaker/clouddriver/issues{/number}","pulls_url":"https://api.github.com/repos/spinnaker/clouddriver/pulls{/number}","milestones_url":"https://api.github.com/repos/spinnaker/clouddriver/milestones{/number}","notifications_url":"https://api.github.com/repos/spinnaker/clouddriver/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/spinnaker/clouddriver/labels{/name}","releases_url":"https://api.github.com/repos/spinnaker/clouddriver/releases{/id}","deployments_url":"https://api.github.com/repos/spinnaker/clouddriver/deployments","created_at":"2015-06-16T21:26:02Z","updated_at":"2016-03-23T15:53:11Z","pushed_at":"2016-03-30T21:42:14Z","git_url":"git://github.com/spinnaker/clouddriver.git","ssh_url":"git@github.com:spinnaker/clouddriver.git","clone_url":"https://github.com/spinnaker/clouddriver.git","svn_url":"https://github.com/spinnaker/clouddriver","homepage":null,"size":27540,"stargazers_count":42,"watchers_count":42,"language":"Groovy","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":47,"mirror_url":null,"open_issues_count":13,"forks":47,"open_issues":13,"watchers":42,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/spinnaker/clouddriver/pulls/492"},"html":{"href":"https://github.com/spinnaker/clouddriver/pull/492"},"issue":{"href":"https://api.github.com/repos/spinnaker/clouddriver/issues/492"},"comments":{"href":"https://api.github.com/repos/spinnaker/clouddriver/issues/492/comments"},"review_comments":{"href":"https://api.github.com/repos/spinnaker/clouddriver/pulls/492/comments"},"review_comment":{"href":"https://api.github.com/repos/spinnaker/clouddriver/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/spinnaker/clouddriver/pulls/492/commits"},"statuses":{"href":"https://api.github.com/repos/spinnaker/clouddriver/statuses/82d4596a58543ac1183f6fbfc64cfc0da5c8f433"}}}}