├── .php-cs-fixer.dist.php ├── .phpstan-bootstrap.php ├── .secretsignore ├── CHANGELOG.md ├── LICENSE ├── README.md ├── ci ├── ValidateTagVersionConsistency.php ├── deploy_to_github.sh ├── release_to_github.sh ├── scan_secrets.sh └── validate_tag_message.sh ├── composer.json ├── examples ├── Action.php ├── Authenticate.php ├── Domain │ ├── GetAll.php │ └── GetByName.php ├── GetAllAvailabilityZones.php ├── GetAllProducts.php ├── GetBigStorageUsageStatistics.php ├── Kubernetes │ └── Taints.php └── Vps │ ├── Addon │ ├── Cancel.php │ ├── GetByName.php │ └── Order.php │ ├── Backup │ ├── ConvertToSnapshot.php │ ├── List.php │ └── Revert.php │ ├── Cancel.php │ ├── Clone.php │ ├── Firewall │ └── AddRule.php │ └── Order.php ├── phpstan.neon ├── phpunit.xml.dist ├── src ├── Entity │ ├── AbstractEntity.php │ ├── Acronis │ │ ├── Tenant.php │ │ └── Usage.php │ ├── Action.php │ ├── AvailabilityZone.php │ ├── BigStorage.php │ ├── BigStorage │ │ └── Backup.php │ ├── BlockStorage.php │ ├── BlockStorage │ │ └── Backup.php │ ├── Colocation.php │ ├── Colocation │ │ ├── AccessRequest.php │ │ └── RemoteHands.php │ ├── Domain.php │ ├── Domain │ │ ├── Action.php │ │ ├── Branding.php │ │ ├── DnsEntry.php │ │ ├── DnsSecEntry.php │ │ ├── Nameserver.php │ │ └── WhoisContact.php │ ├── DomainCheckResult.php │ ├── Email │ │ ├── MailAddon.php │ │ ├── MailForward.php │ │ ├── MailList.php │ │ ├── MailPackage.php │ │ └── Mailbox.php │ ├── Haip.php │ ├── Haip │ │ ├── Certificate.php │ │ ├── PortConfiguration.php │ │ └── StatusReport.php │ ├── Invoice.php │ ├── Invoice │ │ ├── InvoiceItem.php │ │ ├── InvoiceItemDiscount.php │ │ └── InvoicePdf.php │ ├── Kubernetes │ │ ├── BlockStorage.php │ │ ├── Cluster.php │ │ ├── Cluster │ │ │ ├── KubeConfig.php │ │ │ └── Release.php │ │ ├── Event.php │ │ ├── IpAddress.php │ │ ├── Label.php │ │ ├── LoadBalancer.php │ │ ├── LoadBalancer │ │ │ ├── AggregatedStatus.php │ │ │ ├── Balancing.php │ │ │ ├── Port.php │ │ │ └── StatusReport.php │ │ ├── Node.php │ │ ├── NodePool.php │ │ ├── Product.php │ │ ├── ProductPeriodPrice.php │ │ ├── ProductSpec.php │ │ ├── Release.php │ │ └── Taint.php │ ├── MailServiceInformation.php │ ├── ObjectStoreQuota.php │ ├── OpenStackProject.php │ ├── OpenStackToken.php │ ├── OpenStackTotp.php │ ├── OpenStackUser.php │ ├── PrivateNetwork.php │ ├── PrivateNetwork │ │ └── Vps.php │ ├── Product.php │ ├── Product │ │ └── Element.php │ ├── SshKey.php │ ├── SslCertificate.php │ ├── SslCertificate │ │ ├── CertificateData.php │ │ ├── CertificateRequestData.php │ │ └── Details.php │ ├── Tld.php │ ├── TrafficInformation.php │ ├── TrafficPoolInformation.php │ ├── Vps.php │ └── Vps │ │ ├── Backup.php │ │ ├── Contact.php │ │ ├── Firewall.php │ │ ├── FirewallRule.php │ │ ├── IpAddress.php │ │ ├── License.php │ │ ├── LicenseKey.php │ │ ├── LicenseProduct.php │ │ ├── Licenses.php │ │ ├── OperatingSystem.php │ │ ├── RescueImage.php │ │ ├── Setting.php │ │ ├── SettingValue.php │ │ ├── Snapshot.php │ │ ├── TCPMonitor.php │ │ ├── TCPMonitorContact.php │ │ ├── TCPMonitorIgnoreTime.php │ │ ├── UsageData.php │ │ ├── UsageDataCpu.php │ │ ├── UsageDataDisk.php │ │ ├── UsageDataNetwork.php │ │ └── VncData.php ├── Exception │ ├── ApiClientException.php │ ├── ApiException.php │ ├── HttpBadResponseException.php │ ├── HttpClientException.php │ ├── HttpRequest │ │ ├── AccessTokenException.php │ │ ├── BadResponseException.php │ │ ├── BadResponseTimeoutException.php │ │ ├── ConflictException.php │ │ ├── ForbiddenException.php │ │ ├── InternalServerErrorException.php │ │ ├── MethodNotAllowedException.php │ │ ├── NotAcceptableException.php │ │ ├── NotFoundException.php │ │ ├── NotImplementedException.php │ │ ├── RateLimitException.php │ │ ├── TooManyBadResponseException.php │ │ ├── UnauthorizedException.php │ │ └── UnprocessableEntityException.php │ └── HttpRequestException.php ├── HttpClient │ ├── Builder │ │ ├── ClientBuilder.php │ │ └── ClientBuilderInterface.php │ ├── GuzzleClient.php │ ├── HttpClient.php │ ├── HttpClientInterface.php │ ├── HttpMethodsClient.php │ ├── Middleware │ │ └── TokenAuthorization.php │ └── Plugin │ │ ├── ExceptionThrowerPlugin.php │ │ └── TokenAuthenticationPlugin.php ├── Repository │ ├── Acronis │ │ ├── Tenant │ │ │ ├── AddonsRepository.php │ │ │ ├── DowngradesRepository.php │ │ │ ├── LoginRepository.php │ │ │ ├── UpgradesRepository.php │ │ │ └── UsageRepository.php │ │ └── TenantRepository.php │ ├── Action │ │ ├── ActionRepository.php │ │ └── ChildActionRepository.php │ ├── ApiRepository.php │ ├── ApiTestRepository.php │ ├── AuthRepository.php │ ├── AvailabilityZoneRepository.php │ ├── BigStorage │ │ ├── BackupRepository.php │ │ └── UsageRepository.php │ ├── BigStorageRepository.php │ ├── BlockStorage │ │ ├── BackupRepository.php │ │ └── UsageRepository.php │ ├── BlockStorageRepository.php │ ├── Colocation │ │ ├── AccessRequestRepository.php │ │ ├── IpAddressRepository.php │ │ └── RemoteHandsRepository.php │ ├── ColocationRepository.php │ ├── ContactKeyRepository.php │ ├── Domain │ │ ├── ActionRepository.php │ │ ├── AuthCodeRepository.php │ │ ├── BrandingRepository.php │ │ ├── ContactRepository.php │ │ ├── DnsRepository.php │ │ ├── DnsSecRepository.php │ │ ├── NameserverRepository.php │ │ ├── SslRepository.php │ │ └── WhoisRepository.php │ ├── DomainAvailabilityRepository.php │ ├── DomainDefaults │ │ └── ContactRepository.php │ ├── DomainRepository.php │ ├── DomainTldRepository.php │ ├── DomainWhitelabelRepository.php │ ├── Email │ │ ├── MailAddonRepository.php │ │ ├── MailForwardRepository.php │ │ ├── MailListRepository.php │ │ ├── MailPackageRepository.php │ │ └── MailboxRepository.php │ ├── EmailRepository.php │ ├── Haip │ │ ├── CertificateRepository.php │ │ ├── IpAddressRepository.php │ │ ├── PortConfigurationRepository.php │ │ └── StatusReportRepository.php │ ├── HaipRepository.php │ ├── Invoice │ │ ├── ItemRepository.php │ │ └── PdfRepository.php │ ├── InvoiceRepository.php │ ├── Kubernetes │ │ ├── Cluster │ │ │ ├── BlockStorageRepository.php │ │ │ ├── BlockStorages │ │ │ │ └── StatsRepository.php │ │ │ ├── EventRepository.php │ │ │ ├── KubeConfigRepository.php │ │ │ ├── LoadBalancerRepository.php │ │ │ ├── LoadBalancers │ │ │ │ └── StatusReportsRepository.php │ │ │ ├── NodePoolRepository.php │ │ │ ├── NodePools │ │ │ │ ├── LabelsRepository.php │ │ │ │ └── TaintsRepository.php │ │ │ ├── NodeRepository.php │ │ │ ├── Nodes │ │ │ │ └── StatsRepository.php │ │ │ └── ReleaseRepository.php │ │ ├── ClusterRepository.php │ │ ├── ProductRepository.php │ │ └── ReleaseRepository.php │ ├── MailServiceRepository.php │ ├── OpenStack │ │ ├── Project │ │ │ ├── AssignableUsersRepository.php │ │ │ ├── QuotaRepository.php │ │ │ └── UserRepository.php │ │ ├── ProjectRepository.php │ │ ├── TokenRepository.php │ │ ├── TotpRepository.php │ │ └── UserRepository.php │ ├── OperatingSystemFilterRepository.php │ ├── PrivateNetworkRepository.php │ ├── Product │ │ └── ElementRepository.php │ ├── ProductRepository.php │ ├── SshKeyRepository.php │ ├── SslCertificate │ │ ├── DetailsRepository.php │ │ ├── DownloadRepository.php │ │ ├── InstallRepository.php │ │ └── UninstallRepository.php │ ├── SslCertificateRepository.php │ ├── TrafficPoolRepository.php │ ├── TrafficRepository.php │ ├── Vps │ │ ├── AddonRepository.php │ │ ├── BackupRepository.php │ │ ├── FirewallRepository.php │ │ ├── IpAddressRepository.php │ │ ├── LicenseRepository.php │ │ ├── MonitoringContactRepository.php │ │ ├── OperatingSystemRepository.php │ │ ├── RescueImageRepository.php │ │ ├── SettingRepository.php │ │ ├── SnapshotRepository.php │ │ ├── TCPMonitorRepository.php │ │ ├── UpgradeRepository.php │ │ ├── UsageRepository.php │ │ └── VncDataRepository.php │ └── VpsRepository.php └── TransipAPI.php └── tests ├── Entity └── SslCertificateRepositoryTest.php ├── Exception └── HttpBadResponseExceptionTest.php └── HttpClient ├── ClientBuilderTest.php └── Plugin └── ExceptionThrowerPluginTest.php /.php-cs-fixer.dist.php: -------------------------------------------------------------------------------- 1 | in('.') 5 | ->files() 6 | ->name('*.php') 7 | ->ignoreDotFiles(true) 8 | ->ignoreVCS(true) 9 | ->exclude('vendor'); 10 | 11 | return (new PhpCsFixer\Config) 12 | ->setRules([ 13 | '@PSR2' => true, 14 | 'array_syntax' => ['syntax' => 'short'], 15 | ]) 16 | ->setFinder($finder); 17 | -------------------------------------------------------------------------------- /.phpstan-bootstrap.php: -------------------------------------------------------------------------------- 1 | origin/master ref 21 | # as github shows this as new branch 22 | git remote set-head origin -d 23 | 24 | git push --prune https://${GITHUB_USERNAME}:${GITHUB_TOKEN}@github.com/transip/transip-api-php.git +refs/remotes/origin/*:refs/heads/* +refs/tags/*:refs/tags/* 25 | -------------------------------------------------------------------------------- /ci/release_to_github.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | readonly TAG_VERSION="$1" 6 | 7 | if [ -z "$GITHUB_TOKEN" ] ; then 8 | echo "we need a github token in order to proceed"; 9 | exit 1; 10 | fi 11 | if [ -z "$TAG_VERSION" ] ; then 12 | echo "we need a version in order to proceed"; 13 | exit 1; 14 | fi 15 | 16 | function convert_to_json() { 17 | python -c 'import json,sys;print( json.dumps(sys.stdin.read().strip()) )' 18 | } 19 | 20 | description="$(git tag -l -n999 --format='%(contents)' $TAG_VERSION | convert_to_json)" 21 | 22 | json_output=$(curl -H "Authorization: token ${GITHUB_TOKEN}" \ 23 | -H "Content-Type: application/json" \ 24 | -X POST "https://api.github.com/repos/transip/transip-api-php/releases" \ 25 | -d "{\"tag_name\": \"${TAG_VERSION}\", \"name\": \"${TAG_VERSION}\", \"body\": ${description}, \"draft\": false, \"prerelease\": false}") 26 | 27 | echo $json_output 28 | -------------------------------------------------------------------------------- /ci/scan_secrets.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # give the full repository url when running in the CI pipeline 4 | if [ ! -z "$CI_REPOSITORY_URL" ] 5 | then 6 | REPOSITORY_PATH="$CI_REPOSITORY_URL" 7 | else 8 | # when run local point to local git repository 9 | REPOSITORY_PATH="file://$(pwd)" 10 | fi 11 | 12 | if ! which trufflehog; then 13 | echo "# Installing trufflehog before scanning" 14 | pip -q install trufflehog 15 | fi 16 | 17 | echo "# Scanning for stored secrets in repository" 18 | 19 | trufflehog --regex --entropy=True -x .secretsignore $REPOSITORY_PATH && echo "All good" 20 | -------------------------------------------------------------------------------- /ci/validate_tag_message.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | TAG_VERSION="$1" 6 | 7 | # Ensure tag version has been provided 8 | if [ -z "$TAG_VERSION" ] ; then 9 | echo "we need a version in order to proceed"; 10 | exit 1; 11 | fi 12 | 13 | description="$(git tag -l -n999 --format='%(contents)' $TAG_VERSION)" 14 | 15 | # Ensure tag message is not empty 16 | if echo $description | grep "Merge"; then 17 | echo "the tag message is empty, you must enter a tag message before deployment"; 18 | exit 1; 19 | fi 20 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "transip/transip-api-php", 3 | "description": "TransIP Rest API Library", 4 | "license": "Apache-2.0", 5 | "authors": [ 6 | { 7 | "name": "TransIP", 8 | "email": "support@transip.eu" 9 | } 10 | ], 11 | "minimum-stability": "stable", 12 | "require": { 13 | "php": "^7.2.0|^8.0", 14 | "ext-json": "*", 15 | "ext-openssl": "*", 16 | "symfony/cache": "^3.4|^4.4|^5.0|^6.0|^7.0", 17 | "psr/cache": "^1.0.1|^3.0", 18 | "php-http/client-common": "^2.5", 19 | "php-http/discovery": "^1.14", 20 | "guzzlehttp/guzzle": "^6.5|^7.4" 21 | }, 22 | "require-dev": { 23 | "friendsofphp/php-cs-fixer": "^3.0", 24 | "php-http/client-implementation": "^1.0", 25 | "php-parallel-lint/php-parallel-lint": "^1.2", 26 | "phpstan/phpstan": "^1.5", 27 | "nyholm/psr7": "^1.5", 28 | "phpunit/phpunit": "^9.5", 29 | "php-http/guzzle7-adapter": "^1.0" 30 | }, 31 | "suggest": { 32 | "php-http/guzzle7-adapter": "Guzzle is a PHP HTTP client that makes it easy to send HTTP requests and trivial to integrate with web services." 33 | }, 34 | "autoload": { 35 | "psr-4": { 36 | "Transip\\Api\\Library\\": "src/" 37 | } 38 | }, 39 | "autoload-dev": { 40 | "psr-4": { 41 | "Transip\\Api\\Library\\Tests\\": "tests/" 42 | } 43 | }, 44 | "config": { 45 | "allow-plugins": { 46 | "php-http/discovery": true 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /examples/Action.php: -------------------------------------------------------------------------------- 1 | vpsSnapshots()->revertSnapshot($vpsName, $snapshotName, $destinationVpsName); 10 | $action = $api->actions()->parseActionFromResponse($response); 11 | var_dump($action); 12 | -------------------------------------------------------------------------------- /examples/Authenticate.php: -------------------------------------------------------------------------------- 1 | setReadOnlyMode(true); 28 | 29 | // Create a test connection to the api 30 | // $response = $api->test()->test(); 31 | 32 | // if ($response === true) { 33 | // echo 'API connection successful!'; 34 | // } 35 | -------------------------------------------------------------------------------- /examples/Domain/GetAll.php: -------------------------------------------------------------------------------- 1 | domains()->getAll($includes); 16 | 17 | print_r($domains); 18 | -------------------------------------------------------------------------------- /examples/Domain/GetByName.php: -------------------------------------------------------------------------------- 1 | domains()->getByName($domainName, $includes); 17 | 18 | print_r($domain); 19 | -------------------------------------------------------------------------------- /examples/GetAllAvailabilityZones.php: -------------------------------------------------------------------------------- 1 | availabilityZone()->getAll(); 10 | //print_r($availabilityZones); 11 | 12 | foreach ($availabilityZones as $zone) { 13 | if ($zone->getCountry() === 'nl') { 14 | echo $zone->getName(); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /examples/GetAllProducts.php: -------------------------------------------------------------------------------- 1 | products()->getAll(); 12 | 13 | print_r($products); 14 | -------------------------------------------------------------------------------- /examples/GetBigStorageUsageStatistics.php: -------------------------------------------------------------------------------- 1 | bigStorageUsage()->getUsageStatistics($bigStorageName); 18 | // print_r($usageStatistics); 19 | 20 | 21 | /** 22 | * Example 2: Get usage statistics for last three days 23 | */ 24 | $dateToday = new \DateTimeImmutable(); 25 | $dateThreeDaysAgo = $dateToday->sub(new \DateInterval('P3D')); 26 | 27 | $dateTimeStart = $dateThreeDaysAgo; 28 | $dateTimeEnd = $dateToday; 29 | 30 | // Get usage statistics from the API 31 | $usageStatistics = $api->bigStorageUsage()->getUsageStatistics( 32 | $bigStorageName, 33 | $dateTimeStart->getTimestamp(), 34 | $dateTimeEnd->getTimestamp() 35 | ); 36 | 37 | foreach ($usageStatistics as $statistic) { 38 | // Convert unix timestamp to human readable date 39 | $date = new DateTime("@{$statistic->getDate()}"); 40 | 41 | // Render statistics 42 | echo "IO Operations per second - Date: {$date->format('Y-m-d H:i')}, Read: {$statistic->getIopsRead()}, Write: {$statistic->getIopsWrite()} \n"; 43 | } 44 | -------------------------------------------------------------------------------- /examples/Kubernetes/Taints.php: -------------------------------------------------------------------------------- 1 | kubernetesTaints()->getAll($clusterName, $nodePoolUuid); 13 | 14 | # Will output the current list of Taints 15 | var_dump($taintList); 16 | 17 | # Will add a noSchedule Taint to the list 18 | $taintList[] = new Taint(['key' => 'test', 'value' => 'test', 'effect' => 'NoSchedule']); 19 | 20 | # Push it to the TransIP API 21 | $api->kubernetesTaints()->update($clusterName, $nodePoolUuid, $taintList); 22 | 23 | # Get the updated list of Taints 24 | $updatedTaintList = $api->kubernetesTaints()->getAll($clusterName, $nodePoolUuid); 25 | 26 | # Outputs your updated list of Taints 27 | var_dump($updatedTaintList); 28 | -------------------------------------------------------------------------------- /examples/Vps/Addon/Cancel.php: -------------------------------------------------------------------------------- 1 | vpsAddons()->cancel($vpsName, $addonName); 16 | -------------------------------------------------------------------------------- /examples/Vps/Addon/GetByName.php: -------------------------------------------------------------------------------- 1 | vpsAddons()->getByVpsName($vpsName); 13 | // print_r($vpsAddons); 14 | 15 | // You can use getter methods like demonstrated below 16 | foreach ($vpsAddons as $addon) { 17 | echo <<getName()} 19 | Description: {$addon->getDescription()} 20 | Price: {$addon->getPrice()} 21 | Recurring Price: {$addon->getRecurringPrice()} 22 | Category: {$addon->getCategory()}\n\n 23 | ADDON; 24 | } 25 | -------------------------------------------------------------------------------- /examples/Vps/Addon/Order.php: -------------------------------------------------------------------------------- 1 | vpsAddons()->order($vpsName, $vpsAddons); 21 | -------------------------------------------------------------------------------- /examples/Vps/Backup/ConvertToSnapshot.php: -------------------------------------------------------------------------------- 1 | vpsBackups()->convertBackupToSnapshot($vpsName, $backupId, $snapshotDescription); 15 | -------------------------------------------------------------------------------- /examples/Vps/Backup/List.php: -------------------------------------------------------------------------------- 1 | vpsBackups()->getByVpsName($vpsName); 14 | // var_dump($backups); 15 | 16 | $backupId = 0; 17 | foreach ($backups as $backup) { 18 | // An example search 19 | if ($backup->getOperatingSystem() === 'OpenBSD 6.4') { 20 | $backupId = $backup->getId(); 21 | break; 22 | } 23 | } 24 | echo $backupId; 25 | -------------------------------------------------------------------------------- /examples/Vps/Backup/Revert.php: -------------------------------------------------------------------------------- 1 | vpsBackups()->revertBackup($vpsName, $backupId); 14 | -------------------------------------------------------------------------------- /examples/Vps/Cancel.php: -------------------------------------------------------------------------------- 1 | vps()->cancel($vpsName, $endTime); 17 | -------------------------------------------------------------------------------- /examples/Vps/Clone.php: -------------------------------------------------------------------------------- 1 | vps()->cloneVps($vpsName, $availabilityZone); 13 | -------------------------------------------------------------------------------- /examples/Vps/Firewall/AddRule.php: -------------------------------------------------------------------------------- 1 | setDescription('HTTP'); 10 | $firewallRule->setStartPort(80); 11 | $firewallRule->setEndPort(80); 12 | $firewallRule->setProtocol('tcp'); 13 | $firewallRule->setWhitelist([]); 14 | 15 | // Get current rules list 16 | $firewall = $api->vpsFirewall()->getByVpsName($vpsName); 17 | 18 | // Add rules to current list 19 | $firewall->addRule($firewallRule); 20 | 21 | // Apply the changes 22 | $api->vpsFirewall()->update($vpsName, $firewall); 23 | -------------------------------------------------------------------------------- /examples/Vps/Order.php: -------------------------------------------------------------------------------- 1 | vps()->order( 19 | // $productName, 20 | // $operatingSystemToInstall 21 | // ); 22 | 23 | /** 24 | * Example 2: Order a VPS with an addon and choose your data center 25 | */ 26 | $addons = ['vpsAddon-1-extra-ip-address']; 27 | $hostName = 'server.yoursite.com'; 28 | $availabilityZone = 'ams0'; 29 | $description = 'My email server'; 30 | 31 | // Order VPS 32 | $api->vps()->order( 33 | $productName, 34 | $operatingSystemToInstall, 35 | $addons, 36 | $hostName, 37 | $availabilityZone, 38 | $description 39 | ); 40 | -------------------------------------------------------------------------------- /phpstan.neon: -------------------------------------------------------------------------------- 1 | parameters: 2 | bootstrapFiles: 3 | - .phpstan-bootstrap.php 4 | level: 8 5 | paths: 6 | - src 7 | -------------------------------------------------------------------------------- /phpunit.xml.dist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | 11 | ./tests 12 | 13 | 14 | 15 | 16 | 17 | src 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /src/Entity/AbstractEntity.php: -------------------------------------------------------------------------------- 1 | $valueArray 11 | */ 12 | public function __construct(array $valueArray = []) 13 | { 14 | foreach ($valueArray as $field => $value) { 15 | if (property_exists($this, $field)) { 16 | $this->$field = $value; 17 | } 18 | } 19 | } 20 | 21 | /** 22 | * This method returns data that can be serialized by json_encode() 23 | * natively. 24 | * 25 | * @return mixed 26 | * @link http://php.net/manual/en/jsonserializable.jsonserialize.php 27 | */ 28 | #[\ReturnTypeWillChange] 29 | public function jsonSerialize() 30 | { 31 | return get_object_vars($this); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/Entity/Acronis/Tenant.php: -------------------------------------------------------------------------------- 1 | uuid; 37 | } 38 | 39 | /** 40 | * Get $name 41 | * 42 | * @return string 43 | */ 44 | public function getName() 45 | { 46 | return $this->name; 47 | } 48 | 49 | /** 50 | * Get $description 51 | * 52 | * @return string 53 | */ 54 | public function getDescription() 55 | { 56 | return $this->description; 57 | } 58 | 59 | public function setDescription(string $description): Tenant 60 | { 61 | $this->description = $description; 62 | return $this; 63 | } 64 | 65 | /** 66 | * Get $isSelfManaged 67 | * 68 | * @return bool 69 | */ 70 | public function isSelfManaged() 71 | { 72 | return $this->isSelfManaged; 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /src/Entity/Acronis/Usage.php: -------------------------------------------------------------------------------- 1 | currentUsage; 27 | } 28 | 29 | /** 30 | * Get $limit 31 | * 32 | * @return string 33 | */ 34 | public function getLimit() 35 | { 36 | return $this->limit; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/Entity/AvailabilityZone.php: -------------------------------------------------------------------------------- 1 | name; 25 | } 26 | 27 | public function getCountry(): string 28 | { 29 | return $this->country; 30 | } 31 | 32 | public function isDefault(): bool 33 | { 34 | return $this->isDefault; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/Entity/BigStorage.php: -------------------------------------------------------------------------------- 1 | name; 50 | } 51 | 52 | public function getDescription(): string 53 | { 54 | return $this->description; 55 | } 56 | 57 | public function getDiskSize(): int 58 | { 59 | return $this->diskSize; 60 | } 61 | 62 | public function getVpsName(): string 63 | { 64 | return $this->vpsName; 65 | } 66 | 67 | public function getStatus(): string 68 | { 69 | return $this->status; 70 | } 71 | 72 | public function isLocked(): bool 73 | { 74 | return $this->isLocked; 75 | } 76 | 77 | public function getAvailabilityZone(): string 78 | { 79 | return $this->availabilityZone; 80 | } 81 | 82 | public function setDescription(string $description): BigStorage 83 | { 84 | $this->description = $description; 85 | return $this; 86 | } 87 | 88 | public function setVpsName(string $vpsName): BigStorage 89 | { 90 | $this->vpsName = $vpsName; 91 | return $this; 92 | } 93 | 94 | public function getSerial(): string 95 | { 96 | return $this->serial; 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /src/Entity/BigStorage/Backup.php: -------------------------------------------------------------------------------- 1 | id; 38 | } 39 | 40 | public function getStatus(): string 41 | { 42 | return $this->status; 43 | } 44 | 45 | public function getDiskSize(): int 46 | { 47 | return $this->diskSize; 48 | } 49 | 50 | public function getDateTimeCreate(): string 51 | { 52 | return $this->dateTimeCreate; 53 | } 54 | 55 | public function getAvailabilityZone(): string 56 | { 57 | return $this->availabilityZone; 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /src/Entity/BlockStorage/Backup.php: -------------------------------------------------------------------------------- 1 | id; 38 | } 39 | 40 | public function getStatus(): string 41 | { 42 | return $this->status; 43 | } 44 | 45 | public function getSize(): int 46 | { 47 | return $this->size; 48 | } 49 | 50 | public function getDateTimeCreate(): string 51 | { 52 | return $this->dateTimeCreate; 53 | } 54 | 55 | public function getAvailabilityZone(): string 56 | { 57 | return $this->availabilityZone; 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /src/Entity/Colocation.php: -------------------------------------------------------------------------------- 1 | name; 20 | } 21 | 22 | /** 23 | * @return string[] 24 | */ 25 | public function getIpRanges(): array 26 | { 27 | return $this->ipRanges; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/Entity/Colocation/RemoteHands.php: -------------------------------------------------------------------------------- 1 | coloName; 37 | } 38 | 39 | public function setColoName(string $coloName): RemoteHands 40 | { 41 | $this->coloName = $coloName; 42 | return $this; 43 | } 44 | 45 | public function getContactName(): string 46 | { 47 | return $this->contactName; 48 | } 49 | 50 | public function setContactName(string $contactName): RemoteHands 51 | { 52 | $this->contactName = $contactName; 53 | return $this; 54 | } 55 | 56 | public function getPhoneNumber(): string 57 | { 58 | return $this->phoneNumber; 59 | } 60 | 61 | public function setPhoneNumber(string $phoneNumber): RemoteHands 62 | { 63 | $this->phoneNumber = $phoneNumber; 64 | return $this; 65 | } 66 | 67 | public function getExpectedDuration(): int 68 | { 69 | return $this->expectedDuration; 70 | } 71 | 72 | public function setExpectedDuration(int $expectedDuration): RemoteHands 73 | { 74 | $this->expectedDuration = $expectedDuration; 75 | return $this; 76 | } 77 | 78 | public function getInstructions(): string 79 | { 80 | return $this->instructions; 81 | } 82 | 83 | public function setInstructions(string $instructions): RemoteHands 84 | { 85 | $this->instructions = $instructions; 86 | return $this; 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /src/Entity/Domain/Action.php: -------------------------------------------------------------------------------- 1 | name; 27 | } 28 | 29 | public function getMessage(): string 30 | { 31 | return $this->message; 32 | } 33 | 34 | public function getHasFailed(): bool 35 | { 36 | return $this->hasFailed; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/Entity/Domain/DnsSecEntry.php: -------------------------------------------------------------------------------- 1 | keyTag; 32 | } 33 | 34 | public function setKeyTag(int $keyTag): DnsSecEntry 35 | { 36 | $this->keyTag = $keyTag; 37 | return $this; 38 | } 39 | 40 | public function getFlags(): int 41 | { 42 | return $this->flags; 43 | } 44 | 45 | public function setFlags(int $flags): DnsSecEntry 46 | { 47 | $this->flags = $flags; 48 | return $this; 49 | } 50 | 51 | public function getAlgorithm(): int 52 | { 53 | return $this->algorithm; 54 | } 55 | 56 | public function setAlgorithm(int $algorithm): DnsSecEntry 57 | { 58 | $this->algorithm = $algorithm; 59 | return $this; 60 | } 61 | 62 | public function getPublicKey(): string 63 | { 64 | return $this->publicKey; 65 | } 66 | 67 | public function setPublicKey(string $publicKey): DnsSecEntry 68 | { 69 | $this->publicKey = $publicKey; 70 | return $this; 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /src/Entity/Domain/Nameserver.php: -------------------------------------------------------------------------------- 1 | hostname; 27 | } 28 | 29 | public function setHostname(string $hostname): Nameserver 30 | { 31 | $this->hostname = $hostname; 32 | return $this; 33 | } 34 | 35 | public function getIpv4(): string 36 | { 37 | return $this->ipv4; 38 | } 39 | 40 | public function setIpv4(string $ipv4): Nameserver 41 | { 42 | $this->ipv4 = $ipv4; 43 | return $this; 44 | } 45 | 46 | public function getIpv6(): string 47 | { 48 | return $this->ipv6; 49 | } 50 | 51 | public function setIpv6(string $ipv6): Nameserver 52 | { 53 | $this->ipv6 = $ipv6; 54 | return $this; 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /src/Entity/DomainCheckResult.php: -------------------------------------------------------------------------------- 1 | domainName; 32 | } 33 | 34 | public function getStatus(): string 35 | { 36 | return $this->status; 37 | } 38 | 39 | /** 40 | * @return string[] 41 | */ 42 | public function getActions(): array 43 | { 44 | return $this->actions; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/Entity/Email/MailAddon.php: -------------------------------------------------------------------------------- 1 | id; 39 | } 40 | 41 | public function setId(int $id): void 42 | { 43 | $this->id = $id; 44 | } 45 | 46 | public function getDiskSpace(): int 47 | { 48 | return $this->diskSpace; 49 | } 50 | 51 | public function setDiskSpace(int $diskSpace): void 52 | { 53 | $this->diskSpace = $diskSpace; 54 | } 55 | 56 | public function getMailboxes(): int 57 | { 58 | return $this->mailboxes; 59 | } 60 | 61 | public function setMailboxes(int $mailboxes): void 62 | { 63 | $this->mailboxes = $mailboxes; 64 | } 65 | 66 | public function getLinkedMailBox(): string 67 | { 68 | return $this->linkedMailBox; 69 | } 70 | 71 | public function setLinkedMailBox(string $linkedMailBox): void 72 | { 73 | $this->linkedMailBox = $linkedMailBox; 74 | } 75 | 76 | public function isCanBeLinked(): bool 77 | { 78 | return $this->canBeLinked; 79 | } 80 | 81 | public function setCanBeLinked(bool $canBeLinked): void 82 | { 83 | $this->canBeLinked = $canBeLinked; 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /src/Entity/Email/MailList.php: -------------------------------------------------------------------------------- 1 | id; 35 | } 36 | 37 | /** 38 | * @param int $id 39 | */ 40 | public function setId(int $id): void 41 | { 42 | $this->id = $id; 43 | } 44 | 45 | /** 46 | * @return string 47 | */ 48 | public function getName(): string 49 | { 50 | return $this->name; 51 | } 52 | 53 | /** 54 | * @param string $name 55 | */ 56 | public function setName(string $name): void 57 | { 58 | $this->name = $name; 59 | } 60 | 61 | /** 62 | * @return string 63 | */ 64 | public function getEmailAddress(): string 65 | { 66 | return $this->emailAddress; 67 | } 68 | 69 | /** 70 | * @param string $emailAddress 71 | */ 72 | public function setEmailAddress(string $emailAddress): void 73 | { 74 | $this->emailAddress = $emailAddress; 75 | } 76 | 77 | /** 78 | * @return string[]|null 79 | */ 80 | public function getEntries(): ?array 81 | { 82 | return $this->entries; 83 | } 84 | 85 | /** 86 | * @param string[] $entries 87 | */ 88 | public function setEntries(array $entries): void 89 | { 90 | $this->entries = $entries; 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /src/Entity/Email/MailPackage.php: -------------------------------------------------------------------------------- 1 | domain; 22 | } 23 | 24 | public function setDomain(string $domain): void 25 | { 26 | $this->domain = $domain; 27 | } 28 | 29 | public function getStatus(): string 30 | { 31 | return $this->status; 32 | } 33 | 34 | public function setStatus(string $status): void 35 | { 36 | $this->status = $status; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/Entity/Haip/Certificate.php: -------------------------------------------------------------------------------- 1 | id; 32 | } 33 | 34 | public function getCommonName(): string 35 | { 36 | return $this->commonName; 37 | } 38 | 39 | public function getExpirationDate(): string 40 | { 41 | return $this->expirationDate; 42 | } 43 | 44 | public function getIssuerType(): string 45 | { 46 | return $this->issuerType; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/Entity/Haip/PortConfiguration.php: -------------------------------------------------------------------------------- 1 | id; 42 | } 43 | 44 | public function getName(): string 45 | { 46 | return $this->name; 47 | } 48 | 49 | public function getSourcePort(): int 50 | { 51 | return $this->sourcePort; 52 | } 53 | 54 | public function getTargetPort(): int 55 | { 56 | return $this->targetPort; 57 | } 58 | 59 | public function getMode(): string 60 | { 61 | return $this->mode; 62 | } 63 | 64 | public function getEndpointSslMode(): string 65 | { 66 | return $this->endpointSslMode; 67 | } 68 | 69 | public function setName(string $name): PortConfiguration 70 | { 71 | $this->name = $name; 72 | return $this; 73 | } 74 | 75 | public function setSourcePort(int $sourcePort): PortConfiguration 76 | { 77 | $this->sourcePort = $sourcePort; 78 | return $this; 79 | } 80 | 81 | public function setTargetPort(int $targetPort): PortConfiguration 82 | { 83 | $this->targetPort = $targetPort; 84 | return $this; 85 | } 86 | 87 | public function setMode(string $mode): PortConfiguration 88 | { 89 | $this->mode = $mode; 90 | return $this; 91 | } 92 | 93 | public function setEndpointSslMode(string $endpointSslMode): PortConfiguration 94 | { 95 | $this->endpointSslMode = $endpointSslMode; 96 | return $this; 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /src/Entity/Haip/StatusReport.php: -------------------------------------------------------------------------------- 1 | port; 47 | } 48 | 49 | public function getIpVersion(): string 50 | { 51 | return $this->ipVersion; 52 | } 53 | 54 | public function getIpAddress(): string 55 | { 56 | return $this->ipAddress; 57 | } 58 | 59 | public function getLoadBalancerName(): string 60 | { 61 | return $this->loadBalancerName; 62 | } 63 | 64 | public function getLoadBalancerIp(): string 65 | { 66 | return $this->loadBalancerIp; 67 | } 68 | 69 | public function getState(): string 70 | { 71 | return $this->state; 72 | } 73 | 74 | public function getLastChange(): string 75 | { 76 | return $this->lastChange; 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /src/Entity/Invoice.php: -------------------------------------------------------------------------------- 1 | invoiceNumber; 53 | } 54 | 55 | /** 56 | * @return string 57 | */ 58 | public function getCreationDate(): string 59 | { 60 | return $this->creationDate; 61 | } 62 | 63 | /** 64 | * @return string 65 | */ 66 | public function getPayDate(): string 67 | { 68 | return $this->payDate; 69 | } 70 | 71 | /** 72 | * @return string 73 | */ 74 | public function getDueDate(): string 75 | { 76 | return $this->dueDate; 77 | } 78 | 79 | /** 80 | * @return string 81 | */ 82 | public function getInvoiceStatus(): string 83 | { 84 | return $this->invoiceStatus; 85 | } 86 | 87 | /** 88 | * @return string 89 | */ 90 | public function getCurrency(): string 91 | { 92 | return $this->currency; 93 | } 94 | 95 | /** 96 | * @return int 97 | */ 98 | public function getTotalAmount(): int 99 | { 100 | return $this->totalAmount; 101 | } 102 | 103 | /** 104 | * @return int 105 | */ 106 | public function getTotalAmountInclVat(): int 107 | { 108 | return $this->totalAmountInclVat; 109 | } 110 | } 111 | -------------------------------------------------------------------------------- /src/Entity/Invoice/InvoiceItemDiscount.php: -------------------------------------------------------------------------------- 1 | description; 21 | } 22 | 23 | public function getAmount(): int 24 | { 25 | return $this->amount; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/Entity/Invoice/InvoicePdf.php: -------------------------------------------------------------------------------- 1 | pdf; 17 | } 18 | 19 | public function getPdf(): string 20 | { 21 | return base64_decode($this->pdf); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/Entity/Kubernetes/Cluster.php: -------------------------------------------------------------------------------- 1 | name; 54 | } 55 | 56 | public function getDescription(): string 57 | { 58 | return $this->description; 59 | } 60 | 61 | public function setDescription(string $description): void 62 | { 63 | $this->description = $description; 64 | } 65 | 66 | public function getVersion(): string 67 | { 68 | return $this->version; 69 | } 70 | 71 | public function getEndpoint(): string 72 | { 73 | return $this->endpoint; 74 | } 75 | 76 | public function isLocked(): bool 77 | { 78 | return $this->isLocked; 79 | } 80 | 81 | public function isBlocked(): bool 82 | { 83 | return $this->isBlocked; 84 | } 85 | 86 | public function setName(string $name): void 87 | { 88 | $this->name = $name; 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /src/Entity/Kubernetes/Cluster/KubeConfig.php: -------------------------------------------------------------------------------- 1 | encodedYaml; 19 | } 20 | 21 | public function getYaml(): string 22 | { 23 | return base64_decode($this->getEncodedYaml()); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/Entity/Kubernetes/Cluster/Release.php: -------------------------------------------------------------------------------- 1 | isCompatibleUpgrade; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/Entity/Kubernetes/IpAddress.php: -------------------------------------------------------------------------------- 1 | address; 27 | } 28 | 29 | public function getSubnetMask(): string 30 | { 31 | return $this->subnetMask; 32 | } 33 | 34 | public function getType(): string 35 | { 36 | return $this->type; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/Entity/Kubernetes/Label.php: -------------------------------------------------------------------------------- 1 | key; 30 | } 31 | 32 | /** 33 | * @return string 34 | */ 35 | public function getValue() 36 | { 37 | return $this->value; 38 | } 39 | 40 | /** 41 | * @return bool 42 | */ 43 | public function getModifiable() 44 | { 45 | return $this->modifiable; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/Entity/Kubernetes/LoadBalancer/AggregatedStatus.php: -------------------------------------------------------------------------------- 1 | total; 21 | } 22 | 23 | public function getUp(): int 24 | { 25 | return $this->up; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/Entity/Kubernetes/LoadBalancer/Balancing.php: -------------------------------------------------------------------------------- 1 | mode; 21 | } 22 | 23 | public function getCookieName(): string 24 | { 25 | return $this->cookieName; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/Entity/Kubernetes/LoadBalancer/Port.php: -------------------------------------------------------------------------------- 1 | name; 26 | } 27 | 28 | public function getPort(): int 29 | { 30 | return $this->port; 31 | } 32 | 33 | public function getMode(): string 34 | { 35 | return $this->mode; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/Entity/Kubernetes/LoadBalancer/StatusReport.php: -------------------------------------------------------------------------------- 1 | nodeUuid; 52 | } 53 | 54 | public function getNodeIpAddress(): string 55 | { 56 | return $this->nodeIpAddress; 57 | } 58 | 59 | public function getPort(): int 60 | { 61 | return $this->port; 62 | } 63 | 64 | public function getIpVersion(): string 65 | { 66 | return $this->ipVersion; 67 | } 68 | 69 | public function getLoadBalancerName(): string 70 | { 71 | return $this->loadBalancerName; 72 | } 73 | 74 | public function getLoadBalancerIp(): string 75 | { 76 | return $this->loadBalancerIp; 77 | } 78 | 79 | public function getState(): string 80 | { 81 | return $this->state; 82 | } 83 | 84 | public function getLastChange(): string 85 | { 86 | return $this->lastChange; 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /src/Entity/Kubernetes/Node.php: -------------------------------------------------------------------------------- 1 | ipAddresses[] = new IpAddress($ipAddress); 42 | } 43 | unset($valueArray['ipAddresses']); 44 | parent::__construct($valueArray); 45 | } 46 | 47 | public function getUuid(): string 48 | { 49 | return $this->uuid; 50 | } 51 | 52 | public function getNodePoolUuid(): string 53 | { 54 | return $this->nodePoolUuid; 55 | } 56 | 57 | public function getClusterName(): string 58 | { 59 | return $this->clusterName; 60 | } 61 | 62 | public function getStatus(): string 63 | { 64 | return $this->status; 65 | } 66 | 67 | /** 68 | * @return IpAddress[] 69 | */ 70 | public function getIpAddresses(): array 71 | { 72 | return $this->ipAddresses; 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /src/Entity/Kubernetes/Product.php: -------------------------------------------------------------------------------- 1 | periodPrices[] = new ProductPeriodPrice($periodPrice); 44 | } 45 | 46 | foreach ($specs as $spec) { 47 | $this->specs[] = new ProductSpec($spec); 48 | } 49 | 50 | unset($valueArray['periodPrices']); 51 | unset($valueArray['specs']); 52 | 53 | parent::__construct($valueArray); 54 | } 55 | 56 | public function getType(): string 57 | { 58 | return $this->type; 59 | } 60 | 61 | public function getName(): string 62 | { 63 | return $this->name; 64 | } 65 | 66 | public function getDescription(): string 67 | { 68 | return $this->description; 69 | } 70 | 71 | /** 72 | * @return ProductPeriodPrice[] 73 | */ 74 | public function getPeriodPrices(): array 75 | { 76 | return $this->periodPrices; 77 | } 78 | 79 | /** 80 | * @return ProductSpec[] 81 | */ 82 | public function getSpecs(): array 83 | { 84 | return $this->specs; 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /src/Entity/Kubernetes/ProductPeriodPrice.php: -------------------------------------------------------------------------------- 1 | periodUnit; 37 | } 38 | 39 | public function getPeriodLength(): int 40 | { 41 | return $this->periodLength; 42 | } 43 | 44 | public function isExact(): bool 45 | { 46 | return $this->isExact; 47 | } 48 | 49 | public function getCurrency(): string 50 | { 51 | return $this->currency; 52 | } 53 | 54 | public function getCostCents(): int 55 | { 56 | return $this->costCents; 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /src/Entity/Kubernetes/ProductSpec.php: -------------------------------------------------------------------------------- 1 | name; 32 | } 33 | 34 | public function getUnit(): string 35 | { 36 | return $this->unit; 37 | } 38 | 39 | public function getAmount(): int 40 | { 41 | return $this->amount; 42 | } 43 | 44 | public function getDescription(): string 45 | { 46 | return $this->description; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/Entity/Kubernetes/Release.php: -------------------------------------------------------------------------------- 1 | version; 32 | } 33 | 34 | public function getReleaseDate(): string 35 | { 36 | return $this->releaseDate; 37 | } 38 | 39 | public function getMaintenanceModeDate(): string 40 | { 41 | return $this->maintenanceModeDate; 42 | } 43 | 44 | public function getEndOfLifeDate(): string 45 | { 46 | return $this->endOfLifeDate; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/Entity/Kubernetes/Taint.php: -------------------------------------------------------------------------------- 1 | key; 35 | } 36 | 37 | /** 38 | * @return string 39 | */ 40 | public function getValue() 41 | { 42 | return $this->value; 43 | } 44 | 45 | /** 46 | * @return string 47 | */ 48 | public function getEffect() 49 | { 50 | return $this->effect; 51 | } 52 | 53 | /** 54 | * @return bool 55 | */ 56 | public function getModifiable() 57 | { 58 | return $this->modifiable; 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /src/Entity/MailServiceInformation.php: -------------------------------------------------------------------------------- 1 | username; 35 | } 36 | 37 | public function getPassword(): string 38 | { 39 | return $this->password; 40 | } 41 | 42 | public function getUsage(): int 43 | { 44 | return $this->usage; 45 | } 46 | 47 | public function getQuota(): int 48 | { 49 | return $this->quota; 50 | } 51 | 52 | public function getDnsTxt(): string 53 | { 54 | return $this->dnsTxt; 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /src/Entity/ObjectStoreQuota.php: -------------------------------------------------------------------------------- 1 | bytesQuota; 25 | } 26 | 27 | public function getBytesUsed(): int 28 | { 29 | return $this->bytesUsed; 30 | } 31 | 32 | public function setBytesQuota(int $bytesQuota): void 33 | { 34 | $this->bytesQuota = $bytesQuota; 35 | } 36 | 37 | public function setBytesUsed(int $bytesUsed): void 38 | { 39 | $this->bytesUsed = $bytesUsed; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/Entity/OpenStackToken.php: -------------------------------------------------------------------------------- 1 | tokenId; 57 | } 58 | 59 | /** 60 | * @return string 61 | */ 62 | public function getUserId(): string 63 | { 64 | return $this->userId; 65 | } 66 | 67 | /** 68 | * @return string 69 | */ 70 | public function getProjectId(): string 71 | { 72 | return $this->projectId; 73 | } 74 | 75 | /** 76 | * @return string 77 | */ 78 | public function getAccessKey(): string 79 | { 80 | return $this->accessKey; 81 | } 82 | 83 | /** 84 | * @return string 85 | */ 86 | public function getSecretKey(): string 87 | { 88 | return $this->secretKey; 89 | } 90 | 91 | /** 92 | * @return string 93 | */ 94 | public function getManagementUrl(): string 95 | { 96 | return $this->managementUrl; 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /src/Entity/OpenStackTotp.php: -------------------------------------------------------------------------------- 1 | secretKey; 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /src/Entity/OpenStackUser.php: -------------------------------------------------------------------------------- 1 | id; 47 | } 48 | 49 | public function getUsername(): string 50 | { 51 | return $this->username; 52 | } 53 | 54 | public function getDescription(): string 55 | { 56 | return $this->description; 57 | } 58 | 59 | public function getEmail(): string 60 | { 61 | return $this->email; 62 | } 63 | 64 | public function setDescription(string $description): void 65 | { 66 | $this->description = $description; 67 | } 68 | 69 | public function setEmail(string $email): void 70 | { 71 | $this->email = $email; 72 | } 73 | 74 | public function getTotpEnabled(): bool 75 | { 76 | return $this->totpEnabled; 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /src/Entity/PrivateNetwork.php: -------------------------------------------------------------------------------- 1 | connectedVpses[] = new Vps($connectedVps); 44 | } 45 | unset($valueArray['connectedVpses']); 46 | parent::__construct($valueArray); 47 | } 48 | 49 | public function getName(): string 50 | { 51 | return $this->name; 52 | } 53 | 54 | public function getDescription(): string 55 | { 56 | return $this->description; 57 | } 58 | 59 | public function isBlocked(): bool 60 | { 61 | return $this->isBlocked; 62 | } 63 | 64 | public function isLocked(): bool 65 | { 66 | return $this->isLocked; 67 | } 68 | 69 | /** 70 | * @return string[] 71 | */ 72 | public function getVpsNames(): array 73 | { 74 | return $this->vpsNames; 75 | } 76 | 77 | /** 78 | * @return Vps[] 79 | */ 80 | public function getConnectedVpses(): array 81 | { 82 | return $this->connectedVpses; 83 | } 84 | 85 | public function setDescription(string $description): PrivateNetwork 86 | { 87 | $this->description = $description; 88 | return $this; 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /src/Entity/PrivateNetwork/Vps.php: -------------------------------------------------------------------------------- 1 | name; 47 | } 48 | 49 | public function getUuid(): string 50 | { 51 | return $this->uuid; 52 | } 53 | 54 | public function getDescription(): string 55 | { 56 | return $this->description; 57 | } 58 | 59 | public function getMacAddress(): string 60 | { 61 | return $this->macAddress; 62 | } 63 | 64 | public function isLocked(): bool 65 | { 66 | return $this->isLocked; 67 | } 68 | 69 | public function isBlocked(): bool 70 | { 71 | return $this->isBlocked; 72 | } 73 | 74 | public function isCustomerLocked(): bool 75 | { 76 | return $this->isCustomerLocked; 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /src/Entity/Product.php: -------------------------------------------------------------------------------- 1 | name; 35 | } 36 | 37 | public function getDescription(): string 38 | { 39 | return $this->description; 40 | } 41 | 42 | public function getPrice(): int 43 | { 44 | return $this->price; 45 | } 46 | 47 | public function getRecurringPrice(): int 48 | { 49 | return $this->recurringPrice; 50 | } 51 | 52 | public function getCategory(): string 53 | { 54 | return $this->category; 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /src/Entity/Product/Element.php: -------------------------------------------------------------------------------- 1 | name; 27 | } 28 | 29 | public function getDescription(): string 30 | { 31 | return $this->description; 32 | } 33 | 34 | public function getAmount(): int 35 | { 36 | return $this->amount; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/Entity/SslCertificate.php: -------------------------------------------------------------------------------- 1 | certificateId; 30 | } 31 | 32 | public function getCommonName(): string 33 | { 34 | return $this->commonName; 35 | } 36 | 37 | public function getExpirationDate(): string 38 | { 39 | return $this->expirationDate; 40 | } 41 | 42 | public function getStatus(): string 43 | { 44 | return $this->status; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/Entity/SslCertificate/CertificateData.php: -------------------------------------------------------------------------------- 1 | caBundleCrt; 35 | } 36 | 37 | /** 38 | * @return string 39 | */ 40 | public function getCertificateCrt(): string 41 | { 42 | return $this->certificateCrt; 43 | } 44 | 45 | /** 46 | * @return string 47 | */ 48 | public function getCertificateP7b(): string 49 | { 50 | return $this->certificateP7b; 51 | } 52 | 53 | /** 54 | * @return string 55 | */ 56 | public function getCertificateKey(): string 57 | { 58 | return $this->certificateKey; 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /src/Entity/Vps/Backup.php: -------------------------------------------------------------------------------- 1 | id; 47 | } 48 | 49 | public function getDateTimeCreate(): string 50 | { 51 | return $this->dateTimeCreate; 52 | } 53 | 54 | public function getDiskSize(): string 55 | { 56 | return $this->diskSize; 57 | } 58 | 59 | public function getOperatingSystem(): string 60 | { 61 | return $this->operatingSystem; 62 | } 63 | 64 | public function getAvailabilityZone(): string 65 | { 66 | return $this->availabilityZone; 67 | } 68 | 69 | public function getStatus(): string 70 | { 71 | return $this->status; 72 | } 73 | 74 | public function getRetentionType(): string 75 | { 76 | return $this->retentionType; 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /src/Entity/Vps/Contact.php: -------------------------------------------------------------------------------- 1 | id; 35 | } 36 | 37 | /** 38 | * @param int $id 39 | */ 40 | public function setId(int $id): void 41 | { 42 | $this->id = $id; 43 | } 44 | 45 | /** 46 | * @return string 47 | */ 48 | public function getName(): string 49 | { 50 | return $this->name; 51 | } 52 | 53 | /** 54 | * @param string $name 55 | */ 56 | public function setName(string $name): void 57 | { 58 | $this->name = $name; 59 | } 60 | 61 | /** 62 | * @return string 63 | */ 64 | public function getTelephone(): string 65 | { 66 | return $this->telephone; 67 | } 68 | 69 | /** 70 | * @param string $telephone 71 | */ 72 | public function setTelephone(string $telephone): void 73 | { 74 | $this->telephone = $telephone; 75 | } 76 | 77 | /** 78 | * @return string 79 | */ 80 | public function getEmail(): string 81 | { 82 | return $this->email; 83 | } 84 | 85 | /** 86 | * @param string $email 87 | */ 88 | public function setEmail(string $email): void 89 | { 90 | $this->email = $email; 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /src/Entity/Vps/IpAddress.php: -------------------------------------------------------------------------------- 1 | address; 37 | } 38 | 39 | public function getSubnetMask(): string 40 | { 41 | return $this->subnetMask; 42 | } 43 | 44 | public function getGateway(): string 45 | { 46 | return $this->gateway; 47 | } 48 | 49 | /** 50 | * @return string[] 51 | */ 52 | public function getDnsResolvers(): array 53 | { 54 | return $this->dnsResolvers; 55 | } 56 | 57 | public function getReverseDns(): string 58 | { 59 | return $this->reverseDns; 60 | } 61 | 62 | public function setReverseDns(string $reverseDns): IpAddress 63 | { 64 | $this->reverseDns = $reverseDns; 65 | return $this; 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /src/Entity/Vps/LicenseKey.php: -------------------------------------------------------------------------------- 1 | name; 18 | } 19 | 20 | public function getKey(): string 21 | { 22 | return $this->key; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/Entity/Vps/LicenseProduct.php: -------------------------------------------------------------------------------- 1 | name; 30 | } 31 | 32 | public function getPrice(): int 33 | { 34 | return $this->price; 35 | } 36 | 37 | public function getRecurringPrice(): int 38 | { 39 | return $this->recurringPrice; 40 | } 41 | 42 | public function getType(): string 43 | { 44 | return $this->type; 45 | } 46 | 47 | public function getMinQuantity(): int 48 | { 49 | return $this->minQuantity; 50 | } 51 | 52 | public function getMaxQuantity(): int 53 | { 54 | return $this->maxQuantity; 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /src/Entity/Vps/Licenses.php: -------------------------------------------------------------------------------- 1 | active; 24 | } 25 | 26 | /** 27 | * @return License[] 28 | */ 29 | public function getCancellable(): array 30 | { 31 | return $this->cancellable; 32 | } 33 | 34 | /** 35 | * @return LicenseProduct[] 36 | */ 37 | public function getAvailable(): array 38 | { 39 | return $this->available; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/Entity/Vps/RescueImage.php: -------------------------------------------------------------------------------- 1 | name; 27 | } 28 | 29 | /** 30 | * @param string $name 31 | */ 32 | public function setName(string $name): void 33 | { 34 | $this->name = $name; 35 | } 36 | 37 | public function getSupportsSshKeys(): bool 38 | { 39 | return $this->supportsSshKeys; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/Entity/Vps/Setting.php: -------------------------------------------------------------------------------- 1 | name; 35 | } 36 | 37 | /** 38 | * @param string $name 39 | */ 40 | public function setName(string $name): void 41 | { 42 | $this->name = $name; 43 | } 44 | 45 | /** 46 | * @return string 47 | */ 48 | public function getDataType(): string 49 | { 50 | return $this->dataType; 51 | } 52 | 53 | /** 54 | * @param string $dataType 55 | */ 56 | public function setDataType(string $dataType): void 57 | { 58 | $this->dataType = $dataType; 59 | } 60 | 61 | /** 62 | * @return bool 63 | */ 64 | public function isReadOnly(): bool 65 | { 66 | return $this->readOnly; 67 | } 68 | 69 | /** 70 | * @param bool $readOnly 71 | */ 72 | public function setReadOnly(bool $readOnly): void 73 | { 74 | $this->readOnly = $readOnly; 75 | } 76 | 77 | /** 78 | * @return SettingValue 79 | */ 80 | public function getValue(): SettingValue 81 | { 82 | return $this->value; 83 | } 84 | 85 | /** 86 | * @param SettingValue $value 87 | */ 88 | public function setValue(SettingValue $value): void 89 | { 90 | $this->value = $value; 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /src/Entity/Vps/SettingValue.php: -------------------------------------------------------------------------------- 1 | valueBoolean; 25 | } 26 | 27 | /** 28 | * @param bool $valueBoolean 29 | */ 30 | public function setValueBoolean(bool $valueBoolean): void 31 | { 32 | $this->valueBoolean = $valueBoolean; 33 | } 34 | 35 | /** 36 | * @return string 37 | */ 38 | public function getValueString(): string 39 | { 40 | return $this->valueString; 41 | } 42 | 43 | /** 44 | * @param string $valueString 45 | */ 46 | public function setValueString(string $valueString): void 47 | { 48 | $this->valueString = $valueString; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/Entity/Vps/Snapshot.php: -------------------------------------------------------------------------------- 1 | name; 42 | } 43 | 44 | public function getDescription(): string 45 | { 46 | return $this->description; 47 | } 48 | 49 | public function getDateTimeCreate(): string 50 | { 51 | return $this->dateTimeCreate; 52 | } 53 | 54 | public function getDiskSize(): string 55 | { 56 | return $this->diskSize; 57 | } 58 | 59 | public function getStatus(): string 60 | { 61 | return $this->status; 62 | } 63 | 64 | public function getOperatingSystem(): string 65 | { 66 | return $this->operatingSystem; 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /src/Entity/Vps/TCPMonitorContact.php: -------------------------------------------------------------------------------- 1 | id; 30 | } 31 | 32 | /** 33 | * @param int $id 34 | */ 35 | public function setId(int $id): void 36 | { 37 | $this->id = $id; 38 | } 39 | 40 | /** 41 | * @return bool 42 | */ 43 | public function isEnableEmail(): bool 44 | { 45 | return $this->enableEmail; 46 | } 47 | 48 | /** 49 | * @param bool $enableEmail 50 | */ 51 | public function setEnableEmail(bool $enableEmail): void 52 | { 53 | $this->enableEmail = $enableEmail; 54 | } 55 | 56 | /** 57 | * @return bool 58 | */ 59 | public function isEnableSMS(): bool 60 | { 61 | return $this->enableSMS; 62 | } 63 | 64 | /** 65 | * @param bool $enableSMS 66 | */ 67 | public function setEnableSMS(bool $enableSMS): void 68 | { 69 | $this->enableSMS = $enableSMS; 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /src/Entity/Vps/TCPMonitorIgnoreTime.php: -------------------------------------------------------------------------------- 1 | timeFrom; 25 | } 26 | 27 | /** 28 | * @param string $timeFrom 29 | */ 30 | public function setTimeFrom(string $timeFrom): void 31 | { 32 | $this->timeFrom = $timeFrom; 33 | } 34 | 35 | /** 36 | * @return string 37 | */ 38 | public function getTimeTo(): string 39 | { 40 | return $this->timeTo; 41 | } 42 | 43 | /** 44 | * @param string $timeTo 45 | */ 46 | public function setTimeTo(string $timeTo): void 47 | { 48 | $this->timeTo = $timeTo; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/Entity/Vps/UsageData.php: -------------------------------------------------------------------------------- 1 | date; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/Entity/Vps/UsageDataCpu.php: -------------------------------------------------------------------------------- 1 | percentage; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/Entity/Vps/UsageDataDisk.php: -------------------------------------------------------------------------------- 1 | iopsRead; 20 | } 21 | 22 | public function getIopsWrite(): float 23 | { 24 | return $this->iopsWrite; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/Entity/Vps/UsageDataNetwork.php: -------------------------------------------------------------------------------- 1 | mbitIn; 20 | } 21 | 22 | public function getMbitOut(): float 23 | { 24 | return $this->mbitOut; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/Entity/Vps/VncData.php: -------------------------------------------------------------------------------- 1 | host; 37 | } 38 | 39 | public function getPath(): string 40 | { 41 | return $this->path; 42 | } 43 | 44 | public function getUrl(): string 45 | { 46 | return $this->url; 47 | } 48 | 49 | public function getToken(): string 50 | { 51 | return $this->token; 52 | } 53 | 54 | public function getPassword(): string 55 | { 56 | return $this->password; 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /src/Exception/ApiClientException.php: -------------------------------------------------------------------------------- 1 | getMessage()}", $innerException); 23 | } 24 | 25 | /** 26 | * @deprecated 27 | * @see self::getPrevious() 28 | */ 29 | public function innerException(): ?Throwable 30 | { 31 | return $this->getPrevious(); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/Exception/HttpRequest/AccessTokenException.php: -------------------------------------------------------------------------------- 1 | getMessage()}", $innerException); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/HttpClient/Builder/ClientBuilderInterface.php: -------------------------------------------------------------------------------- 1 | $headers 34 | */ 35 | public function addHeaders(array $headers): void; 36 | 37 | public function addHeaderValue(string $header, string $headerValue): void; 38 | } 39 | -------------------------------------------------------------------------------- /src/HttpClient/Middleware/TokenAuthorization.php: -------------------------------------------------------------------------------- 1 | token = $token; 33 | $this->userAgent = $userAgent; 34 | } 35 | 36 | public function __invoke(callable $handler): Closure 37 | { 38 | return function (RequestInterface $request, array $options) use ($handler) { 39 | return $handler( 40 | $request->withAddedHeader('Authorization', sprintf('Bearer %s', $this->token)) 41 | ->withAddedHeader('User-Agent', $this->userAgent), 42 | $options 43 | ); 44 | }; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/HttpClient/Plugin/ExceptionThrowerPlugin.php: -------------------------------------------------------------------------------- 1 | then(function (ResponseInterface $response) { 28 | if ($response->getStatusCode() < 400 || $response->getStatusCode() > 600) { 29 | return $response; 30 | } 31 | 32 | /** 33 | * Currently this should mimic behaviour of Guzzle, this throws an badResponseException when an HTTP 34 | * error occurs (4xx or 5xx). As this does not happen in the PSR client libraries, we can just create an 35 | * internal Exception at this place. The Exception factory can later be moved here. 36 | */ 37 | throw HttpBadResponseException::badResponseException( 38 | // Add a stub exception here, this is not used and can be removed in a new major release 39 | new RuntimeException('An error response was returned'), 40 | $response 41 | ); 42 | }); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/HttpClient/Plugin/TokenAuthenticationPlugin.php: -------------------------------------------------------------------------------- 1 | token = $token; 31 | $this->userAgent = $userAgent; 32 | } 33 | 34 | /** 35 | * @return callable 36 | */ 37 | public function doHandleRequest(RequestInterface $request, callable $next, callable $first) 38 | { 39 | $request = $request->withHeader('Authorization', sprintf('Bearer %s', $this->token)) 40 | ->withHeader('User-Agent', $this->userAgent); 41 | 42 | return $next($request); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/Repository/Acronis/Tenant/AddonsRepository.php: -------------------------------------------------------------------------------- 1 | $addons 24 | * @return ResponseInterface 25 | */ 26 | public function order(string $tenantUuid, array $addons): ResponseInterface 27 | { 28 | return $this->httpClient->post($this->getResourceUrl($tenantUuid), ['addons' => $addons]); 29 | } 30 | 31 | public function cancel(string $tenantUuid, string $addonName): void 32 | { 33 | $this->httpClient->delete($this->getResourceUrl($tenantUuid, $addonName), []); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/Repository/Acronis/Tenant/DowngradesRepository.php: -------------------------------------------------------------------------------- 1 | httpClient->put($this->getResourceUrl($tenantUuid), ['productName' => $productName]); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/Repository/Acronis/Tenant/LoginRepository.php: -------------------------------------------------------------------------------- 1 | httpClient->get($this->getResourceUrl($tenantUuid)); 24 | $acronisLogin = $this->getParameterFromResponse($response, self::RESPONSE_FIELD); 25 | 26 | return $acronisLogin; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/Repository/Acronis/Tenant/UpgradesRepository.php: -------------------------------------------------------------------------------- 1 | httpClient->put($this->getResourceUrl($tenantUuid), ['productName' => $productName]); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/Repository/Acronis/Tenant/UsageRepository.php: -------------------------------------------------------------------------------- 1 | httpClient->get($this->getResourceUrl($tenantUuid)); 24 | $acronisUsage = $this->getParameterFromResponse($response, self::RESOURCE_NAME); 25 | 26 | return new Usage($acronisUsage); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/Repository/Action/ChildActionRepository.php: -------------------------------------------------------------------------------- 1 | httpClient->get($this->getResourceUrl($parentActionUuid)); 28 | $actions = $this->getParameterFromResponse($response, self::RESOURCE_PARAMETER_PLURAL); 29 | 30 | foreach ($actions as $action) { 31 | $actions[] = new Action($action); 32 | } 33 | 34 | return $actions; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/Repository/ApiRepository.php: -------------------------------------------------------------------------------- 1 | httpClient = $httpClient; 20 | } 21 | 22 | /** 23 | * @param string|int ...$args 24 | * @return string 25 | */ 26 | protected function getResourceUrl(...$args): string 27 | { 28 | $urlSuffix = ''; 29 | $resourceNames = $this->getRepositoryResourceNames(); 30 | while (($resourceName = array_shift($resourceNames)) !== null) { 31 | $id = array_shift($args); 32 | $urlSuffix .= "/{$resourceName}"; 33 | if ($id !== null) { 34 | $urlSuffix .= "/{$id}"; 35 | } 36 | } 37 | return $urlSuffix; 38 | } 39 | 40 | /** 41 | * @return string[] 42 | */ 43 | protected function getRepositoryResourceNames(): array 44 | { 45 | return [static::RESOURCE_NAME]; 46 | } 47 | 48 | /** 49 | * @param mixed[] $response 50 | * @param string $parameterName 51 | * @return mixed 52 | * @throws ApiClientException 53 | */ 54 | protected function getParameterFromResponse(array $response, string $parameterName) 55 | { 56 | if (!isset($response[$parameterName])) { 57 | throw ApiClientException::parameterMissingInResponse($response, $parameterName); 58 | } 59 | return $response[$parameterName]; 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /src/Repository/ApiTestRepository.php: -------------------------------------------------------------------------------- 1 | httpClient->get($this->getResourceUrl()); 12 | $ping = $response['ping'] ?? false; 13 | return $ping === 'pong'; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/Repository/AvailabilityZoneRepository.php: -------------------------------------------------------------------------------- 1 | httpClient->get($this->getResourceUrl()); 18 | $availabilityZonesArray = $this->getParameterFromResponse($response, 'availabilityZones'); 19 | 20 | foreach ($availabilityZonesArray as $availabilityZoneArray) { 21 | $availabilityZones[] = new AvailabilityZone($availabilityZoneArray); 22 | } 23 | 24 | return $availabilityZones; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/Repository/BigStorage/BackupRepository.php: -------------------------------------------------------------------------------- 1 | httpClient->get($this->getResourceUrl($bigStorageName)); 32 | $backupsArray = $this->getParameterFromResponse($response, 'backups'); 33 | 34 | foreach ($backupsArray as $backupArray) { 35 | $backups[] = new Backup($backupArray); 36 | } 37 | 38 | return $backups; 39 | } 40 | 41 | /** 42 | * @deprecated Use block storage resource instead 43 | */ 44 | public function revertBackup(string $bigStorageName, int $backupId, string $destinationBigStorageName = ''): ResponseInterface 45 | { 46 | return $this->httpClient->patch( 47 | $this->getResourceUrl($bigStorageName, $backupId), 48 | [ 49 | 'action' => 'revert', 50 | 'destinationBigStorageName' => $destinationBigStorageName, 51 | ] 52 | ); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/Repository/BigStorage/UsageRepository.php: -------------------------------------------------------------------------------- 1 | 0) { 38 | $parameters['dateTimeStart'] = $dateTimeStart; 39 | } 40 | if ($dateTimeEnd > 0) { 41 | $parameters['dateTimeEnd'] = $dateTimeEnd; 42 | } 43 | 44 | $response = $this->httpClient->get($this->getResourceUrl($bigStorageName), $parameters); 45 | $usageStatistics = $this->getParameterFromResponse($response, 'usage'); 46 | 47 | foreach ($usageStatistics as $usage) { 48 | $usages[] = new UsageDataDisk($usage); 49 | } 50 | 51 | return $usages; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/Repository/BlockStorage/BackupRepository.php: -------------------------------------------------------------------------------- 1 | httpClient->get($this->getResourceUrl($blockStorageName)); 29 | $backupsArray = $this->getParameterFromResponse($response, 'backups'); 30 | 31 | foreach ($backupsArray as $backupArray) { 32 | $backups[] = new Backup($backupArray); 33 | } 34 | 35 | return $backups; 36 | } 37 | 38 | public function revertBackup( 39 | string $blockStorageName, 40 | int $backupId, 41 | string $destinationBlockStorageName = '' 42 | ): ResponseInterface { 43 | return $this->httpClient->patch( 44 | $this->getResourceUrl($blockStorageName, $backupId), 45 | [ 46 | 'action' => 'revert', 47 | 'destinationBlockStorageName' => $destinationBlockStorageName, 48 | ] 49 | ); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/Repository/BlockStorage/UsageRepository.php: -------------------------------------------------------------------------------- 1 | 0) { 33 | $parameters['dateTimeStart'] = $dateTimeStart; 34 | } 35 | if ($dateTimeEnd > 0) { 36 | $parameters['dateTimeEnd'] = $dateTimeEnd; 37 | } 38 | 39 | $response = $this->httpClient->get($this->getResourceUrl($blockStorageName), $parameters); 40 | $usageStatistics = $this->getParameterFromResponse($response, 'usage'); 41 | 42 | foreach ($usageStatistics as $usage) { 43 | $usages[] = new UsageDataDisk($usage); 44 | } 45 | 46 | return $usages; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/Repository/Colocation/AccessRequestRepository.php: -------------------------------------------------------------------------------- 1 | getResourceUrl($accessRequest->getColoName()); 24 | $parameters = ['accessRequest' => $accessRequest]; 25 | $this->httpClient->post($url, $parameters); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/Repository/Colocation/RemoteHandsRepository.php: -------------------------------------------------------------------------------- 1 | getResourceUrl($remoteHands->getColoName()); 24 | $parameters = ['remoteHands' => $remoteHands]; 25 | $this->httpClient->post($url, $parameters); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/Repository/ColocationRepository.php: -------------------------------------------------------------------------------- 1 | httpClient->get($this->getResourceUrl()); 18 | $colocationsArray = $this->getParameterFromResponse($response, 'colocations'); 19 | 20 | foreach ($colocationsArray as $colocationArray) { 21 | $colocations[] = new Colocation($colocationArray); 22 | } 23 | 24 | return $colocations; 25 | } 26 | 27 | public function getByName(string $name): Colocation 28 | { 29 | $response = $this->httpClient->get($this->getResourceUrl($name)); 30 | $colocation = $this->getParameterFromResponse($response, 'colocation'); 31 | 32 | return new Colocation($colocation); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/Repository/ContactKeyRepository.php: -------------------------------------------------------------------------------- 1 | httpClient->get($this->getResourceUrl()); 12 | $contactKey = $response['key'] ?? null; 13 | 14 | return $contactKey; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/Repository/Domain/ActionRepository.php: -------------------------------------------------------------------------------- 1 | httpClient->get($this->getResourceUrl($domainName)); 27 | $action = $this->getParameterFromResponse($response, 'action'); 28 | 29 | return new Action($action); 30 | } 31 | 32 | /** 33 | * @param string $domainName 34 | * @param string $authCode 35 | * @param DnsEntry[] $dnsEntries 36 | * @param Nameserver[] $nameservers 37 | * @param WhoisContact[] $contacts 38 | */ 39 | public function retryDomainAction( 40 | string $domainName, 41 | string $authCode = '', 42 | array $dnsEntries = [], 43 | array $nameservers = [], 44 | array $contacts = [] 45 | ): void { 46 | $parameters = [ 47 | 'authCode' => $authCode, 48 | 'dnsEntries' => $dnsEntries, 49 | 'nameservers' => $nameservers, 50 | 'contacts' => $contacts, 51 | ]; 52 | $this->httpClient->patch($this->getResourceUrl($domainName), $parameters); 53 | } 54 | 55 | public function cancelAction(string $domainName): void 56 | { 57 | $this->httpClient->delete($this->getResourceUrl($domainName), []); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /src/Repository/Domain/AuthCodeRepository.php: -------------------------------------------------------------------------------- 1 | httpClient->get($this->getResourceUrl($domainName)); 23 | $authCode = $this->getParameterFromResponse($response, 'authCode'); 24 | 25 | return $authCode; 26 | } 27 | 28 | public function requestForDomainName(string $domainName): void 29 | { 30 | $this->httpClient->post($this->getResourceUrl($domainName)); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/Repository/Domain/BrandingRepository.php: -------------------------------------------------------------------------------- 1 | httpClient->get($this->getResourceUrl($domainName)); 24 | $branding = $this->getParameterFromResponse($response, 'branding'); 25 | 26 | return new Branding($branding); 27 | } 28 | 29 | public function update(string $domainName, Branding $branding): void 30 | { 31 | $this->httpClient->put($this->getResourceUrl($domainName), ['branding' => $branding]); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/Repository/Domain/ContactRepository.php: -------------------------------------------------------------------------------- 1 | httpClient->get($this->getResourceUrl($domainName)); 29 | $contactsArray = $this->getParameterFromResponse($response, 'contacts'); 30 | 31 | foreach ($contactsArray as $contactArray) { 32 | $contacts[] = new WhoisContact($contactArray); 33 | } 34 | 35 | return $contacts; 36 | } 37 | 38 | /** 39 | * @param string $domainName 40 | * @param WhoisContact[] $contacts 41 | */ 42 | public function update(string $domainName, array $contacts): void 43 | { 44 | $this->httpClient->put($this->getResourceUrl($domainName), ['contacts' => $contacts]); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/Repository/Domain/DnsRepository.php: -------------------------------------------------------------------------------- 1 | httpClient->get($this->getResourceUrl($domainName)); 29 | $dnsEntriesArray = $this->getParameterFromResponse($response, 'dnsEntries'); 30 | 31 | foreach ($dnsEntriesArray as $dnsEntryArray) { 32 | $dnsEntries[] = new DnsEntry($dnsEntryArray); 33 | } 34 | 35 | return $dnsEntries; 36 | } 37 | 38 | public function addDnsEntryToDomain(string $domainName, DnsEntry $dnsEntry): void 39 | { 40 | $this->httpClient->post($this->getResourceUrl($domainName), ['dnsEntry' => $dnsEntry]); 41 | } 42 | 43 | public function updateEntry(string $domainName, DnsEntry $dnsEntry): void 44 | { 45 | $this->httpClient->patch($this->getResourceUrl($domainName), ['dnsEntry' => $dnsEntry]); 46 | } 47 | 48 | /** 49 | * @param string $domainName 50 | * @param DnsEntry[] $dnsEntries 51 | * @return void 52 | */ 53 | public function update(string $domainName, array $dnsEntries): void 54 | { 55 | $this->httpClient->put($this->getResourceUrl($domainName), ['dnsEntries' => $dnsEntries]); 56 | } 57 | 58 | public function removeDnsEntry(string $domainName, DnsEntry $dnsEntry): void 59 | { 60 | $this->httpClient->delete($this->getResourceUrl($domainName), ['dnsEntry' => $dnsEntry]); 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /src/Repository/Domain/DnsSecRepository.php: -------------------------------------------------------------------------------- 1 | httpClient->get($this->getResourceUrl($domainName)); 29 | $dnssecEntriesArray = $this->getParameterFromResponse($response, 'dnsSecEntries'); 30 | 31 | foreach ($dnssecEntriesArray as $dnssecEntryArray) { 32 | $dnssecEntries[] = new DnsSecEntry($dnssecEntryArray); 33 | } 34 | 35 | return $dnssecEntries; 36 | } 37 | 38 | /** 39 | * @param string $domainName 40 | * @param DnsSecEntry[] $dnsSecEntries 41 | */ 42 | public function update(string $domainName, array $dnsSecEntries): void 43 | { 44 | $this->httpClient->put($this->getResourceUrl($domainName), ['dnsSecEntries' => $dnsSecEntries]); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/Repository/Domain/NameserverRepository.php: -------------------------------------------------------------------------------- 1 | httpClient->get($this->getResourceUrl($domainName)); 29 | $nameserversArray = $this->getParameterFromResponse($response, 'nameservers'); 30 | 31 | foreach ($nameserversArray as $nameserverArray) { 32 | $nameservers[] = new Nameserver($nameserverArray); 33 | } 34 | 35 | return $nameservers; 36 | } 37 | 38 | /** 39 | * @param string $domainName 40 | * @param Nameserver[] $nameservers 41 | */ 42 | public function update(string $domainName, array $nameservers): void 43 | { 44 | $this->httpClient->put($this->getResourceUrl($domainName), ['nameservers' => $nameservers]); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/Repository/Domain/SslRepository.php: -------------------------------------------------------------------------------- 1 | httpClient->get($this->getResourceUrl($domainName)); 29 | $sslCertificatesArray = $this->getParameterFromResponse($response, 'certificates'); 30 | 31 | foreach ($sslCertificatesArray as $sslCertificateArray) { 32 | $sslCertificates[] = new \Transip\Api\Library\Entity\SslCertificate($sslCertificateArray); 33 | } 34 | 35 | return $sslCertificates; 36 | } 37 | 38 | public function getByDomainNameCertificateId(string $domainName, int $certificateId): SslCertificate 39 | { 40 | $response = $this->httpClient->get($this->getResourceUrl($domainName, $certificateId)); 41 | $certificate = $this->getParameterFromResponse($response, 'certificate'); 42 | 43 | return new SslCertificate($certificate); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/Repository/Domain/WhoisRepository.php: -------------------------------------------------------------------------------- 1 | httpClient->get($this->getResourceUrl($domainName)); 24 | $whois = $this->getParameterFromResponse($response, 'whois'); 25 | 26 | return $whois; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/Repository/DomainAvailabilityRepository.php: -------------------------------------------------------------------------------- 1 | httpClient->get($this->getResourceUrl($domainName)); 14 | $domainCheckResult = $this->getParameterFromResponse($response, 'availability'); 15 | 16 | return new DomainCheckResult($domainCheckResult); 17 | } 18 | 19 | /** 20 | * @param string[] $domainNames 21 | * @return DomainCheckResult[] 22 | */ 23 | public function checkMultipleDomainNames(array $domainNames): array 24 | { 25 | $domainCheckResults = []; 26 | $response = $this->httpClient->get($this->getResourceUrl(), ['domainNames' => $domainNames]); 27 | $domainCheckArray = $this->getParameterFromResponse($response, 'availability'); 28 | 29 | foreach ($domainCheckArray as $domainArray) { 30 | $domainCheckResults[] = new DomainCheckResult($domainArray); 31 | } 32 | 33 | return $domainCheckResults; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/Repository/DomainDefaults/ContactRepository.php: -------------------------------------------------------------------------------- 1 | httpClient->get($this->getResourceUrl()); 19 | $contactsArray = $this->getParameterFromResponse($response, 'contacts'); 20 | 21 | foreach ($contactsArray as $contactArray) { 22 | $contacts[] = new WhoisContact($contactArray); 23 | } 24 | 25 | return $contacts; 26 | } 27 | 28 | /** 29 | * @param WhoisContact[] $contacts 30 | */ 31 | public function update(array $contacts): void 32 | { 33 | $this->httpClient->put($this->getResourceUrl(), ['contacts' => $contacts]); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/Repository/DomainTldRepository.php: -------------------------------------------------------------------------------- 1 | httpClient->get($this->getResourceUrl()); 18 | $tldsArray = $this->getParameterFromResponse($response, 'tlds'); 19 | 20 | foreach ($tldsArray as $tldArray) { 21 | $tlds[] = new Tld($tldArray); 22 | } 23 | 24 | return $tlds; 25 | } 26 | 27 | /** 28 | * @param int $page 29 | * @param int $itemsPerPage 30 | * @return Tld[] 31 | */ 32 | public function getSelection(int $page, int $itemsPerPage): array 33 | { 34 | $tlds = []; 35 | $query = ['pageSize' => $itemsPerPage, 'page' => $page]; 36 | $response = $this->httpClient->get($this->getResourceUrl(), $query); 37 | $tldList = $this->getParameterFromResponse($response, 'tlds'); 38 | 39 | 40 | foreach ($tldList as $tld) { 41 | $tlds[] = new Tld($tld); 42 | } 43 | 44 | return $tlds; 45 | } 46 | 47 | public function getByTld(string $tld): Tld 48 | { 49 | $response = $this->httpClient->get($this->getResourceUrl($tld)); 50 | $tldArray = $this->getParameterFromResponse($response, 'tld'); 51 | 52 | return new Tld($tldArray); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/Repository/DomainWhitelabelRepository.php: -------------------------------------------------------------------------------- 1 | httpClient->post($this->getResourceUrl()); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/Repository/Email/MailAddonRepository.php: -------------------------------------------------------------------------------- 1 | httpClient->get($this->getResourceUrl($domainName)); 26 | $responseArray = $this->getParameterFromResponse($response, 'addons'); 27 | 28 | return array_map(function ($addon) { 29 | return new MailAddon($addon); 30 | }, $responseArray); 31 | } 32 | 33 | public function linkAddonToMailBox(string $domainName, string $emailAddress, int $addonId): void 34 | { 35 | $this->httpClient->patch($this->getResourceUrl($domainName), [ 36 | 'action' => 'linkmailbox', 37 | 'addonId' => $addonId, 38 | 'mailbox' => $emailAddress, 39 | ]); 40 | } 41 | 42 | public function unlinkAddonFromMailBox(string $domainName, string $emailAddress, int $addonId): void 43 | { 44 | $this->httpClient->patch($this->getResourceUrl($domainName), [ 45 | 'action' => 'unlinkmailbox', 46 | 'addonId' => $addonId, 47 | 'mailbox' => $emailAddress, 48 | ]); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/Repository/Email/MailPackageRepository.php: -------------------------------------------------------------------------------- 1 | httpClient->get($this->getResourceUrl()); 22 | $packagesArray = $this->getParameterFromResponse($response, 'packages'); 23 | 24 | return \array_map(static function (array $packageArray) { 25 | return new MailPackage($packageArray); 26 | }, $packagesArray); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/Repository/EmailRepository.php: -------------------------------------------------------------------------------- 1 | httpClient->get($this->getResourceUrl($haipName)); 29 | $certificateArray = $this->getParameterFromResponse($response, 'certificates'); 30 | 31 | foreach ($certificateArray as $certificateStruct) { 32 | $certificates[] = new Certificate($certificateStruct); 33 | } 34 | 35 | return $certificates; 36 | } 37 | 38 | public function addBySslCertificateId(string $haipName, int $sslCertificateId): void 39 | { 40 | $url = $this->getResourceUrl($haipName); 41 | 42 | $this->httpClient->post($url, ['sslCertificateId' => $sslCertificateId]); 43 | } 44 | 45 | public function addByCommonName(string $haipName, string $commonName): void 46 | { 47 | $url = $this->getResourceUrl($haipName); 48 | 49 | $this->httpClient->post($url, ['commonName' => $commonName]); 50 | } 51 | 52 | public function delete(string $haipName, int $haipCertificateId): void 53 | { 54 | $url = $this->getResourceUrl($haipName, $haipCertificateId); 55 | 56 | $this->httpClient->delete($url); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /src/Repository/Haip/IpAddressRepository.php: -------------------------------------------------------------------------------- 1 | httpClient->get($this->getResourceUrl($haipName)); 28 | $ipAddressesArray = $this->getParameterFromResponse($response, 'ipAddresses'); 29 | 30 | return $ipAddressesArray; 31 | } 32 | 33 | /** 34 | * @param string $haipName 35 | * @param string[] $ipAddresses 36 | * @return void 37 | */ 38 | public function update(string $haipName, array $ipAddresses): void 39 | { 40 | $url = $this->getResourceUrl($haipName); 41 | $this->httpClient->put($url, ['ipAddresses' => $ipAddresses]); 42 | } 43 | 44 | public function delete(string $haipName): void 45 | { 46 | $url = $this->getResourceUrl($haipName); 47 | $this->httpClient->delete($url); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/Repository/Haip/StatusReportRepository.php: -------------------------------------------------------------------------------- 1 | httpClient->get($this->getResourceUrl($haipName)); 30 | $statusReportArray = $this->getParameterFromResponse($response, 'statusReports'); 31 | 32 | foreach ($statusReportArray as $statusReport) { 33 | $statusReports[] = new StatusReport($statusReport); 34 | } 35 | 36 | return $statusReports; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/Repository/Invoice/ItemRepository.php: -------------------------------------------------------------------------------- 1 | httpClient->get($this->getResourceUrl($invoiceNumber)); 29 | $invoiceItemsArray = $this->getParameterFromResponse($response, 'invoiceItems'); 30 | 31 | foreach ($invoiceItemsArray as $invoiceItemArray) { 32 | $invoiceitems[] = new InvoiceItem($invoiceItemArray); 33 | } 34 | 35 | return $invoiceitems; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/Repository/Invoice/PdfRepository.php: -------------------------------------------------------------------------------- 1 | httpClient->get($this->getResourceUrl($invoiceNumber)); 24 | $pdf = $this->getParameterFromResponse($response, self::RESOURCE_NAME); 25 | return new InvoicePdf([self::RESOURCE_NAME => $pdf]); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/Repository/InvoiceRepository.php: -------------------------------------------------------------------------------- 1 | httpClient->get($this->getResourceUrl()); 18 | $invoicesArray = $this->getParameterFromResponse($response, 'invoices'); 19 | 20 | foreach ($invoicesArray as $invoiceArray) { 21 | $invoices[] = new Invoice($invoiceArray); 22 | } 23 | 24 | return $invoices; 25 | } 26 | 27 | /** 28 | * @param int $page 29 | * @param int $itemsPerPage 30 | * @return Invoice[] 31 | */ 32 | public function getSelection(int $page, int $itemsPerPage): array 33 | { 34 | $invoices = []; 35 | $query = ['pageSize' => $itemsPerPage, 'page' => $page]; 36 | $response = $this->httpClient->get($this->getResourceUrl(), $query); 37 | $invoicesArray = $this->getParameterFromResponse($response, 'invoices'); 38 | 39 | foreach ($invoicesArray as $invoiceArray) { 40 | $invoices[] = new Invoice($invoiceArray); 41 | } 42 | 43 | return $invoices; 44 | } 45 | 46 | public function getByInvoiceNumber(string $invoiceNumber): Invoice 47 | { 48 | $response = $this->httpClient->get($this->getResourceUrl($invoiceNumber)); 49 | $invoice = $this->getParameterFromResponse($response, 'invoice'); 50 | 51 | return new Invoice($invoice); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/Repository/Kubernetes/Cluster/BlockStorages/StatsRepository.php: -------------------------------------------------------------------------------- 1 | 0) { 42 | $parameters['dateTimeStart'] = $dateTimeStart; 43 | } 44 | if ($dateTimeEnd > 0) { 45 | $parameters['dateTimeEnd'] = $dateTimeEnd; 46 | } 47 | 48 | $response = $this->httpClient->get($this->getResourceUrl($clusterName, $blockStorageName), $parameters); 49 | $usageStatistics = $this->getParameterFromResponse($response, 'stats'); 50 | 51 | foreach ($usageStatistics as $usage) { 52 | $usages[] = new UsageDataDisk($usage); 53 | } 54 | 55 | return $usages; 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/Repository/Kubernetes/Cluster/KubeConfigRepository.php: -------------------------------------------------------------------------------- 1 | httpClient->get($this->getResourceUrl($clusterName)); 25 | $kubeConfigArray = $this->getParameterFromResponse($response, self::RESOURCE_PARAMETER_SINGULAR); 26 | 27 | return new KubeConfig($kubeConfigArray); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/Repository/Kubernetes/Cluster/NodePools/LabelsRepository.php: -------------------------------------------------------------------------------- 1 | httpClient->get($this->getResourceUrl($clusterName, $nodePoolUuid)); 33 | $labelsArray = $this->getParameterFromResponse($response, self::RESOURCE_PARAMETER_PLURAL); 34 | 35 | foreach ($labelsArray as $labelArray) { 36 | $labels[] = new Label($labelArray); 37 | } 38 | 39 | return $labels; 40 | } 41 | 42 | /** 43 | * @param string $clusterName 44 | * @param string $nodePoolUuid 45 | * @param Label[] $labels 46 | */ 47 | public function update(string $clusterName, string $nodePoolUuid, array $labels): void 48 | { 49 | $this->httpClient->put( 50 | $this->getResourceUrl($clusterName, $nodePoolUuid), 51 | [self::RESOURCE_PARAMETER_PLURAL => $labels] 52 | ); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/Repository/Kubernetes/Cluster/NodePools/TaintsRepository.php: -------------------------------------------------------------------------------- 1 | httpClient->get($this->getResourceUrl($clusterName, $nodePoolUuid)); 33 | $taintsArray = $this->getParameterFromResponse($response, self::RESOURCE_PARAMETER_PLURAL); 34 | 35 | foreach ($taintsArray as $taintArray) { 36 | $taints[] = new Taint($taintArray); 37 | } 38 | 39 | return $taints; 40 | } 41 | 42 | /** 43 | * @param string $clusterName 44 | * @param string $nodePoolUuid 45 | * @param Taint[] $taints 46 | * @return void 47 | */ 48 | public function update(string $clusterName, string $nodePoolUuid, array $taints): void 49 | { 50 | $this->httpClient->put( 51 | $this->getResourceUrl($clusterName, $nodePoolUuid), 52 | [self::RESOURCE_PARAMETER_PLURAL => $taints] 53 | ); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/Repository/Kubernetes/Cluster/ReleaseRepository.php: -------------------------------------------------------------------------------- 1 | getReleases($clusterName, []); 29 | } 30 | 31 | /** 32 | * @return KubernetesRelease[] 33 | */ 34 | public function getCompatibleUpgrades(string $clusterName): array 35 | { 36 | return $this->getReleases($clusterName, ['isCompatibleUpgrade' => true]); 37 | } 38 | 39 | public function getByVersion(string $clusterName, string $version): KubernetesRelease 40 | { 41 | $response = $this->httpClient->get($this->getResourceUrl($clusterName, $version)); 42 | 43 | return new KubernetesRelease($this->getParameterFromResponse($response, self::RESOURCE_PARAMETER_SINGULAR)); 44 | } 45 | 46 | /** 47 | * @param string $clusterName 48 | * @param array $query 49 | * @return KubernetesRelease[] 50 | */ 51 | private function getReleases(string $clusterName, array $query = []): array 52 | { 53 | $releases = []; 54 | 55 | $response = $this->httpClient->get($this->getResourceUrl($clusterName), $query); 56 | $releasesArrays = $this->getParameterFromResponse($response, self::RESOURCE_PARAMETER_PLURAL); 57 | 58 | foreach ($releasesArrays as $releasesArray) { 59 | $releases[] = new KubernetesRelease($releasesArray); 60 | } 61 | 62 | return $releases; 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /src/Repository/Kubernetes/ProductRepository.php: -------------------------------------------------------------------------------- 1 | getProducts(); 21 | } 22 | 23 | /** 24 | * @param string[] $types 25 | * @return KubernetesProduct[] 26 | */ 27 | public function getByTypes(array $types): array 28 | { 29 | return $this->getProducts($types); 30 | } 31 | 32 | /** 33 | * @param string[] $types 34 | * @return KubernetesProduct[] 35 | */ 36 | private function getProducts(array $types = []): array 37 | { 38 | $query['types'] = implode(',', $types); 39 | $response = $this->httpClient->get($this->getResourceUrl(), $query); 40 | 41 | $productsArray = $this->getParameterFromResponse($response, self::RESOURCE_PARAMETER_PLURAL); 42 | $products = []; 43 | 44 | foreach ($productsArray as $productArray) { 45 | $products[] = new KubernetesProduct($productArray); 46 | } 47 | 48 | return $products; 49 | } 50 | 51 | public function getByName(string $name): KubernetesProduct 52 | { 53 | $response = $this->httpClient->get($this->getResourceUrl($name)); 54 | 55 | return new KubernetesProduct($this->getParameterFromResponse($response, self::RESOURCE_PARAMETER_SINGULAR)); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/Repository/Kubernetes/ReleaseRepository.php: -------------------------------------------------------------------------------- 1 | httpClient->get($this->getResourceUrl(), []); 23 | $releasesArrays = $this->getParameterFromResponse($response, self::RESOURCE_PARAMETER_PLURAL); 24 | 25 | foreach ($releasesArrays as $releasesArray) { 26 | $releases[] = new KubernetesRelease($releasesArray); 27 | } 28 | 29 | return $releases; 30 | } 31 | 32 | public function getByVersion(string $version): KubernetesRelease 33 | { 34 | $response = $this->httpClient->get($this->getResourceUrl($version)); 35 | 36 | return new KubernetesRelease($this->getParameterFromResponse($response, self::RESOURCE_PARAMETER_SINGULAR)); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/Repository/MailServiceRepository.php: -------------------------------------------------------------------------------- 1 | httpClient->get($this->getResourceUrl()); 14 | $mailServiceInformation = $this->getParameterFromResponse($response, 'mailServiceInformation'); 15 | 16 | return new MailServiceInformation($mailServiceInformation); 17 | } 18 | 19 | public function regenerateMailServicePassword(): void 20 | { 21 | $this->httpClient->patch($this->getResourceUrl(), []); 22 | } 23 | 24 | /** 25 | * @param string[] $domainNames 26 | * @return void 27 | */ 28 | public function addMailServiceDnsEntriesToDomains(array $domainNames): void 29 | { 30 | $this->httpClient->post($this->getResourceUrl(), ['domainNames' => $domainNames]); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/Repository/OpenStack/Project/AssignableUsersRepository.php: -------------------------------------------------------------------------------- 1 | httpClient->get($this->getResourceUrl($projectId)); 31 | $usersArray = $this->getParameterFromResponse($response, self::RESOURCE_PARAMETER_PLURAL); 32 | 33 | foreach ($usersArray as $userArray) { 34 | $users[] = new OpenStackUser($userArray); 35 | } 36 | 37 | return $users; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Repository/OpenStack/Project/QuotaRepository.php: -------------------------------------------------------------------------------- 1 | httpClient->get($this->getResourceUrl($projectId)); 30 | return $this->getParameterFromResponse($response, self::RESOURCE_PARAMETER_PLURAL); 31 | } 32 | 33 | public function set(string $projectId, int $bytesQuota): void 34 | { 35 | $url = $this->getResourceUrl($projectId); 36 | $parameters = ['bytesQuota' => $bytesQuota]; 37 | 38 | $this->httpClient->post($url, $parameters); 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /src/Repository/OpenStack/Project/UserRepository.php: -------------------------------------------------------------------------------- 1 | httpClient->get($this->getResourceUrl($projectId)); 31 | $usersArray = $this->getParameterFromResponse($response, self::RESOURCE_PARAMETER_PLURAL); 32 | 33 | foreach ($usersArray as $userArray) { 34 | $users[] = new OpenStackUser($userArray); 35 | } 36 | 37 | return $users; 38 | } 39 | 40 | public function grantUserAccessToProject(string $projectId, string $userId): void 41 | { 42 | $url = $this->getResourceUrl($projectId); 43 | $parameters = ['userId' => $userId]; 44 | 45 | $this->httpClient->post($url, $parameters); 46 | } 47 | 48 | public function revokeUserAccessFromProject(string $projectId, string $userId): void 49 | { 50 | $this->httpClient->delete( 51 | $this->getResourceUrl($projectId, $userId) 52 | ); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/Repository/OpenStack/TotpRepository.php: -------------------------------------------------------------------------------- 1 | httpClient->postWithResponse($this->getResourceUrl($userId)); 28 | $token = $this->getParameterFromResponse($response, self::RESOURCE_PARAMETER_SINGULAR); 29 | return new OpenStackTotp($token); 30 | } 31 | 32 | 33 | public function delete(string $userId): void 34 | { 35 | $this->httpClient->delete( 36 | $this->getResourceUrl($userId) 37 | ); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Repository/OperatingSystemFilterRepository.php: -------------------------------------------------------------------------------- 1 | $productName, 22 | "addons" => implode(",", $addons) 23 | ]; 24 | 25 | $operatingSystems = []; 26 | $response = $this->httpClient->get($this->getResourceUrl(), $query); 27 | $operatingSystemsArray = $this->getParameterFromResponse($response, 'operatingSystems'); 28 | 29 | foreach ($operatingSystemsArray as $operatingSystemArray) { 30 | $operatingSystems[] = new OperatingSystem($operatingSystemArray); 31 | } 32 | 33 | return $operatingSystems; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/Repository/Product/ElementRepository.php: -------------------------------------------------------------------------------- 1 | httpClient->get($this->getResourceUrl($productName)); 29 | $productElementsArray = $this->getParameterFromResponse($response, 'productElements'); 30 | 31 | foreach ($productElementsArray as $productElementArray) { 32 | $productElements[] = new ProductElement($productElementArray); 33 | } 34 | 35 | return $productElements; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/Repository/ProductRepository.php: -------------------------------------------------------------------------------- 1 | httpClient->get($this->getResourceUrl()); 18 | $categoryArray = $this->getParameterFromResponse($response, 'products'); 19 | 20 | foreach ($categoryArray as $category => $productsArray) { 21 | foreach ($productsArray as $productArray) { 22 | $productArray['category'] = $category; 23 | $products[] = new Product($productArray); 24 | } 25 | } 26 | 27 | return $products; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/Repository/SslCertificate/DetailsRepository.php: -------------------------------------------------------------------------------- 1 | httpClient->get($this->getResourceUrl($sslCertificateId)); 24 | $detailsArray = $this->getParameterFromResponse($response, 'certificateDetails'); 25 | 26 | return new Details($detailsArray); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/Repository/SslCertificate/DownloadRepository.php: -------------------------------------------------------------------------------- 1 | httpClient->postWithResponse($this->getResourceUrl($sslCertificateId)); 26 | $certificateDataArray = $this->getParameterFromResponse($response, 'certificateData'); 27 | 28 | return new CertificateData($certificateDataArray); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Repository/SslCertificate/InstallRepository.php: -------------------------------------------------------------------------------- 1 | $domainName, 22 | ]; 23 | if ($passphrase !== null) { 24 | $params['passphrase'] = $passphrase; 25 | } 26 | 27 | $this->httpClient->patch($this->getResourceUrl($sslCertificateId), $params); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/Repository/SslCertificate/UninstallRepository.php: -------------------------------------------------------------------------------- 1 | $domainName, 22 | ]; 23 | 24 | $this->httpClient->delete($this->getResourceUrl($sslCertificateId), $params); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/Repository/TrafficPoolRepository.php: -------------------------------------------------------------------------------- 1 | getByVpsName(''); 17 | } 18 | 19 | /** 20 | * @param string $vpsName 21 | * @return TrafficPoolInformation[] 22 | */ 23 | public function getByVpsName(string $vpsName): array 24 | { 25 | $response = $this->httpClient->get($this->getResourceUrl($vpsName)); 26 | $TrafficDatasArray = $this->getParameterFromResponse($response, 'trafficPoolInformation'); 27 | $trafficPoolInformation = []; 28 | foreach ($TrafficDatasArray as $TrafficDataArray) { 29 | $trafficPoolInformation[] = new TrafficPoolInformation($TrafficDataArray); 30 | } 31 | return $trafficPoolInformation; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/Repository/TrafficRepository.php: -------------------------------------------------------------------------------- 1 | getByVpsName(''); 17 | } 18 | 19 | public function getByVpsName(string $vpsName): TrafficInformation 20 | { 21 | $response = $this->httpClient->get($this->getResourceUrl($vpsName)); 22 | $trafficInformation = $this->getParameterFromResponse($response, 'trafficInformation'); 23 | 24 | return new TrafficInformation($trafficInformation); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/Repository/Vps/AddonRepository.php: -------------------------------------------------------------------------------- 1 | httpClient->get($this->getResourceUrl($vpsName)); 29 | $categoryArray = $this->getParameterFromResponse($response, 'addons'); 30 | 31 | foreach ($categoryArray as $category => $addonsArray) { 32 | foreach ($addonsArray as $addonArray) { 33 | $addonArray['category'] = $category; 34 | $addons[] = new Product($addonArray); 35 | } 36 | } 37 | 38 | return $addons; 39 | } 40 | 41 | /** 42 | * @param string $vpsName 43 | * @param string[] $addonNames 44 | * @return void 45 | */ 46 | public function order(string $vpsName, array $addonNames): void 47 | { 48 | $parameters['addons'] = $addonNames; 49 | $this->httpClient->post($this->getResourceUrl($vpsName), $parameters); 50 | } 51 | 52 | public function cancel(string $vpsName, string $addonName): void 53 | { 54 | $this->httpClient->delete($this->getResourceUrl($vpsName, $addonName), []); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /src/Repository/Vps/BackupRepository.php: -------------------------------------------------------------------------------- 1 | httpClient->get($this->getResourceUrl($vpsName)); 30 | $backupsArray = $this->getParameterFromResponse($response, 'backups'); 31 | 32 | foreach ($backupsArray as $backupArray) { 33 | $backups[] = new Backup($backupArray); 34 | } 35 | 36 | return $backups; 37 | } 38 | 39 | public function revertBackup(string $vpsName, int $backupId): ResponseInterface 40 | { 41 | return $this->httpClient->patch($this->getResourceUrl($vpsName, $backupId), ['action' => 'revert']); 42 | } 43 | 44 | public function convertBackupToSnapshot(string $vpsName, int $backupId, string $snapshotDescription = ''): ResponseInterface 45 | { 46 | $parameters['description'] = $snapshotDescription; 47 | $parameters['action'] = 'convert'; 48 | return $this->httpClient->patch($this->getResourceUrl($vpsName, $backupId), $parameters); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/Repository/Vps/FirewallRepository.php: -------------------------------------------------------------------------------- 1 | httpClient->get($this->getResourceUrl($vpsName)); 24 | $firewallArray = $this->getParameterFromResponse($response, 'vpsFirewall'); 25 | 26 | return new Firewall($firewallArray); 27 | } 28 | 29 | public function update(string $vpsName, Firewall $firewall): void 30 | { 31 | $this->httpClient->put($this->getResourceUrl($vpsName), ['vpsFirewall' => $firewall]); 32 | } 33 | 34 | public function reset(string $vpsName): void 35 | { 36 | $this->httpClient->patch($this->getResourceUrl($vpsName), ['action' => 'reset']); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/Repository/Vps/IpAddressRepository.php: -------------------------------------------------------------------------------- 1 | httpClient->get($this->getResourceUrl($vpsName)); 29 | $ipAddressesArray = $this->getParameterFromResponse($response, 'ipAddresses'); 30 | 31 | foreach ($ipAddressesArray as $ipAddressArray) { 32 | $ipAddresses[] = new IpAddress($ipAddressArray); 33 | } 34 | 35 | return $ipAddresses; 36 | } 37 | 38 | public function getByVpsNameAddress(string $vpsName, string $ipAddress): IpAddress 39 | { 40 | $response = $this->httpClient->get($this->getResourceUrl($vpsName, $ipAddress)); 41 | $ipAddress = $this->getParameterFromResponse($response, 'ipAddress'); 42 | 43 | return new IpAddress($ipAddress); 44 | } 45 | 46 | public function update(string $vpsName, IpAddress $ipAddress): void 47 | { 48 | $url = $this->getResourceUrl($vpsName, $ipAddress->getAddress()); 49 | $this->httpClient->put($url, ['ipAddress' => $ipAddress]); 50 | } 51 | 52 | public function addIpv6Address(string $vpsName, string $ipv6Address): void 53 | { 54 | $url = $this->getResourceUrl($vpsName); 55 | $this->httpClient->post($url, ['ipAddress' => $ipv6Address]); 56 | } 57 | 58 | public function removeIpv6Address(string $vpsName, string $ipv6Address): void 59 | { 60 | $url = $this->getResourceUrl($vpsName, $ipv6Address); 61 | $this->httpClient->delete($url); 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /src/Repository/Vps/LicenseRepository.php: -------------------------------------------------------------------------------- 1 | httpClient->get($this->getResourceUrl($vpsName)); 26 | 27 | /** @var array> $licencesArray */ 28 | $licencesArray = $this->getParameterFromResponse($response, 'licenses'); 29 | 30 | $struct = []; 31 | foreach ($licencesArray as $licenseType => $licenses) { 32 | foreach ($licenses as $license) { 33 | if ($licenseType === 'available') { 34 | $struct[$licenseType][] = new LicenseProduct($license); 35 | continue; 36 | } 37 | 38 | $struct[$licenseType][] = new License($license); 39 | } 40 | } 41 | 42 | return new Licenses($struct); 43 | } 44 | 45 | public function order(string $vpsName, string $licenseName, int $quantity): void 46 | { 47 | $parameters = [ 48 | 'licenseName' => $licenseName, 49 | 'quantity' => $quantity, 50 | ]; 51 | 52 | $this->httpClient->post($this->getResourceUrl($vpsName), $parameters); 53 | } 54 | 55 | public function update(string $vpsName, int $licenseId, string $newLicenseName): void 56 | { 57 | $this->httpClient->put($this->getResourceUrl($vpsName, $licenseId), ['newLicenseName' => $newLicenseName]); 58 | } 59 | 60 | public function cancel(string $vpsName, int $licenseId): void 61 | { 62 | $this->httpClient->delete($this->getResourceUrl($vpsName, $licenseId)); 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /src/Repository/Vps/MonitoringContactRepository.php: -------------------------------------------------------------------------------- 1 | httpClient->get($this->getResourceUrl()); 18 | $contactsArray = $this->getParameterFromResponse($response, 'contacts'); 19 | 20 | $contacts = []; 21 | foreach ($contactsArray as $contact) { 22 | $contacts[] = new Contact($contact); 23 | } 24 | 25 | return $contacts; 26 | } 27 | 28 | public function create(string $name, string $telephone, string $email): void 29 | { 30 | $params = [ 31 | 'name' => $name, 32 | 'telephone' => $telephone, 33 | 'email' => $email, 34 | ]; 35 | 36 | $this->httpClient->post($this->getResourceUrl(), $params); 37 | } 38 | 39 | public function update(Contact $contact): void 40 | { 41 | $this->httpClient->put($this->getResourceUrl($contact->getId()), ['contact' => $contact]); 42 | } 43 | 44 | public function delete(int $contactId): void 45 | { 46 | $this->httpClient->delete($this->getResourceUrl($contactId), []); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/Repository/Vps/RescueImageRepository.php: -------------------------------------------------------------------------------- 1 | httpClient->get($this->getResourceUrl($vpsName)); 29 | $rescueImagesArray = $this->getParameterFromResponse($response, 'rescueImages'); 30 | 31 | foreach ($rescueImagesArray as $rescueImage) { 32 | $rescueImages[] = new RescueImage($rescueImage); 33 | } 34 | 35 | return $rescueImages; 36 | } 37 | 38 | /** 39 | * @param string $vpsName 40 | * @param string $rescueImageName 41 | * @param string[] $sshKeys 42 | * @return void 43 | */ 44 | public function bootRescueImage(string $vpsName, string $rescueImageName, ?array $sshKeys = []): void 45 | { 46 | $url = $this->getResourceUrl($vpsName); 47 | $this->httpClient->patch($url, ['name' => $rescueImageName, 'sshKeys' => $sshKeys]); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/Repository/Vps/SettingRepository.php: -------------------------------------------------------------------------------- 1 | httpClient->get($this->getResourceUrl($vpsName)); 29 | $settingArray = $this->getParameterFromResponse($response, 'settings'); 30 | 31 | foreach ($settingArray as $setting) { 32 | $settings[] = new Setting($setting); 33 | } 34 | 35 | return $settings; 36 | } 37 | 38 | /** 39 | * @param string $vpsName 40 | * @param string $settingName 41 | * @return Setting 42 | */ 43 | public function getByVpsNameSettingName(string $vpsName, string $settingName): Setting 44 | { 45 | $response = $this->httpClient->get($this->getResourceUrl($vpsName, $settingName)); 46 | $setting = $this->getParameterFromResponse($response, 'setting'); 47 | 48 | return new Setting($setting); 49 | } 50 | 51 | public function update(string $vpsName, Setting $setting): void 52 | { 53 | $url = $this->getResourceUrl($vpsName, $setting->getName()); 54 | $this->httpClient->put($url, ['setting' => $setting]); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /src/Repository/Vps/TCPMonitorRepository.php: -------------------------------------------------------------------------------- 1 | httpClient->get($this->getResourceUrl($vpsName)); 28 | $tcpMonitorsArray = $this->getParameterFromResponse($response, 'tcpMonitors'); 29 | 30 | $tcpMonitors = []; 31 | foreach ($tcpMonitorsArray as $tcpMonitor) { 32 | $tcpMonitors[] = new TCPMonitor($tcpMonitor); 33 | } 34 | 35 | return $tcpMonitors; 36 | } 37 | 38 | public function create(string $vpsName, TCPMonitor $monitor): void 39 | { 40 | $this->httpClient->post($this->getResourceUrl($vpsName), ['tcpMonitor' => $monitor]); 41 | } 42 | 43 | public function update(string $vpsName, TCPMonitor $monitor): void 44 | { 45 | $this->httpClient->put($this->getResourceUrl($vpsName, $monitor->getIpAddress()), ['tcpMonitor' => $monitor]); 46 | } 47 | 48 | public function delete(string $vpsName, string $ipAddress): void 49 | { 50 | $this->httpClient->delete($this->getResourceUrl($vpsName, $ipAddress), []); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/Repository/Vps/UpgradeRepository.php: -------------------------------------------------------------------------------- 1 | httpClient->get($this->getResourceUrl($vpsName)); 29 | $upgradesArray = $this->getParameterFromResponse($response, 'upgrades'); 30 | 31 | foreach ($upgradesArray as $upgradeArray) { 32 | $upgradeArray['category'] = 'vps'; 33 | $products[] = new Product($upgradeArray); 34 | } 35 | 36 | return $products; 37 | } 38 | 39 | public function upgrade(string $vpsName, string $productName): void 40 | { 41 | $parameters['productName'] = $productName; 42 | $this->httpClient->post($this->getResourceUrl($vpsName), $parameters); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/Repository/Vps/VncDataRepository.php: -------------------------------------------------------------------------------- 1 | httpClient->get($this->getResourceUrl($vpsName)); 24 | $vncDataArray = $this->getParameterFromResponse($response, 'vncData'); 25 | 26 | return new VncData($vncDataArray); 27 | } 28 | 29 | public function regenerateVncCredentials(string $vpsName): void 30 | { 31 | $this->httpClient->patch($this->getResourceUrl($vpsName), []); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /tests/Entity/SslCertificateRepositoryTest.php: -------------------------------------------------------------------------------- 1 | setFirstName('John'); 16 | $data->setLastName('Doe'); 17 | $data->setEmail('john.doe@example.com'); 18 | 19 | $arr = $data->toArray(); 20 | 21 | $this->assertIsArray($arr); 22 | $this->assertCount(3, $arr); 23 | $this->assertArrayHasKey('approverFirstName', $arr); 24 | $this->assertArrayHasKey('approverLastName', $arr); 25 | $this->assertArrayHasKey('approverEmail', $arr); 26 | } 27 | 28 | public function testIsValid() 29 | { 30 | $data = new CertificateRequestData(); 31 | $data->setEmail('john.doe@example.com'); 32 | 33 | $this->assertTrue($data->isValid()); 34 | } 35 | 36 | public function testNotIsValid() 37 | { 38 | $data = new CertificateRequestData(); 39 | 40 | $this->assertFalse($data->isValid()); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /tests/Exception/HttpBadResponseExceptionTest.php: -------------------------------------------------------------------------------- 1 | 'bar'])); 17 | $exception = new HttpBadResponseException('test', 0, $previous, $response); 18 | 19 | self::assertEquals($previous, $exception->getPrevious()); 20 | self::assertEquals($response, $exception->getResponse()); 21 | } 22 | 23 | public function testCanGetInnerExceptionAndRepsonse(): void 24 | { 25 | $previous = new \RuntimeException('Previous exception'); 26 | $response = new Response(200, [], json_encode(['foo' => 'bar'])); 27 | $exception = new HttpBadResponseException('test', 0, $previous, $response); 28 | 29 | self::assertEquals($previous, $exception->getInnerException()); 30 | self::assertEquals($response, $exception->getResponse()); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /tests/HttpClient/ClientBuilderTest.php: -------------------------------------------------------------------------------- 1 | getMockBuilder(ClientBuilder::class) 18 | ->setMethods(['addPlugin', 'removePlugin']) 19 | ->getMock(); 20 | $client->expects($this->once()) 21 | ->method('addPlugin') 22 | // TODO verify that headers exists 23 | ->with($this->isInstanceOf(Plugin\HeaderAppendPlugin::class)); 24 | 25 | $client->expects($this->once()) 26 | ->method('removePlugin') 27 | ->with(Plugin\HeaderAppendPlugin::class); 28 | 29 | $client->addHeaders($headers); 30 | } 31 | 32 | public function testClearHeadersWillRemoveAndAddPlugin(): void 33 | { 34 | $builder = $this->getMockBuilder(ClientBuilder::class) 35 | ->setMethods(['addPlugin', 'removePlugin']) 36 | ->getMock(); 37 | $builder->expects($this->once()) 38 | ->method('addPlugin') 39 | ->with($this->isInstanceOf(Plugin\HeaderAppendPlugin::class)); 40 | 41 | $builder->expects($this->once()) 42 | ->method('removePlugin') 43 | ->with(Plugin\HeaderAppendPlugin::class); 44 | 45 | $builder->clearHeaders(); 46 | } 47 | 48 | public function testThatAppendingHeadersShouldRemoveAndAddPlugin(): void 49 | { 50 | $expectedHeaders = [ 51 | 'Foo' => 'bar', 52 | ]; 53 | 54 | $client = $this->getMockBuilder(ClientBuilder::class) 55 | ->setMethods(['removePlugin', 'addPlugin']) 56 | ->getMock(); 57 | 58 | $client->expects($this->once()) 59 | ->method('removePlugin') 60 | ->with(Plugin\HeaderAppendPlugin::class); 61 | 62 | $client->expects($this->once()) 63 | ->method('addPlugin') 64 | ->with(new Plugin\HeaderAppendPlugin($expectedHeaders)); 65 | 66 | $client->addHeaderValue('Foo', 'bar'); 67 | } 68 | } 69 | --------------------------------------------------------------------------------