Skip to content

Commit

Permalink
feat(amazon): include cluster, server group in instance details (#1614)
Browse files Browse the repository at this point in the history
  • Loading branch information
anotherchrisberry committed May 2, 2017
1 parent 3d0919b commit 802d74c
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import org.springframework.stereotype.Component

import static com.netflix.spinnaker.clouddriver.core.provider.agent.Namespace.HEALTH
import static com.netflix.spinnaker.clouddriver.core.provider.agent.Namespace.INSTANCES
import static com.netflix.spinnaker.clouddriver.core.provider.agent.Namespace.SERVER_GROUPS

@Component
class AmazonInstanceProvider implements InstanceProvider<AmazonInstance> {
Expand Down Expand Up @@ -61,6 +62,11 @@ class AmazonInstanceProvider implements InstanceProvider<AmazonInstance> {
}
AmazonInstance instance = new AmazonInstance(instanceEntry.attributes)
instance.name = id
if (instanceEntry.relationships[SERVER_GROUPS.ns] && !instanceEntry.relationships[SERVER_GROUPS.ns].empty) {
Map serverGroup = Keys.parse(instanceEntry.relationships[SERVER_GROUPS.ns].iterator().next())
instance.serverGroup = serverGroup.serverGroup
instance.cluster = serverGroup.cluster
}
if (instanceEntry.relationships[HEALTH.ns]) {
instance.health.addAll(cacheView.getAll(HEALTH.ns, instanceEntry.relationships[HEALTH.ns])*.attributes)
}
Expand Down

0 comments on commit 802d74c

Please sign in to comment.