diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 153d8d7..b0b830e 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -62,7 +62,6 @@ test phpunit: expire_in: 1 day reports: junit: build/logs/junit.xml - cobertura: build/cobertura.xml validate tag-message: stage: validate diff --git a/.secretsignore b/.secretsignore index f06e33a..f85e8f5 100644 --- a/.secretsignore +++ b/.secretsignore @@ -3,3 +3,4 @@ ci/deploy_to_github.sh src/TransipAPI.php src/Entity/OpenStackProject.php src/Entity/OpenStackUser.php +src/Entity/OpenStackToken.php diff --git a/CHANGELOG.md b/CHANGELOG.md index ffebc8b..9858367 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ CHANGELOG ========= +6.28.0 +----- +* Implemented Object Store functionality +* Added token endpoint to Openstack + 6.27.1 ----- * Fixed action on ssl reissue diff --git a/examples/GetBigStorageUsageStatistics.php b/examples/GetBigStorageUsageStatistics.php index 49cf77a..c4cc1ea 100644 --- a/examples/GetBigStorageUsageStatistics.php +++ b/examples/GetBigStorageUsageStatistics.php @@ -35,7 +35,6 @@ ); foreach ($usageStatistics as $statistic) { - // Convert unix timestamp to human readable date $date = new DateTime("@{$statistic->getDate()}"); diff --git a/examples/Vps/Backup/List.php b/examples/Vps/Backup/List.php index 9726698..a938059 100644 --- a/examples/Vps/Backup/List.php +++ b/examples/Vps/Backup/List.php @@ -15,7 +15,6 @@ $backupId = 0; foreach ($backups as $backup) { - // An example search if ($backup->getOperatingSystem() === 'OpenBSD 6.4') { $backupId = $backup->getId(); diff --git a/src/Entity/OpenStackToken.php b/src/Entity/OpenStackToken.php new file mode 100644 index 0000000..66bc877 --- /dev/null +++ b/src/Entity/OpenStackToken.php @@ -0,0 +1,98 @@ +tokenId; + } + + /** + * @return string + */ + public function getUserId(): string + { + return $this->userId; + } + + /** + * @return string + */ + public function getProjectId(): string + { + return $this->projectId; + } + + /** + * @return string + */ + public function getAccessKey(): string + { + return $this->accessKey; + } + + /** + * @return string + */ + public function getSecretKey(): string + { + return $this->secretKey; + } + + /** + * @return string + */ + public function getManagementUrl(): string + { + return $this->managementUrl; + } +} diff --git a/src/Repository/OpenStack/TokenRepository.php b/src/Repository/OpenStack/TokenRepository.php new file mode 100644 index 0000000..9f2b068 --- /dev/null +++ b/src/Repository/OpenStack/TokenRepository.php @@ -0,0 +1,68 @@ +httpClient->get($this->getResourceUrl($userId)); + $tokenArray = $this->getParameterFromResponse($response, self::RESOURCE_PARAMETER_PLURAL); + + foreach ($tokenArray as $token) { + $tokens[] = new OpenStackToken($token); + } + + return $tokens; + } + + public function getByTokenId(string $userId, string $tokenId): OpenStackToken + { + $response = $this->httpClient->get($this->getResourceUrl($userId, $tokenId)); + $token = $this->getParameterFromResponse($response, self::RESOURCE_PARAMETER_SINGULAR); + + return new OpenStackToken($token); + } + + public function create(string $userId, string $projectId): void + { + $parameters = [ + "projectId" => $projectId + ]; + + $this->httpClient->post( + $this->getResourceUrl($userId), + $parameters + ); + } + + public function delete(string $userId, string $tokenId): void + { + $this->httpClient->delete( + $this->getResourceUrl($userId, $tokenId) + ); + } +} diff --git a/src/TransipAPI.php b/src/TransipAPI.php index 8525c1d..31664cc 100644 --- a/src/TransipAPI.php +++ b/src/TransipAPI.php @@ -4,11 +4,9 @@ use Psr\Cache\CacheItemPoolInterface; use Symfony\Component\Cache\Adapter\FilesystemAdapter; -use Transip\Api\Library\HttpClient\Builder\ClientBuilder; use Transip\Api\Library\HttpClient\GuzzleClient; use Transip\Api\Library\HttpClient\HttpClient; use Transip\Api\Library\HttpClient\HttpClientInterface; -use Transip\Api\Library\HttpClient\HttpMethodsClient; use Transip\Api\Library\Repository\ApiTestRepository; use Transip\Api\Library\Repository\AuthRepository; use Transip\Api\Library\Repository\AvailabilityZoneRepository; @@ -40,6 +38,7 @@ use Transip\Api\Library\Repository\Invoice\PdfRepository as InvoicePdfRepository; use Transip\Api\Library\Repository\MailServiceRepository; use Transip\Api\Library\Repository\OpenStack\ProjectRepository as OpenStackProjectRepository; +use Transip\Api\Library\Repository\OpenStack\TokenRepository as OpenStackTokenRepository; use Transip\Api\Library\Repository\OpenStack\UserRepository as OpenStackUserRepository; use Transip\Api\Library\Repository\OpenStack\Project\UserRepository as OpenStackProjectUserRepository; use Transip\Api\Library\Repository\OperatingSystemFilterRepository; @@ -79,7 +78,7 @@ class TransipAPI { public const TRANSIP_API_ENDPOINT = "https://api.transip.nl/v6"; - public const TRANSIP_API_LIBRARY_VERSION = "6.27.1"; + public const TRANSIP_API_LIBRARY_VERSION = "6.28.0"; public const TRANSIP_API_DEMO_TOKEN = "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImp0aSI6ImN3MiFSbDU2eDNoUnkjelM4YmdOIn0.eyJpc3MiOiJhcGkudHJhbnNpcC5ubCIsImF1ZCI6ImFwaS50cmFuc2lwLm5sIiwianRpIjoiY3cyIVJsNTZ4M2hSeSN6UzhiZ04iLCJpYXQiOjE1ODIyMDE1NTAsIm5iZiI6MTU4MjIwMTU1MCwiZXhwIjoyMTE4NzQ1NTUwLCJjaWQiOiI2MDQ0OSIsInJvIjpmYWxzZSwiZ2siOmZhbHNlLCJrdiI6dHJ1ZX0.fYBWV4O5WPXxGuWG-vcrFWqmRHBm9yp0PHiYh_oAWxWxCaZX2Rf6WJfc13AxEeZ67-lY0TA2kSaOCp0PggBb_MGj73t4cH8gdwDJzANVxkiPL1Saqiw2NgZ3IHASJnisUWNnZp8HnrhLLe5ficvb1D9WOUOItmFC2ZgfGObNhlL2y-AMNLT4X7oNgrNTGm-mespo0jD_qH9dK5_evSzS3K8o03gu6p19jxfsnIh8TIVRvNdluYC2wo4qDl5EW5BEZ8OSuJ121ncOT1oRpzXB0cVZ9e5_UVAEr9X3f26_Eomg52-PjrgcRJ_jPIUYbrlo06KjjX2h0fzMr21ZE023Gw"; /** @@ -174,14 +173,14 @@ public function sslCertificateUninstall(): UninstallRepository return new UninstallRepository($this->httpClient); } - public function sslCertificateDownload(): DownloadRepository + public function invoice(): InvoiceRepository { - return new DownloadRepository($this->httpClient); + return new InvoiceRepository($this->httpClient); } - public function invoice(): InvoiceRepository + public function sslCertificateDownload(): DownloadRepository { - return new InvoiceRepository($this->httpClient); + return new DownloadRepository($this->httpClient); } public function invoicePdf(): InvoicePdfRepository @@ -437,6 +436,11 @@ public function openStackUsers(): OpenStackUserRepository return new OpenStackUserRepository($this->httpClient); } + public function openStackTokens(): OpenStackTokenRepository + { + return new OpenStackTokenRepository($this->httpClient); + } + public function mailForwards(): MailForwardRepository { return new MailForwardRepository($this->httpClient);