This module contains a Node.js wrapper around the HTTP API of Ceph Object Gateway's Admin Ops API.
The module can be installed via
npm install ceph-admin-ops-client --save
As a minimum, the accessKey
, secretKey
, host
and port
properties need to be set when using this module. Each method returns a promise.
Setup
var AdminOpsAPI = require("ceph-admin-ops-client");
var api = new AdminOpsAPI({
accessKey: "<<ACCESS_KEY>>",
secretKey: "<<SECRET_KEY>>",
host: "192.168.0.100",
port: 10000
});
Sample method call:
api.getUserInfo({ uid: "myUser" }).then(function(userInfo){
console.log(JSON.stringify(userInfo));
}).catch(function(error) {
console.log(JSON.stringify(error));
});
accessKey
: The access key with which the API shall be used.secretKey
: The secret key with which the API shall be used.host
: Either the IP address or the hostname of the Ceph Object Gateway endpoint (default iss3.amazonaws.com
).port
: The port of the Ceph Object Gateway endpoint (default is80
).protocol
: Eitherhttp
orhttps
(default ishttp
).useSubdomain
: If a subdomain shall be used (boolean). Ddefault isfalse
.adminBucket
: The name of the "admin bucket" (the URI which is configured for the base admin endpoint). Default isadmin
.expiresInMinutes
: The time in minutes until the request expires (default is10
).
The parameters
argument for the methods (see below) is an object containing a property map, for example
{
"uid": "myUser",
"bucket": "myBucket"
}
Request bandwidth usage information.
Parameter | Data Type | Mandatory? |
---|---|---|
uid | string | No |
start | date | No |
end | date | No |
show-entries | boolean | No |
show-summary | boolean | No |
Remove usage information. With no dates specified, removes all usage information.
Parameter | Data Type | Mandatory? |
---|---|---|
uid | string | No |
start | date | No |
end | date | No |
remove-all | boolean | No |
show-summary | boolean | No |
Get user information. If no user is specified returns the list of all users along with suspension information.
Parameter | Data Type | Mandatory? |
---|---|---|
uid | string | Yes |
Create a new user. By Default, a S3 key pair will be created automatically and returned in the response. If only one of access-key or secret-key is provided, the omitted key will be automatically generated. By default, a generated key is added to the keyring without replacing an existing key pair. If access-key is specified and refers to an existing key owned by the user then it will be modified.
Parameter | Data Type | Mandatory? |
---|---|---|
uid | string | Yes |
display-name | string | Yes |
string | No | |
key-type | string | No |
access-key | string | No |
secret-key | string | No |
user-caps | string | No |
generate-key | boolean | No |
max-buckets | number | No |
suspended | boolean | No |
Modify a user.
Parameter | Data Type | Mandatory? |
---|---|---|
uid | string | Yes |
display-name | string | No |
string | No | |
key-type | string | No |
access-key | string | No |
secret-key | string | No |
user-caps | string | No |
generate-key | boolean | No |
max-buckets | number | No |
suspended | boolean | No |
Remove an existing user.
Parameter | Data Type | Mandatory? |
---|---|---|
uid | string | Yes |
purge-data | boolean | No |
Create a new subuser (primarily useful for clients using the Swift API). Note that either gen-subuser or subuser is required for a valid request. Note that in general for a subuser to be useful, it must be granted permissions by specifying access. As with user creation if subuser is specified without secret, then a secret key will be automatically generated.
Parameter | Data Type | Mandatory? |
---|---|---|
uid | string | Yes |
subuser | string | No |
key-type | string | No |
secret-key | string | No |
access | string | No |
generate-secret | boolean | No |
Modify an existing subuser
Parameter | Data Type | Mandatory? |
---|---|---|
uid | string | Yes |
subuser | string | Yes |
key-type | string | No |
secret-key | string | No |
access | string | No |
generate-secret | boolean | No |
Remove an existing subuser
Parameter | Data Type | Mandatory? |
---|---|---|
uid | string | Yes |
subuser | string | Yes |
purge-keys | boolean | No |
Create a new key. If a subuser is specified then by default created keys will be swift type. If only one of access-key or secret-key is provided the committed key will be automatically generated, that is if only secret-key is specified then access-key will be automatically generated. By default, a generated key is added to the keyring without replacing an existing key pair. If access-key is specified and refers to an existing key owned by the user then it will be modified. The response is a container listing all keys of the same type as the key created. Note that when creating a swift key, specifying the option access-key will have no effect. Additionally, only one swift key may be held by each user or subuser.
Parameter | Data Type | Mandatory? |
---|---|---|
uid | string | Yes |
subuser | string | No |
key-type | string | No |
access-key | string | No |
secret-key | string | No |
generate-key | boolean | No |
Remove an existing key.
Parameter | Data Type | Mandatory? |
---|---|---|
access-key | string | Yes |
uid | string | No |
subuser | string | No |
key-type | string | No |
Get information about a subset of the existing buckets. If uid is specified without bucket then all buckets beloning to the user will be returned. If bucket alone is specified, information for that particular bucket will be retrieved.
Parameter | Data Type | Mandatory? |
---|---|---|
uid | string | No |
bucket | string | No |
stats | boolean | No |
Delete an existing bucket.
Parameter | Data Type | Mandatory? |
---|---|---|
bucket | string | Yes |
purge-objects | boolean | No |
Check the index of an existing bucket. NOTE: to check multipart object accounting with check-objects, fix must be set to True.
Parameter | Data Type | Mandatory? |
---|---|---|
bucket | string | Yes |
check-objects | boolean | No |
fix | boolean | No |
Unlink a bucket from a specified user. Primarily useful for changing bucket ownership.
Parameter | Data Type | Mandatory? |
---|---|---|
uid | string | Yes |
bucket | string | Yes |
Link a bucket to a specified user, unlinking the bucket from any previous user.
Parameter | Data Type | Mandatory? |
---|---|---|
uid | string | Yes |
bucket | string | Yes |
Remove an existing object. NOTE: Does not require owner to be non-suspended.
Parameter | Data Type | Mandatory? |
---|---|---|
bucket | string | Yes |
object | string | Yes |
Read the policy of a bucket.
Parameter | Data Type | Mandatory? |
---|---|---|
bucket | string | Yes |
object | string | No |
Read the policy of an object.
Parameter | Data Type | Mandatory? |
---|---|---|
bucket | string | Yes |
object | string | Yes |
Add an administrative capability to a specified user.
Parameter | Data Type | Mandatory? |
---|---|---|
uid | string | Yes |
user-caps | string | Yes |
Remove an administrative capability from a specified user.
Parameter | Data Type | Mandatory? |
---|---|---|
uid | string | Yes |
user-caps | string | Yes |
Read the quota of an user.
Parameter | Data Type | Mandatory? |
---|---|---|
uid | string | Yes |
Update the quota of an user.
Parameter | Data Type | Mandatory? |
---|---|---|
uid | string | Yes |
quotaObject | string | Yes |
Read the quota of a bucket.
Parameter | Data Type | Mandatory? |
---|---|---|
uid | string | Yes |
Update the quota of a bucket.
Parameter | Data Type | Mandatory? |
---|---|---|
uid | string | Yes |
quotaObject | string | Yes |