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:
-
params
Object-
[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.
-
success
FunctionCallback 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
-
error
FunctionCallback 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:
-
params
Object-
name
StringName of the container.
-
[metadata]
Object optionalMetadata as key/value pairs, to be added to the container.
-
success
FunctionCallback to call in case of success.
-
error
FunctionCallback 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:
-
params
Object-
[name]
String optionalName of the container. Optional, but either this, or the
container
parameter must be specified. -
[container]
Container optionalA Container object. Optional, but either this, or the
name
parameter must be specified. -
success
FunctionCallback to call in case of success.
-
error
FunctionCallback 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:
-
params
Object-
objectName
StringName of the object to download.
-
file
Ti.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
container
parameter must be specified. -
[container]
Container optionalThe container to download from. Optional, but either this, or the
containerName
parameter must be specified. -
[ifMatch]
String optionalA value for the
If-Match
header defined by RFC-2616. -
[ifNoneMatch]
String optionalA value for the
If-None-Match
header defined by RFC-2616. -
[ifModifiedSince]
String optionalA value for the
If-Modified-Since
header defined by RFC-2616. -
[ifUnmodifiedSince]
String optionalA value for the
If-Unmodified-Since
header defined by RFC-2616. -
[range]
String optionalA value for the
Range
header 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. -
success
FunctionCallback to call in case of success.
-
error
FunctionCallback to call in case of error.
-
Returns:
getAccountMetadata
-
params
Retrieves the metadata associated with this account. This is an async call that returns the results in a callback.
Parameters:
-
params
Object-
success
FunctionCallback to call in case of success.
-
error
FunctionCallback 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:
-
params
Object-
success
FunctionCallback to call in case of success. The function receives a dictionary as parameter. The dictionary stores an array of Containers under the
containers
key. -
error
FunctionCallback 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
pageSize
is less thanlimit
and 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:
-
name
StringName 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:
-
params
Object-
success
FunctionCallback to call in case of success. The function receives a dictionary as parameter. The dictionary stores an array of Containers under the
containers
key. -
error
FunctionCallback 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
pageSize
is less thanlimit
and 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:
-
params
Object-
success
FunctionCallback to call in case of success.
-
error
FunctionCallback to call in case of error.
-
-
metadata
ObjectA 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).