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

deleteKeyPair() public method

Deletes the specified key pair, by removing the public key from Amazon EC2.You must own the key pair
public deleteKeyPair ( string $keyName ) : boolean
$keyName string A unique key name for the key pair.
return boolean Returns true on success
    public function deleteKeyPair($keyName)
    {
        $result = false;
        $options['KeyName'] = (string) $keyName;
        $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 delete key pair "%s". It returned "%s"', $options['KeyName'], $sxml->return));
            }
            $result = true;
        }
        return $result;
    }
Ec2Api