Skip to content
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
14 changes: 5 additions & 9 deletions lib/OpenCloud/LoadBalancer/Resource/CertificateMappings.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
* to a corresponding hostname, allowing multiple SSL certificates to
* exist and be accurately utilized from a Load Balancer.
*/
class CertificateMappings extends PersistentResource
class CertificateMapping extends PersistentResource
{
/**
* Id for the Certificate Map.
Expand Down Expand Up @@ -75,23 +75,19 @@ class CertificateMappings extends PersistentResource

protected function updateJson($params = array())
{
$update_fields = array(
$updateFields = array(
'hostName',
'certificate',
'privateKey',
'intermediateCertificate',
);

$fields = array_keys($params);
foreach ($fields as $field) {
if (!in_array($field, $update_fields)) {
throw new InvalidArgumentError("You cannot update ${field}.");
}
}

$object = new \stdClass();
$object->certificateMapping = new \stdClass();
foreach ($params as $name => $value) {
if (!in_array($name, $updateFields)) {
throw new InvalidArgumentError("You cannot update ${name}.");
}
$object->certificateMapping->$name = $this->$name;
}

Expand Down
10 changes: 5 additions & 5 deletions lib/OpenCloud/LoadBalancer/Resource/LoadBalancer.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ class LoadBalancer extends PersistentResource implements HasPtrRecordsInterface
protected static $url_resource = 'loadbalancers';

protected $associatedResources = array(
'certificateMapping' => 'CertificateMappings',
'certificateMapping' => 'CertificateMapping',
'node' => 'Node',
'virtualIp' => 'VirtualIp',
'connectionLogging' => 'ConnectionLogging',
Expand All @@ -159,7 +159,7 @@ class LoadBalancer extends PersistentResource implements HasPtrRecordsInterface
);

protected $associatedCollections = array(
'certificateMappings' => 'CertificateMappings',
'certificateMappings' => 'CertificateMapping',
'nodes' => 'Node',
'virtualIps' => 'VirtualIp',
'accessList' => 'Access'
Expand Down Expand Up @@ -400,11 +400,11 @@ public function virtualIpList()
* @param int|array $id (Optional) Either a particular Certificate mapping ID, or an array of data about the
* mapping. An array can include these keys: hostName, privateKey, certificate,
* intermediateCertificate.
* @return \OpenCloud\LoadBalancer\Resource\CertificateMappings
* @return \OpenCloud\LoadBalancer\Resource\CertificateMapping
*/
public function certificateMapping($id = null)
{
return $this->getService()->resource('CertificateMappings', $id, $this);
return $this->getService()->resource('CertificateMapping', $id, $this);
}

/**
Expand All @@ -414,7 +414,7 @@ public function certificateMapping($id = null)
*/
public function certificateMappingList()
{
return $this->getService()->resourceList('CertificateMappings', null, $this);
return $this->getService()->resourceList('CertificateMapping', null, $this);
}

/**
Expand Down