Scalr\Service\Aws\Ec2\V20140615\Ec2Api::releaseAddress PHP Метод

releaseAddress() публичный Метод

Releases an Elastic IP address allocated to your account. Important! After releasing an Elastic IP address, it is released to the IP address pool and might be unavailable to your account. Make sure to update your DNS records and any servers or devices that communicate with the address.
public releaseAddress ( string $publicIp = null, string $allocationId = null ) : boolean
$publicIp string optional The EC2 Elastic IP address
$allocationId string optional The allocation ID that AWS provided when you allocated the address for use with Amazon VPC.
Результат boolean Returns true on success
    public function releaseAddress($publicIp = null, $allocationId = null)
    {
        if ($publicIp === null && $allocationId === null) {
            throw new \InvalidArgumentException('Either publicIp or allocationId must be provided.');
        }
        $result = false;
        $options = array();
        if ($publicIp !== null) {
            $options['PublicIp'] = (string) $publicIp;
        }
        if ($allocationId !== null) {
            $options['AllocationId'] = (string) $allocationId;
        }
        $response = $this->client->call(ucfirst(__FUNCTION__), $options);
        if ($response->getError() === false) {
            $sxml = simplexml_load_string($response->getRawContent());
            if ((string) $sxml->return != 'true') {
                throw new Ec2Exception(sprintf('Amazon Ec2 could not release elastic IP address "%s". It returned "%s"', isset($options['AllocationId']) ? $options['AllocationId'] : $options['PublicIp'], $sxml->return));
            }
            $result = true;
        }
        return $result;
    }
Ec2Api