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

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

Disassociates an Elastic IP address from the instance it's assigned to. This action applies to both EC2 Elastic IP addresses and VPC Elastic IP addresses. This is an idempotent action. If you enter it more than once, Amazon EC2 does not return an error
public disassociateAddress ( string $publicIp = null, string $associationId = null ) : boolean
$publicIp string optional The EC2 Elastic IP address. Condition: Required for EC2 Elastic IP addresses
$associationId string optional The association ID corresponding to the VPC Elastic IP Conditional address. Condition: Required for VPC Elastic IP addresses
Результат boolean Returns true on success
    public function disassociateAddress($publicIp = null, $associationId = null)
    {
        if ($publicIp === null && $associationId === null) {
            throw new \InvalidArgumentException('Either publicIp or associationId must be provided.');
        }
        $result = false;
        $options = array();
        if ($publicIp !== null) {
            $options['PublicIp'] = (string) $publicIp;
        }
        if ($associationId !== null) {
            $options['AssociationId'] = (string) $associationId;
        }
        $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 disassociate elastic IP address. It returned "%s"', $sxml->return));
            }
            $result = true;
        }
        return $result;
    }
Ec2Api