'publicKey', 'private_key' => 'privateKey', 'user_id' => 'userId', 'type' => 'type', ]; protected $resourceKey = 'keypair'; protected $resourcesKey = 'keypairs'; /** * {@inheritdoc} */ protected function getAliases(): array { return parent::getAliases() + [ 'created_at' => new Alias('createdAt', \DateTimeImmutable::class), ]; } /** * {@inheritdoc} */ public function retrieve() { $response = $this->execute($this->api->getKeypair(), $this->getAttrs(['name', 'userId'])); $this->populateFromResponse($response); } public function create(array $userOptions): Creatable { $response = $this->execute($this->api->postKeypair(), $userOptions); return $this->populateFromResponse($response); } /** * {@inheritdoc} */ public function populateFromArray(array $array): self { return parent::populateFromArray(Utils::flattenJson($array, $this->resourceKey)); } /** * {@inheritdoc} */ public function delete() { $this->execute($this->api->deleteKeypair(), ['name' => (string) $this->name]); } }