protected function toNode($response) { //print_r($response); $public_ips = $private_ips = $extra = []; $ips = $this->listIps($response->getId()); foreach ($ips as $ip) { if ($ip['public']) { $public_ips[] = $ip['ipAddress']; } else { $private_ips[] = $ip['ipAddress']; } } $size = $this->listSizes($response['PLANID']); $image = new NodeImage(null, null, 'linode'); return new Node($response['LINODEID'], $response['LABEL'], NodeState::toString($this->stateMap[$response['STATUS']]), $public_ips, $private_ips, 'linode', $size, $image, ['distributionvendor' => $response['DISTRIBUTIONVENDOR']]); }
protected function toNode($dropletEntity) { $public_ips = $private_ips = $extra = []; foreach ($dropletEntity->networks as $network) { if ($network->type == 'public') { $public_ips[] = $network->ipAddress; } else { $private_ips[] = $network->ipAddress; } } $size = $this->toSize($dropletEntity->size); $image = $this->toImage($dropletEntity->image); return new Node($dropletEntity->id, $dropletEntity->name, NodeState::toString($this->stateMap[$dropletEntity->status]), $public_ips, $private_ips, 'digital_ocean', $size, $image, $extra); }