-
Notifications
You must be signed in to change notification settings - Fork 378
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
25 changed files
with
1,761 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
##Using the Openstack CDN provider | ||
|
||
Creating a client is straight-forward: | ||
|
||
``` js | ||
var openstack = pkgcloud.cdn.createClient({ | ||
provider: 'openstack', // required | ||
username: 'your-user-name', // required | ||
password: 'your-password', // required | ||
authUrl: 'your identity service url' // required | ||
}); | ||
``` | ||
|
||
[More options for creating clients](README.md) | ||
|
||
### API Methods | ||
|
||
## Base | ||
|
||
#### `client.getHomeDocument(function (err, homeDocument) { })` | ||
Retrieves the home document, which allows you to navigate the remainder of the | ||
API. Callback is `f(err, homeDocument)` where `homeDocument` is an `Object`. | ||
|
||
#### `client.getPing(function (err) { })` | ||
Pings the server for any errors. Callback is `f(err)`. | ||
|
||
## Services | ||
|
||
#### client.createService(options, callback) | ||
Creates a service with the options specified. | ||
|
||
Options are as follows: | ||
|
||
```js | ||
{ | ||
name: 'my-service-name', // name of service, required | ||
domains: [ ... ], // list of domains for service, required | ||
origins: [ ... ], // list of origins for service, required | ||
caching: [ ... ], // list of caching rules for service, optional | ||
restrictions: [ ... ], // list of restrictions on where service can be accessed from, optional | ||
flavorId: 'cdn' // ID of CDN flavor to use, required | ||
} | ||
``` | ||
Callback is `f(err, service)`, where `service` is the created service. | ||
|
||
#### client.getServices([options], callback) | ||
|
||
Lists all created services. Callback is `f(err, services)` where `services` | ||
is an `Array`. | ||
|
||
#### client.getService(service, callback) | ||
|
||
Retrieve the created service for the provided service or serviceName. Callback is `f(err, | ||
service)`. | ||
|
||
#### client.updateService(service, callback) | ||
|
||
Update the provided service. | ||
|
||
The following values from the provided service are updatable. | ||
|
||
```js | ||
{ | ||
name: 'my-service-name', // name of service, required | ||
domains: [ ... ], // list of domains for service, required | ||
origins: [ ... ], // list of origins for service, required | ||
flavorId: 'cdn' // ID of CDN flavor to use, required | ||
} | ||
``` | ||
|
||
#### client.deleteService(service, callback) | ||
|
||
Delete the created service. Callback is `f(err)`. | ||
|
||
## Service Assets | ||
|
||
#### client.deleteServiceCachedAssets(service, assetUrl, callback) | ||
|
||
Purge the service's cached asset (if `assetUrl` is specified) or all cached | ||
assets (if `assetUrl` is not specified). Callback is `f(err)`. | ||
|
||
## Flavors | ||
|
||
#### client.getFlavors(options, callback) | ||
|
||
Lists all available CDN flavors. Callback is `f(err, flavors)` where | ||
`flavors` is an Array. | ||
|
||
#### client.getFlavor(flavor, callback) | ||
|
||
Retrieve the CDN flavor for a provided flavor or flavorId. Callback is `f(err, | ||
flavor)`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
##Using the Rackspace CDN provider | ||
|
||
Creating a client is straight-forward: | ||
|
||
``` js | ||
var rackspace = pkgcloud.cdn.createClient({ | ||
provider: 'rackspace', // required | ||
username: 'your-user-name', // required | ||
password: 'your-password', // required | ||
authUrl: 'your identity service url' // required | ||
}); | ||
``` | ||
|
||
[More options for creating clients](README.md) | ||
|
||
### API Methods | ||
|
||
## Base | ||
|
||
#### `client.getHomeDocument(function (err, homeDocument) { })` | ||
Retrieves the home document, which allows you to navigate the remainder of the | ||
API. Callback is `f(err, homeDocument)` where `homeDocument` is an `Object`. | ||
|
||
#### `client.getPing(function (err) { })` | ||
Pings the server for any errors. Callback is `f(err)`. | ||
|
||
## Services | ||
|
||
#### client.createService(options, callback) | ||
Creates a service with the options specified. | ||
|
||
Options are as follows: | ||
|
||
```js | ||
{ | ||
name: 'my-service-name', // name of service, required | ||
domains: [ ... ], // list of domains for service, required | ||
origins: [ ... ], // list of origins for service, required | ||
caching: [ ... ], // list of caching rules for service, optional | ||
restrictions: [ ... ], // list of restrictions on where service can be accessed from, optional | ||
flavorId: 'cdn' // ID of CDN flavor to use, required | ||
} | ||
``` | ||
Callback is `f(err, service)`, where `service` is the created service. | ||
|
||
#### client.getServices([options], callback) | ||
|
||
Lists all created services. Callback is `f(err, services)` where `services` | ||
is an `Array`. | ||
|
||
#### client.getService(service, callback) | ||
|
||
Retrieve the created service for the provided service or serviceName. Callback is `f(err, | ||
service)`. | ||
|
||
#### client.updateService(service, callback) | ||
|
||
Update the provided service. | ||
|
||
The following values from the provided service are updatable. | ||
|
||
```js | ||
{ | ||
name: 'my-service-name', // name of service, required | ||
domains: [ ... ], // list of domains for service, required | ||
origins: [ ... ], // list of origins for service, required | ||
flavorId: 'cdn' // ID of CDN flavor to use, required | ||
} | ||
``` | ||
|
||
#### client.deleteService(service, callback) | ||
|
||
Delete the created service. Callback is `f(err)`. | ||
|
||
## Service Assets | ||
|
||
#### client.deleteServiceCachedAssets(service, assetUrl, callback) | ||
|
||
Purge the service's cached asset (if `assetUrl` is specified) or all cached | ||
assets (if `assetUrl` is not specified). Callback is `f(err)`. | ||
|
||
## Flavors | ||
|
||
#### client.getFlavors(options, callback) | ||
|
||
Lists all available CDN flavors. Callback is `f(err, flavors)` where | ||
`flavors` is an Array. | ||
|
||
#### client.getFlavor(flavor, callback) | ||
|
||
Retrieve the CDN flavor for a provided flavor or flavorId. Callback is `f(err, | ||
flavor)`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/* | ||
* flavors.js: Instance methods for working with base resources from Openstack CDN | ||
* | ||
* (C) 2014 Rackspace | ||
* Shaunak Kashyap | ||
* MIT LICENSE | ||
*/ | ||
|
||
/** | ||
* client.getHomeDocument | ||
* | ||
* @description gets the home document for the CDN service | ||
* | ||
* @param callback | ||
* @return {*} | ||
*/ | ||
exports.getHomeDocument = function(callback) { | ||
var requestOptions = { | ||
path: '/' | ||
}; | ||
|
||
return this._request(requestOptions, function (err, body) { | ||
if (err) { | ||
callback(err); | ||
return; | ||
} | ||
|
||
callback(null, body); | ||
}); | ||
}; | ||
|
||
/** | ||
* client.getPing | ||
* | ||
* @description gets the server ping response (status response) | ||
* | ||
* @param callback | ||
* @return {*} | ||
*/ | ||
exports.getPing = function(callback) { | ||
var requestOptions = { | ||
path: '/ping' | ||
}; | ||
|
||
return this._request(requestOptions, function (err) { | ||
if (err) { | ||
callback(err); | ||
return; | ||
} | ||
|
||
callback(); | ||
}); | ||
}; |
Oops, something went wrong.