Skip to content

Commit 1b49791

Browse files
author
Jamie Hannaford
committed
Fixing conflict with region in catalog
2 parents 5c47936 + cf89f74 commit 1b49791

File tree

5 files changed

+59
-8
lines changed

5 files changed

+59
-8
lines changed

composer.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@
2222
},
2323
"require": {
2424
"php" : ">=5.3.3",
25-
"guzzle/http" : "3.8.*@dev"
25+
"guzzle/http" : "~3.8"
2626
},
2727
"require-dev" : {
28-
"guzzle/guzzle": "dev-master",
29-
"psr/log": "1.0.*",
28+
"guzzle/guzzle": "~3.8",
29+
"psr/log": "~1.0",
3030
"satooshi/php-coveralls": "0.6.*@dev"
3131
}
32-
}
32+
}

doc/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
_build/

docs/userguide/ObjectStore/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ Choose one of the following two options:
1616
use OpenCloud\OpenStack;
1717

1818
$client = new OpenStack('<OPENSTACK CLOUD IDENTITY ENDPOINT URL>', array(
19-
'username' => '<YOUR RACKSPACE CLOUD ACCOUNT USERNAME>',
20-
'apiKey' => '<YOUR RACKSPACE CLOUD ACCOUNT API KEY>'
19+
'username' => '<YOUR OPENSTACK USERNAME>',
20+
'password' => '<YOUR OPENSTACK PASSWORD>'
2121
));
2222
```
2323

@@ -60,4 +60,4 @@ $container->uploadObject($remoteFileName, $fileData);
6060
## Next steps
6161

6262
There is a lot more you can do with containers and objects. See
63-
the [complete user guide to the Object Store service](USERGUIDE.md).
63+
the [complete user guide to the Object Store service](USERGUIDE.md).

lib/OpenCloud/Common/Service/CatalogService.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@ public function __construct(ClientInterface $client, $type = null, $name = null,
7575
$this->name = $name ? : static::DEFAULT_NAME;
7676
$this->region = $region;
7777

78-
if ($this->regionless !== true && !$region) {
78+
$this->region = $region;
79+
if ($this->regionless !== true && !$this->region) {
7980
throw new Exceptions\ServiceException(sprintf(
8081
'The %s service must have a region set. You can either pass in a region string as an argument param, or'
8182
. ' set a default region for your user account by executing User::setDefaultRegion and ::update().',
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<?php
2+
3+
/*
4+
* Copyright 2014 Rackspace US, Inc.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
// Pre-requisites
20+
// Prior to running this script, you must setup the following environment variables:
21+
// * RAX_USERNAME: Your Rackspace Cloud Account Username, and
22+
// * RAX_API_KEY: Your Rackspace Cloud Account API Key
23+
24+
require dirname(__DIR__) . '/../../vendor/autoload.php';
25+
26+
use OpenCloud\Rackspace;
27+
28+
// 1. Instantiate a Rackspace client.
29+
$client = new Rackspace(Rackspace::US_IDENTITY_ENDPOINT, array(
30+
'username' => getenv('RAX_USERNAME'),
31+
'apiKey' => getenv('RAX_API_KEY')
32+
));
33+
34+
// 2. Create Compute service object
35+
$region = 'ORD';
36+
$service = $client->computeService(null, $region);
37+
38+
// 3. Get empty keypair
39+
$keypair = $service->keypair();
40+
41+
$payload = <<<EOT
42+
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQDx8nkQv/zgGgB4rMYmIf+6A4l6Rr+o/6lHBQdW5aYd44bd8JttDCE/F/pNRr0lRE+PiqSPO8nDPHw0010JeMH9gYgnnFlyY3/OcJ02RhIPyyxYpv9FhY+2YiUkpwFOcLImyrxEsYXpD/0d3ac30bNH6Sw9JD9UZHYcpSxsIbECHw== Example public key
43+
EOT;
44+
45+
// 4. Create
46+
$keypair->create(array(
47+
'name' => 'new_public_key',
48+
'publicKey' => $payload
49+
));

0 commit comments

Comments
 (0)