Scalr\Service\Aws\Ec2\V20140615\Ec2Api::attachInternetGateway PHP Method

attachInternetGateway() public method

Attaches an Internet gateway to a VPC, enabling connectivity between the Internet and the VPC
public attachInternetGateway ( string $internetGatewayId, string $vpcId ) : boolean
$internetGatewayId string The ID of the internet gateway
$vpcId string The ID of the VPC
return boolean Returns TRUE on success
    public function attachInternetGateway($internetGatewayId, $vpcId)
    {
        $result = false;
        $options = array('InternetGatewayId' => (string) $internetGatewayId, 'VpcId' => (string) $vpcId);
        $action = ucfirst(__FUNCTION__);
        $response = $this->client->call($action, $options);
        if ($response->getError() === false) {
            $sxml = simplexml_load_string($response->getRawContent());
            if ((string) $sxml->return != 'true') {
                throw new Ec2Exception(sprintf('Amazon Ec2 could not %s InternetGatewayId:"%s", VpcId:"%s". It returned "%s"', $action, $options['InternetGatewayId'], $options['VpcId'], $sxml->return));
            }
            $result = true;
        }
        return $result;
    }
Ec2Api