Skip to content

Commit

Permalink
Merge branch '449-request-colo-access' into 'master'
Browse files Browse the repository at this point in the history
449 request colo access

See merge request transip/restapi-php-library!182
  • Loading branch information
Jordi Donadeu committed Apr 19, 2022
2 parents c6e0426 + cca2c9c commit 45e6c15
Show file tree
Hide file tree
Showing 4 changed files with 128 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
CHANGELOG
=========

6.18.0
-----
* Added colocation access request endpoint

6.17.0
-----
* Added vps settings and rescue image endpoints
Expand Down
93 changes: 93 additions & 0 deletions src/Entity/Colocation/AccessRequest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
<?php

namespace Transip\Api\Library\Entity\Colocation;

use Transip\Api\Library\Entity\AbstractEntity;

class AccessRequest extends AbstractEntity
{
/**
* @var string $coloName
*/
protected $coloName;

/**
* The datetime of the wanted datacenter access, in YYYY-MM-DD hh:mm:ss format
* @var string $dateTime
*/
protected $dateTime;

/**
* The expected duration of the visit, in minutes
* @var int $duration
*/
protected $duration;

/**
* List of visitor names for this datacenter visit, must be at least 1 and at most 20
* @var string[] $visitorNames
*/
protected $visitorNames;

/**
* If an SMS with access codes needs to be sent, set the phone number of the receiving phone here
* @var string $phoneNumber
*/
protected $phoneNumber;

public function getColoName(): string
{
return $this->coloName;
}

public function setColoName(string $coloName): void
{
$this->coloName = $coloName;
}

public function getDateTime(): string
{
return $this->dateTime;
}

public function setDateTime(string $dateTime): void
{
$this->dateTime = $dateTime;
}

public function getDuration(): int
{
return $this->duration;
}

public function setDuration(int $duration): void
{
$this->duration = $duration;
}

/**
* @return string[]
*/
public function getVisitorNames(): array
{
return $this->visitorNames;
}

/**
* @param string[] $visitorNames
*/
public function setVisitorNames(array $visitorNames): void
{
$this->visitorNames = $visitorNames;
}

public function getPhoneNumber(): string
{
return $this->phoneNumber;
}

public function setPhoneNumber(string $phoneNumber): void
{
$this->phoneNumber = $phoneNumber;
}
}
24 changes: 24 additions & 0 deletions src/Repository/Colocation/AccessRequestRepository.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php

namespace Transip\Api\Library\Repository\Colocation;

use Transip\Api\Library\Entity\Colocation\AccessRequest;
use Transip\Api\Library\Repository\ApiRepository;
use Transip\Api\Library\Repository\ColocationRepository;

class AccessRequestRepository extends ApiRepository
{
public const RESOURCE_NAME = 'access-request';

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

public function create(AccessRequest $accessRequest): void
{
$url = $this->getResourceUrl($accessRequest->getColoName());
$parameters = ['accessRequest' => $accessRequest];
$this->httpClient->post($url, $parameters);
}
}
8 changes: 7 additions & 1 deletion src/TransipAPI.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
use Transip\Api\Library\Repository\ColocationRepository;
use Transip\Api\Library\Repository\Colocation\IpAddressRepository as ColoIpAddressRepository;
use Transip\Api\Library\Repository\Colocation\RemoteHandsRepository as ColoRemoteHandsRepository;
use Transip\Api\Library\Repository\Colocation\AccessRequestRepository as ColoAccessRequestRepository;
use Transip\Api\Library\Repository\DomainRepository;
use Transip\Api\Library\Repository\DomainAvailabilityRepository;
use Transip\Api\Library\Repository\Domain\ActionRepository as DomainActionRepository;
Expand Down Expand Up @@ -71,7 +72,7 @@
class TransipAPI
{
public const TRANSIP_API_ENDPOINT = "https://api.transip.nl/v6";
public const TRANSIP_API_LIBRARY_VERSION = "6.17.0";
public const TRANSIP_API_LIBRARY_VERSION = "6.18.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 @@ -384,6 +385,11 @@ public function colocationRemoteHands(): ColoRemoteHandsRepository
return new ColoRemoteHandsRepository($this->httpClient);
}

public function colocationAccessRequest(): ColoAccessRequestRepository
{
return new ColoAccessRequestRepository($this->httpClient);
}

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

0 comments on commit 45e6c15

Please sign in to comment.