示例#1
0
 public function findElbs()
 {
     $result = $this->elbClient->describeLoadBalancers();
     $rows = $result->search('LoadBalancerDescriptions[]');
     $collection = new \AwsInspector\Model\Collection();
     foreach ($rows as $row) {
         $collection->attach(new Elb($row));
     }
     return $collection;
 }
示例#2
0
 public function findCacheClusters()
 {
     $result = $this->elastiCacheClient->describeCacheClusters(['ShowCacheNodeInfo' => true]);
     $rows = $result->search('CacheClusters[]');
     $collection = new \AwsInspector\Model\Collection();
     foreach ($rows as $row) {
         $collection->attach(new CacheCluster($row));
     }
     return $collection;
 }
示例#3
0
 public function findDatabases()
 {
     $result = $this->rdsClient->describeDBInstances();
     $rows = $result->search('DBInstances[]');
     $collection = new \AwsInspector\Model\Collection();
     foreach ($rows as $row) {
         $collection->attach(new Database($row));
     }
     return $collection;
 }
示例#4
0
 public function findByAutoScalingGroupName($regex)
 {
     $collection = new \AwsInspector\Model\Collection();
     foreach ($this->findAutoScalingGroups() as $autoScalingGroup) {
         /* @var $autoScalingGroup AutoScalingGroup */
         if (preg_match($regex, $autoScalingGroup->getAutoScalingGroupName())) {
             $collection->attach($autoScalingGroup);
         }
     }
     return $collection;
 }
示例#5
0
 /**
  * @param array $tags
  * @return \AwsInspector\Model\Collection
  */
 public function findCacheClustersByTags(array $tags = array())
 {
     $cacheClusters = $this->findCacheClusters();
     $matchingCacheClusters = new Collection();
     foreach ($cacheClusters as $cacheCluster) {
         /* @var $cacheCluster CacheCluster */
         if ($cacheCluster->matchesTags($tags)) {
             $matchingCacheClusters->attach($cacheCluster);
         }
     }
     return $matchingCacheClusters;
 }
示例#6
0
 /**
  * @param array $tags
  * @return \AwsInspector\Model\Collection
  */
 public function findElbsByTags(array $tags = array())
 {
     $elbs = $this->findElbs();
     $matchingElbs = new Collection();
     foreach ($elbs as $elb) {
         /* @var $elb Elb */
         if ($elb->matchesTags($tags)) {
             $matchingElbs->attach($elb);
         }
     }
     return $matchingElbs;
 }
示例#7
0
 /**
  * @param array $tags
  * @return \AwsInspector\Model\Collection
  */
 public function findAutoScalingGroupsByTags(array $tags = array())
 {
     $autoScalingGroups = $this->findAutoScalingGroups();
     $matchingElbs = new Collection();
     foreach ($autoScalingGroups as $autoScalingGroup) {
         /* @var $autoScalingGroup AutoScalingGroup */
         /* @var $autoScalingGroup AutoScalingGroup */
         if ($autoScalingGroup->matchesTags($tags)) {
             $matchingElbs->attach($autoScalingGroup);
         }
     }
     return $matchingElbs;
 }
示例#8
0
 /**
  * @param array $tags
  * @return \AwsInspector\Model\Collection
  */
 public function findDatabasesByTags(array $tags = array())
 {
     $databases = $this->findDatabases();
     $matchingDatabases = new Collection();
     foreach ($databases as $database) {
         /* @var $database Database */
         try {
             if ($database->matchesTags($tags)) {
                 $matchingDatabases->attach($database);
             }
         } catch (\Aws\Rds\Exception\RdsException $e) {
             if ($e->getAwsErrorCode() != 'AccessDenied') {
                 throw $e;
             }
         }
     }
     return $matchingDatabases;
 }