require 'acquia/cloud/entity' module Acquia class Cloud class Server < Entity def initialize(cloud, site, env, server) @cloud = cloud @site = site @env = env @data = server @url = "/sites/#{@site}/envs/#{env}/servers/#{@data['name']}" end def name data['name'] end def fqdn data['fqdn'] end def ami_type data['ami_type'] end def ec2_region data['ec2_region'] end def ec2_availability_zone data['ec2_availability_zone'] end def services data['services'] end def varnish? services.has_key? 'varnish' end def web? services.has_key? 'web' end def database? services.has_key? 'database' end def php_procs(memory_limit, apc_shm) return nil unless web? values = @cloud.api.get("#{url}/php-procs") do |response| response.params['memory_limits[]'] = memory_limit response.params['apc_shm[]'] = apc_shm end values['memory_limit'][memory_limit]['apc_shm'][apc_shm]['php_procs'] end end end end