Client Class
Objects of this class represent a connection to the Rackspace Cloudfiles service.
Item Index
Methods
Methods
authenticate
-
params
Authenticates the client. This is an async call that returns the results in a callback.
This function returns the Client object itself, so that
you can chain this function to the
createClient
function.
Parameters:
-
paramsObject-
[username]String optionalThe username to be used for the connection. The client remembers the last username specified, either at its creation or at the last call to this function, so this parameter is optional if you'd like to use the previous value.
-
[apiKey]String optionalThe API key to be used for the connection. The client remembers the last API key specified, either at its creation or at the last call to this function, so this parameter is optional if you'd like to use the previous value.
-
[region]String optionalThe region to be used for this client. This parameter is optional; the client remembers the last value specified, either at its creation or at the last call to this function. If this value has never been specified, the account's default region will be used.
-
successFunctionCallback to call in case of success. The function receives a dictionary as parameter, which holds the following keys:
- token: the authentication token as a string
- tokenExpiration: the token expiration as a date
- defaultRegion: the account's default region as a string
- storageUrl: the storage URL as a string
- cdnUrl: the CDN URL as a string
- rawResponse: the complete response as a JSON formatted string
-
errorFunctionCallback to call in case of error.
-
Returns:
createContainer
-
params
Creates a container with the given name. This is an async call that returns the results in a callback.
Parameters:
-
paramsObject-
nameStringName of the container.
-
[metadata]Object optionalMetadata as key/value pairs, to be added to the container.
-
successFunctionCallback to call in case of success.
-
errorFunctionCallback to call in case of error.
-
Returns:
deleteContainer
-
params
Deletes a container. This is an async call that returns the results in a callback.
Parameters:
-
paramsObject-
[name]String optionalName of the container. Optional, but either this, or the
containerparameter must be specified. -
[container]Container optionalA Container object. Optional, but either this, or the
nameparameter must be specified. -
successFunctionCallback to call in case of success.
-
errorFunctionCallback to call in case of error.
-
Returns:
download
-
params
Downloads an object. This function is functionally equivalent to the download function. The difference is that you don't need to have an Object object to use this function as you can specify the object's name as a string.
Parameters:
-
paramsObject-
objectNameStringName of the object to download.
-
fileTi.FileThe file into which to download the content of the object.
-
[containerName]String optionalName of the container to download from. Optional, but either this, or the
containerparameter must be specified. -
[container]Container optionalThe container to download from. Optional, but either this, or the
containerNameparameter must be specified. -
[ifMatch]String optionalA value for the
If-Matchheader defined by RFC-2616. -
[ifNoneMatch]String optionalA value for the
If-None-Matchheader defined by RFC-2616. -
[ifModifiedSince]String optionalA value for the
If-Modified-Sinceheader defined by RFC-2616. -
[ifUnmodifiedSince]String optionalA value for the
If-Unmodified-Sinceheader defined by RFC-2616. -
[range]String optionalA value for the
Rangeheader defined by RFC-2616. Cloud Files does not support the full specification for this header, but basic support is provided. See the Rackspace documentation for more detail. -
successFunctionCallback to call in case of success.
-
errorFunctionCallback to call in case of error.
-
Returns:
getAccountMetadata
-
params
Retrieves the metadata associated with this account. This is an async call that will report the result via callbacks.
Parameters:
-
paramsObject-
successFunctionCallback to call in case of success.
-
errorFunctionCallback to call in case of error.
-
Returns:
getCdnContainers
-
params
Retrieves the CDN-enabled containers associated with this account. This is an async call that returns the results in a callback.
Parameters:
-
paramsObject-
successFunctionCallback to call in case of success. The function receives a dictionary as parameter. The dictionary stores an array of Containers under the
containerskey. -
errorFunctionCallback to call in case of error.
-
[limit]Number optionalThe maximum number of containers to return. By default there is no limit, all the containers will be returned.
-
[pageSize]Number optionalThe maximum number of containers to request from the server in one query. If
pageSizeis less thanlimitand the number of available containers, then the module will make multiple calls to the server. The default value is 10,000. -
[marker]String optionalThe query will return object names greater than the specified marker.
-
Returns:
getContainer
-
name
Returns a Container object based on name. Note that this function does not verify that the container in fact exists on the server. Use the getContainers function to retrieve the containers from the server.
Parameters:
-
nameStringName of the container
Returns:
getContainers
-
params
Retrieves the containers associated with this account. This is an async call that returns the results in a callback.
Parameters:
-
paramsObject-
successFunctionCallback to call in case of success. The function receives a dictionary as parameter. The dictionary stores an array of Containers under the
containerskey. -
errorFunctionCallback to call in case of error.
-
[limit]Number optionalThe maximum number of containers to return. By default there is no limit, all the containers will be returned.
-
[pageSize]Number optionalThe maximum number of containers to request from the server in one query. If
pageSizeis less thanlimitand the number of available containers, then the module will make multiple calls to the server. The default value is 10,000. -
[marker]String optionalThe query will return object names greater than the specified marker.
-
Returns:
updateAccountMetadata
-
params -
metadata
Updates the metadata associated with this account. This is an async call that returns the results in a callback.
Parameters:
-
paramsObject-
successFunctionCallback to call in case of success.
-
errorFunctionCallback to call in case of error.
-
-
metadataObjectA dictionary that holds the metadata as key/value pairs.
Returns:
Properties
apiKey
String
read-only
The API key used for authentication (if not specified at the next call of the authenticate function).
autoAuth
String
Defines whether auto-authentication is turned on.
Default is true.
See the
"Automatic (Re)Authentication" section of the Readme for more details.
containerCount
Number
read-only
The number of containers that belong to the account.
Call the getAccountMetadata function to refresh this property.
metadata
Dictionary
read-only
Metadata associated with the account.
Call the getAccountMetadata function to refresh this property.
objectCount
Number
read-only
The number of objects that belong to the account.
Call the getAccountMetadata function to refresh this property.
region
String
read-only
The region used for this connection. If no region was specified with either the authenticate or the createClient function call, this property will return the default region of the account once authentication completes.
totalBytesUsed
Number
read-only
Total bytes used by the account.
Call the getAccountMetadata function to refresh this property.
username
String
read-only
The username used for authentication (if not specified at the next call of the authenticate function).
