-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch '449-request-colo-access' into 'master'
449 request colo access See merge request transip/restapi-php-library!182
- Loading branch information
Showing
4 changed files
with
128 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters