Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename cluster to region #3

Merged
merged 1 commit into from
Apr 15, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/Model/Subscription.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@
* @property-read int $user_licenses Number of users.
* @property-read string $project_id
* @property-read string $project_title
* @property-read string $project_cluster
* @property-read string $project_cluster_label
* @property-read string $project_region
* @property-read string $project_region_label
* @property-read string $project_ui
*/
class Subscription extends Resource
{

public static $availablePlans = ['development', 'standard', 'medium', 'large'];
public static $availableClusters = ['eu_west', 'us_east'];
public static $availableRegions = ['eu_west', 'us_east'];

const STATUS_ACTIVE = 'active';
const STATUS_REQUESTED = 'requested';
Expand Down Expand Up @@ -57,7 +57,7 @@ public function wait(callable $onPoll = null, $interval = 2)
*/
public static function getRequired()
{
return ['project_cluster'];
return ['project_region'];
}

/**
Expand All @@ -69,8 +69,8 @@ protected static function checkProperty($property, $value)
if ($property === 'plan' && !in_array($value, self::$availablePlans)) {
$errors[] = "Plan not found: " . $value;
}
elseif ($property === 'cluster' && !in_array($value, self::$availableClusters)) {
$errors[] = "Cluster not found: " . $value;
elseif ($property === 'project_region' && !in_array($value, self::$availableRegions)) {
$errors[] = "Region not found: " . $value;
}
elseif ($property === 'storage' && $value < 1024) {
$errors[] = "Storage must be at least 1024 MiB";
Expand Down
10 changes: 5 additions & 5 deletions src/PlatformClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public function getProjects($reset = false)
$data = $this->getAccountInfo($reset);
$projects = [];
foreach ($data['projects'] as $project) {
// Each project has its own endpoint on a Platform.sh cluster.
// Each project has its own endpoint on a Platform.sh region.
$client = $this->connector->getClient();
// @todo get the actual ID added to the API
$projectId = basename($project['endpoint']);
Expand Down Expand Up @@ -99,7 +99,7 @@ public function getAccountInfo($reset = false)
* Get a single project at a known location.
*
* @param string $id The project ID.
* @param string $hostname The hostname of the Platform.sh cluster API,
* @param string $hostname The hostname of the Platform.sh regional API,
* e.g. 'eu.platform.sh' or 'us.platform.sh'.
* @param bool $https Whether to use HTTPS (default: true).
*
Expand Down Expand Up @@ -177,7 +177,7 @@ protected function cleanRequest(array $request)
/**
* Create a new Platform.sh subscription.
*
* @param string $cluster The cluster. See Subscription::$availableClusters.
* @param string $region The region. See Subscription::$availableRegions.
* @param string $plan The plan. See Subscription::$availablePlans.
* @param string $title The project title.
* @param int $storage The storage of each environment, in MiB.
Expand All @@ -186,11 +186,11 @@ protected function cleanRequest(array $request)
*
* @return Subscription
*/
public function createSubscription($cluster, $plan = 'development', $title = null, $storage = null, $environments = null, array $activationCallback = null)
public function createSubscription($region, $plan = 'development', $title = null, $storage = null, $environments = null, array $activationCallback = null)
{
$url = $this->accountsEndpoint . 'subscriptions';
$values = $this->cleanRequest([
'project_cluster' => $cluster,
'project_region' => $region,
'plan' => $plan,
'project_title' => $title,
'storage' => $storage,
Expand Down