Skip to content

Commit

Permalink
Cleaning up client name in examples
Browse files Browse the repository at this point in the history
- Fixes #372
  • Loading branch information
kenperkins committed Dec 9, 2014
1 parent 7c3b978 commit 158e85b
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 19 deletions.
18 changes: 9 additions & 9 deletions examples/dns/rackspace.js
@@ -1,7 +1,7 @@
var pkgcloud = require('../../lib/pkgcloud'),
_ = require('underscore');

var rackspace = pkgcloud.dns.createClient({
var client = pkgcloud.dns.createClient({
provider: 'rackspace',
username: 'rax-user-id',
apiKey: '1234567890asdbchehe'
Expand All @@ -12,7 +12,7 @@ var rackspace = pkgcloud.dns.createClient({
// and illustration purposes.

// 1 - Get all DNS "Zones" associates with your account
rackspace.getZones(function (err, zones) {
client.getZones(function (err, zones) {
if (err) {
console.dir(err);
return;
Expand All @@ -34,7 +34,7 @@ var details = {
comment: 'I pity .foo'
};

rackspace.createZone(details, function (err, zone) {
client.createZone(details, function (err, zone) {
if (err) {
console.dir(err);
return;
Expand All @@ -46,15 +46,15 @@ rackspace.createZone(details, function (err, zone) {

// 3 - Get the "Zone" we just created and get its records

rackspace.getZones({ name: 'example.org' }, function (err, zones) {
client.getZones({ name: 'example.org' }, function (err, zones) {
if (err) {
console.dir(err);
return;
}

if (zones.length) {
console.log('We have parent Zone');
rackspace.getRecords(zones[0], function (err, records) {
client.getRecords(zones[0], function (err, records) {
if (err) {
console.dir(err);
return;
Expand All @@ -74,15 +74,15 @@ var _rec = {
data: '127.0.0.1'
};

rackspace.getZones({ name: 'example.org' }, function (err, zones) {
client.getZones({ name: 'example.org' }, function (err, zones) {
if (err) {
console.dir(err);
return;
}

if (zones.length) {
console.log('We have parent Zone');
rackspace.createRecord(zones[0], _rec, function (err, rec) {
client.createRecord(zones[0], _rec, function (err, rec) {
if (err) {
console.dir(err);
return;
Expand All @@ -96,15 +96,15 @@ rackspace.getZones({ name: 'example.org' }, function (err, zones) {
});

// 5 - Now let's remove the "Zone" and all of its children records.
rackspace.getZones({ name: 'example.org' }, function (err, zones) {
client.getZones({ name: 'example.org' }, function (err, zones) {
if (err) {
console.dir(err);
return;
}

if (zones.length) {
console.log('We have parent Zone');
rackspace.deleteZone(zones[0], function (err) {
client.deleteZone(zones[0], function (err) {
if (err) {
console.dir(err);
return;
Expand Down
4 changes: 2 additions & 2 deletions examples/storage/azure.js
@@ -1,12 +1,12 @@
var pkgcloud = require('../../lib/pkgcloud');

var azure = pkgcloud.storage.createClient({
var client = pkgcloud.storage.createClient({
provider: 'azure',
storageAccount: 'test-storage-account', // Name of your storage account
storageAccessKey: 'test-storage-access-key' // Access key for storage account
});

azure.getContainers(function (err, containers) {
client.getContainers(function (err, containers) {
if (err) {
console.error(err);
}
Expand Down
16 changes: 8 additions & 8 deletions examples/storage/rackspace.js
Expand Up @@ -2,7 +2,7 @@ var fs = require('fs'),
pkgcloud = require('../../lib/pkgcloud'),
_ = require('underscore');

var rackspace = pkgcloud.storage.createClient({
var client = pkgcloud.storage.createClient({
provider: 'rackspace',
username: 'rackspace_id',
apiKey: '1234567890poiiuytrrewq',
Expand All @@ -14,7 +14,7 @@ var rackspace = pkgcloud.storage.createClient({
// and illustration purposes.

// 1 -- to create a container
rackspace.createContainer({
client.createContainer({
name: 'sample-container-test',
metadata: {
callme: 'maybe'
Expand All @@ -31,7 +31,7 @@ rackspace.createContainer({
});

// 2 -- to list our containers
rackspace.getContainers(function (err, containers) {
client.getContainers(function (err, containers) {
if (err) {
console.dir(err);
return;
Expand All @@ -44,7 +44,7 @@ rackspace.getContainers(function (err, containers) {
});

// 3 -- to create a container and upload a file to it
rackspace.createContainer({
client.createContainer({
name: 'sample-container',
metadata: {
callme: 'maybe'
Expand All @@ -57,7 +57,7 @@ rackspace.createContainer({

var myPicture = fs.createReadStream('/path/to/some/file/picture.jpg');

var upload = rackspace.upload({
var upload = client.upload({
container: container.name,
remote: 'profile-picture.jpg'
});
Expand All @@ -74,7 +74,7 @@ rackspace.createContainer({
});

// 4 -- setup container as CDN
rackspace.getContainer('container-name', function (err, container) {
client.getContainer('container-name', function (err, container) {
if(err){
console.log('There was an error retrieving container:\n');
console.dir(err);
Expand All @@ -93,14 +93,14 @@ rackspace.getContainer('container-name', function (err, container) {
});

// 5 -- to get a container, empty it, then finally destroying it
rackspace.getContainer('sample-container', function (err, container) {
client.getContainer('sample-container', function (err, container) {
if (err) {
console.dir(err);
return;
}

// destroying a container automatically calls the remove file API to empty before delete
rackspace.destroyContainer(container, function (err, result) {
client.destroyContainer(container, function (err, result) {
if (err) {
console.dir(err);
return;
Expand Down

0 comments on commit 158e85b

Please sign in to comment.