Skip to content

Commit

Permalink
Merge branch 'sslInstallUninstall' into 'master'
Browse files Browse the repository at this point in the history
Ssl install uninstall

See merge request transip/restapi-php-library!188
  • Loading branch information
phorick committed May 30, 2022
2 parents 99b2f53 + 82fb2c3 commit 10ffa04
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 1 deletion.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
CHANGELOG
=========


6.23.0
-----
* Added ssl certificate install/uninstall endpoint

6.22.0
-----
* Added domain handover
Expand Down
29 changes: 29 additions & 0 deletions src/Repository/SslCertificate/InstallRepository.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

namespace Transip\Api\Library\Repository\SslCertificate;

use Transip\Api\Library\Entity\SslCertificate\Details;
use Transip\Api\Library\Repository\ApiRepository;
use Transip\Api\Library\Repository\SslCertificateRepository;

class InstallRepository extends ApiRepository
{
public const RESOURCE_NAME = 'install';

protected function getRepositoryResourceNames(): array
{
return [SslCertificateRepository::RESOURCE_NAME, self::RESOURCE_NAME];
}

public function installCertificate(int $sslCertificateId, string $domainName, ?string $passphrase = null): void
{
$params = [
'domainName'=> $domainName,
];
if ($passphrase !== null) {
$params['passphrase'] = $passphrase;
}

$this->httpClient->patch($this->getResourceUrl($sslCertificateId), $params);
}
}
26 changes: 26 additions & 0 deletions src/Repository/SslCertificate/UninstallRepository.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php

namespace Transip\Api\Library\Repository\SslCertificate;

use Transip\Api\Library\Entity\SslCertificate\Details;
use Transip\Api\Library\Repository\ApiRepository;
use Transip\Api\Library\Repository\SslCertificateRepository;

class UninstallRepository extends ApiRepository
{
public const RESOURCE_NAME = 'uninstall';

protected function getRepositoryResourceNames(): array
{
return [SslCertificateRepository::RESOURCE_NAME, self::RESOURCE_NAME];
}

public function uninstallCertificate(int $sslCertificateId, string $domainName): void
{
$params = [
'domainName' => $domainName,
];

$this->httpClient->delete($this->getResourceUrl($sslCertificateId), $params);
}
}
14 changes: 13 additions & 1 deletion src/TransipAPI.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@
use Transip\Api\Library\Repository\DomainTldRepository;
use Transip\Api\Library\Repository\SshKeyRepository;
use Transip\Api\Library\Repository\SslCertificate\DetailsRepository;
use Transip\Api\Library\Repository\SslCertificate\InstallRepository;
use Transip\Api\Library\Repository\SslCertificate\UninstallRepository;
use Transip\Api\Library\Repository\SslCertificateRepository;
use Transip\Api\Library\Repository\TrafficPoolRepository;
use Transip\Api\Library\Repository\TrafficRepository;
Expand Down Expand Up @@ -72,7 +74,7 @@
class TransipAPI
{
public const TRANSIP_API_ENDPOINT = "https://api.transip.nl/v6";
public const TRANSIP_API_LIBRARY_VERSION = "6.22.0";
public const TRANSIP_API_LIBRARY_VERSION = "6.23.0";
public const TRANSIP_API_DEMO_TOKEN = "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImp0aSI6ImN3MiFSbDU2eDNoUnkjelM4YmdOIn0.eyJpc3MiOiJhcGkudHJhbnNpcC5ubCIsImF1ZCI6ImFwaS50cmFuc2lwLm5sIiwianRpIjoiY3cyIVJsNTZ4M2hSeSN6UzhiZ04iLCJpYXQiOjE1ODIyMDE1NTAsIm5iZiI6MTU4MjIwMTU1MCwiZXhwIjoyMTE4NzQ1NTUwLCJjaWQiOiI2MDQ0OSIsInJvIjpmYWxzZSwiZ2siOmZhbHNlLCJrdiI6dHJ1ZX0.fYBWV4O5WPXxGuWG-vcrFWqmRHBm9yp0PHiYh_oAWxWxCaZX2Rf6WJfc13AxEeZ67-lY0TA2kSaOCp0PggBb_MGj73t4cH8gdwDJzANVxkiPL1Saqiw2NgZ3IHASJnisUWNnZp8HnrhLLe5ficvb1D9WOUOItmFC2ZgfGObNhlL2y-AMNLT4X7oNgrNTGm-mespo0jD_qH9dK5_evSzS3K8o03gu6p19jxfsnIh8TIVRvNdluYC2wo4qDl5EW5BEZ8OSuJ121ncOT1oRpzXB0cVZ9e5_UVAEr9X3f26_Eomg52-PjrgcRJ_jPIUYbrlo06KjjX2h0fzMr21ZE023Gw";

/**
Expand Down Expand Up @@ -157,6 +159,16 @@ public function sslCertificateDetails(): DetailsRepository
return new DetailsRepository($this->httpClient);
}

public function sslCertificateInstall(): InstallRepository
{
return new InstallRepository($this->httpClient);
}

public function sslCertificateUninstall(): UninstallRepository
{
return new UninstallRepository($this->httpClient);
}

public function invoice(): InvoiceRepository
{
return new InvoiceRepository($this->httpClient);
Expand Down

0 comments on commit 10ffa04

Please sign in to comment.