Skip to content

Commit a4a9424

Browse files
committed
Merge branch '1.x' into 3.x
2 parents 524aa3a + 4570352 commit a4a9424

File tree

6 files changed

+55
-2
lines changed

6 files changed

+55
-2
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ $client = new PlatformClient();
3939
// Set the API token to use.
4040
//
4141
// N.B. you must keep your API token(s) safe!
42-
$client->getConnector()->setApiToken('test', 'exchange');
42+
$client->getConnector()->setApiToken($myToken, 'exchange');
4343

4444
// Get a project.
4545
$project = $client->getProject('my_project_id');

src/Model/AutoscalingSettings.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?php
2+
3+
namespace Platformsh\Client\Model;
4+
5+
/**
6+
* Represents environment autoscaling settings.
7+
*
8+
*/
9+
class AutoscalingSettings extends ApiResourceBase {}

src/Model/Environment.php

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
namespace Platformsh\Client\Model;
66

77
use Cocur\Slugify\Slugify;
8+
use GuzzleHttp\Psr7\Request;
89
use Platformsh\Client\Exception\EnvironmentStateException;
910
use Platformsh\Client\Exception\OperationUnavailableException;
1011
use Platformsh\Client\Model\Activities\HasActivitiesInterface;
@@ -660,6 +661,30 @@ public function getSourceOperations(): array
660661
return SourceOperation::getCollection($this->getLink('#source-operations'), 0, [], $this->client);
661662
}
662663

664+
/**
665+
* Lists environment settings.
666+
*/
667+
public function getSettings(): Settings
668+
{
669+
$url = $this->getUri() . '/settings';
670+
$request = new Request('GET', $url);
671+
$data = self::send($request, $this->client);
672+
673+
return new Settings($data, $url, $this->client);
674+
}
675+
676+
/**
677+
* Lists environment autoscaling settings.
678+
*/
679+
public function getAutoscalingSettings(): AutoscalingSettings
680+
{
681+
$url = $this->getUri() . '/autoscaling/settings';
682+
$request = new Request('GET', $url);
683+
$data = self::send($request, $this->client);
684+
685+
return new AutoscalingSettings($data, $url, $this->client);
686+
}
687+
663688
/**
664689
* Runs a source operation.
665690
*

src/Model/Organization/Organization.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
/**
2121
* @property-read string $id The organization ID
22+
* @property-read string $type The organization type
2223
* @property-read string $owner_id The user ID of the organization owner
2324
* @property-read string $name The organization's machine name (used in URLs)
2425
* @property-read string $label The organization's "human-readable" name

src/Model/Settings.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?php
2+
3+
namespace Platformsh\Client\Model;
4+
5+
/**
6+
* Represents environment settings.
7+
*
8+
* @property-read bool $enable_manual_deployments
9+
*/
10+
class Settings extends ApiResourceBase {}

src/PlatformClient.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -587,10 +587,15 @@ public function getOrganizationById(string $id): Organization|false
587587
* that are concerned with subscriptions or billing. The old API path will
588588
* only continue to work for users who own just 1 organization (or 0).
589589
*
590+
* @param string $name The organization name (unique, "machine-readable", used in the URL path).
591+
* @param string $label The organization label ("human-readable").
590592
* @param string $country An ISO 2-letter country code.
591593
* @param string $owner The organization owner ID. Leave empty to use the current user.
594+
* @param string $type The organization type. Leave blank to use the default.
595+
*
596+
* @return Organization
592597
*/
593-
public function createOrganization(string $name, string $label = '', string $country = '', string $owner = ''): Organization
598+
public function createOrganization(string $name, string $label = '', string $country = '', string $owner = '', string $type = ''): Organization
594599
{
595600
if (! $this->connector->getApiUrl()) {
596601
throw new \RuntimeException('No API URL configured');
@@ -604,6 +609,9 @@ public function createOrganization(string $name, string $label = '', string $cou
604609
if ($owner !== '') {
605610
$values['owner_id'] = $owner;
606611
}
612+
if ($type !== '') {
613+
$values['type'] = $type;
614+
}
607615
return Organization::create($values, $url, $this->connector->getClient());
608616
}
609617

0 commit comments

Comments
 (0)