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

Load Balancer certificateMappingList error #730

Open
ghost opened this issue Jun 20, 2018 · 2 comments
Open

Load Balancer certificateMappingList error #730

ghost opened this issue Jun 20, 2018 · 2 comments

Comments

@ghost
Copy link

ghost commented Jun 20, 2018

I can create a certficate mapping but when I come to view the list of certificate mappings I get a PaginatedIterator object which contains the correct number of CertificateMapping but each one doesn't contain any data.

I first authenticate and then do the following:

$loadbalancer = $client->loadBalancerService( null, 'LON' );
$lb = $loadbalancer->loadBalancer(xxxxxx);
$list = $lb->certificateMappingList();
$cert = $list->current();
var_dump( $cert );

Which the var_dump returns:

object(OpenCloud\LoadBalancer\Resource\CertificateMapping)[52]
public 'id' => null
public 'hostName' => null
public 'certificate' => null
public 'privateKey' => null
public 'intermediateCertificate' => null
protected 'createKeys' =>
array (size=4)
0 => string 'hostName' (length=8)
1 => string 'certificate' (length=11)
2 => string 'privateKey' (length=10)
3 => string 'intermediateCertificate' (length=23)........

@DrizzlyOwl
Copy link

Leaving this here for future reference:
The initial call to the LoadBalancerService returns incorrectly 'keyed' items in the Iterator.

Workaround using:

// Set up the Service
$service = $client->loadBalancerService(null, 'LON');

// Fetch the LoadBalancer Resource with a specified $id
$lb = $service->loadBalancer($id);

// Fetch a list of Certificate Mappings
$cert_mapping_list = $lb->certificateMappingList();

// Define a new container
$map = [];

// Old school way of looping through the iterator
while ($cert_mapping_list->valid()) {

    // Access the method forcing it to populate
    $ele = $cert_mapping_list->currentElement();

    // Now has access to the property containing the key, authority and cert
    $map[] = $ele->certificateMapping;

    // Continue to next mapping
    $cert_mapping_list->next();
}

// Re-assign back to the Resource.
$lb->certificateMappingList = $map;

@nickjohnson
Copy link

That was helpful. I was wondering what happened after a recent update. This save me a bunch of time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants