garage-admin-sdk-js/docs/BucketApi.md
2022-11-13 12:56:24 +01:00

18 KiB

garage.BucketApi

All URIs are relative to http://localhost:3903/v0

Method HTTP request Description
allowBucketKey POST /bucket/allow Allow key
createBucket POST /bucket Create a bucket
deleteBucket DELETE /bucket?id={bucket_id} Delete a bucket
deleteBucketGlobalAlias DELETE /bucket/alias/global Delete a global alias
deleteBucketLocalAlias DELETE /bucket/alias/local Delete a local alias
denyBucketKey POST /bucket/deny Deny key
findBucketInfo GET /bucket?globalAlias={alias} Find a bucket
getBucketInfo GET /bucket?id={bucket_id} Get a bucket
listBuckets GET /bucket List all buckets
putBucketGlobalAlias PUT /bucket/alias/global Add a global alias
putBucketLocalAlias PUT /bucket/alias/local Add a local alias
updateBucket PUT /bucket?id={bucket_id} Update a bucket

allowBucketKey

BucketInfo allowBucketKey(allowBucketKeyRequest)

Allow key

⚠️ DISCLAIMER: Garage's developers are aware that this endpoint has an unconventional semantic. Be extra careful when implementing it, its behavior is not obvious. Allows a key to do read/write/owner operations on a bucket. Flags in permissions which have the value true will be activated. Other flags will remain unchanged (ie. they will keep their internal value). For example, if you set read to true, the key will be allowed to read the bucket. If you set it to false, the key will keeps its previous read permission. If you want to disallow read for the key, check the DenyBucketKey operation.

Example

import garage from 'garage_administration_api_v0garage_v0_8_0';
let defaultClient = garage.ApiClient.instance;
// Configure Bearer access token for authorization: bearerAuth
let bearerAuth = defaultClient.authentications['bearerAuth'];
bearerAuth.accessToken = "YOUR ACCESS TOKEN"

let apiInstance = new garage.BucketApi();
let allowBucketKeyRequest = new garage.AllowBucketKeyRequest(); // AllowBucketKeyRequest | Aliases to put on the new bucket 
apiInstance.allowBucketKey(allowBucketKeyRequest).then((data) => {
  console.log('API called successfully. Returned data: ' + data);
}, (error) => {
  console.error(error);
});

Parameters

Name Type Description Notes
allowBucketKeyRequest AllowBucketKeyRequest Aliases to put on the new bucket

Return type

BucketInfo

Authorization

bearerAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

createBucket

BucketInfo createBucket(createBucketRequest)

Create a bucket

Creates a new bucket, either with a global alias, a local one, or no alias at all. Technically, you can also specify both `globalAlias` and `localAlias` and that would create two aliases.

Example

import garage from 'garage_administration_api_v0garage_v0_8_0';
let defaultClient = garage.ApiClient.instance;
// Configure Bearer access token for authorization: bearerAuth
let bearerAuth = defaultClient.authentications['bearerAuth'];
bearerAuth.accessToken = "YOUR ACCESS TOKEN"

let apiInstance = new garage.BucketApi();
let createBucketRequest = new garage.CreateBucketRequest(); // CreateBucketRequest | Aliases to put on the new bucket 
apiInstance.createBucket(createBucketRequest).then((data) => {
  console.log('API called successfully. Returned data: ' + data);
}, (error) => {
  console.error(error);
});

Parameters

Name Type Description Notes
createBucketRequest CreateBucketRequest Aliases to put on the new bucket

Return type

BucketInfo

Authorization

bearerAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

deleteBucket

deleteBucket(bucketId)

Delete a bucket

Delete a bucket.Deletes a storage bucket. A bucket cannot be deleted if it is not empty. Warning: this will delete all aliases associated with the bucket!

Example

import garage from 'garage_administration_api_v0garage_v0_8_0';
let defaultClient = garage.ApiClient.instance;
// Configure Bearer access token for authorization: bearerAuth
let bearerAuth = defaultClient.authentications['bearerAuth'];
bearerAuth.accessToken = "YOUR ACCESS TOKEN"

let apiInstance = new garage.BucketApi();
let bucketId = b4018dc61b27ccb5c64ec1b24f53454bbbd180697c758c4d47a22a8921864a87; // String | The exact bucket identifier, a 32 bytes hexadecimal string
apiInstance.deleteBucket(bucketId).then(() => {
  console.log('API called successfully.');
}, (error) => {
  console.error(error);
});

Parameters

Name Type Description Notes
bucketId String The exact bucket identifier, a 32 bytes hexadecimal string

Return type

null (empty response body)

Authorization

bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: Not defined

deleteBucketGlobalAlias

BucketInfo deleteBucketGlobalAlias(id, alias)

Delete a global alias

Delete a global alias from the target bucket

Example

import garage from 'garage_administration_api_v0garage_v0_8_0';
let defaultClient = garage.ApiClient.instance;
// Configure Bearer access token for authorization: bearerAuth
let bearerAuth = defaultClient.authentications['bearerAuth'];
bearerAuth.accessToken = "YOUR ACCESS TOKEN"

let apiInstance = new garage.BucketApi();
let id = e6a14cd6a27f48684579ec6b381c078ab11697e6bc8513b72b2f5307e25fff9b; // String | 
let alias = my_documents; // String | 
apiInstance.deleteBucketGlobalAlias(id, alias).then((data) => {
  console.log('API called successfully. Returned data: ' + data);
}, (error) => {
  console.error(error);
});

Parameters

Name Type Description Notes
id String
alias String

Return type

BucketInfo

Authorization

bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

deleteBucketLocalAlias

BucketInfo deleteBucketLocalAlias(id, accessKeyId, alias)

Delete a local alias

Delete a local alias, bound to specified account, from the target bucket

Example

import garage from 'garage_administration_api_v0garage_v0_8_0';
let defaultClient = garage.ApiClient.instance;
// Configure Bearer access token for authorization: bearerAuth
let bearerAuth = defaultClient.authentications['bearerAuth'];
bearerAuth.accessToken = "YOUR ACCESS TOKEN"

let apiInstance = new garage.BucketApi();
let id = e6a14cd6a27f48684579ec6b381c078ab11697e6bc8513b72b2f5307e25fff9b; // String | 
let accessKeyId = GK31c2f218a2e44f485b94239e; // String | 
let alias = my_documents; // String | 
apiInstance.deleteBucketLocalAlias(id, accessKeyId, alias).then((data) => {
  console.log('API called successfully. Returned data: ' + data);
}, (error) => {
  console.error(error);
});

Parameters

Name Type Description Notes
id String
accessKeyId String
alias String

Return type

BucketInfo

Authorization

bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

denyBucketKey

BucketInfo denyBucketKey(allowBucketKeyRequest)

Deny key

⚠️ DISCLAIMER: Garage's developers are aware that this endpoint has an unconventional semantic. Be extra careful when implementing it, its behavior is not obvious. Denies a key from doing read/write/owner operations on a bucket. Flags in permissions which have the value true will be deactivated. Other flags will remain unchanged. For example, if you set read to true, the key will be denied from reading. If you set read to false, the key will keep its previous permissions. If you want the key to have the reading permission, check the AllowBucketKey operation.

Example

import garage from 'garage_administration_api_v0garage_v0_8_0';
let defaultClient = garage.ApiClient.instance;
// Configure Bearer access token for authorization: bearerAuth
let bearerAuth = defaultClient.authentications['bearerAuth'];
bearerAuth.accessToken = "YOUR ACCESS TOKEN"

let apiInstance = new garage.BucketApi();
let allowBucketKeyRequest = new garage.AllowBucketKeyRequest(); // AllowBucketKeyRequest | Aliases to put on the new bucket 
apiInstance.denyBucketKey(allowBucketKeyRequest).then((data) => {
  console.log('API called successfully. Returned data: ' + data);
}, (error) => {
  console.error(error);
});

Parameters

Name Type Description Notes
allowBucketKeyRequest AllowBucketKeyRequest Aliases to put on the new bucket

Return type

BucketInfo

Authorization

bearerAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

findBucketInfo

BucketInfo findBucketInfo(alias)

Find a bucket

Find a bucket by its global alias

Example

import garage from 'garage_administration_api_v0garage_v0_8_0';
let defaultClient = garage.ApiClient.instance;
// Configure Bearer access token for authorization: bearerAuth
let bearerAuth = defaultClient.authentications['bearerAuth'];
bearerAuth.accessToken = "YOUR ACCESS TOKEN"

let apiInstance = new garage.BucketApi();
let alias = my_documents; // String | The exact global alias of one of the existing buckets
apiInstance.findBucketInfo(alias).then((data) => {
  console.log('API called successfully. Returned data: ' + data);
}, (error) => {
  console.error(error);
});

Parameters

Name Type Description Notes
alias String The exact global alias of one of the existing buckets

Return type

BucketInfo

Authorization

bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

getBucketInfo

BucketInfo getBucketInfo(bucketId)

Get a bucket

Given a bucket identifier, get its information. It includes its aliases, its web configuration, keys that have some permissions on it, some statistics (number of objects, size), number of dangling multipart uploads, and its quotas (if any).

Example

import garage from 'garage_administration_api_v0garage_v0_8_0';
let defaultClient = garage.ApiClient.instance;
// Configure Bearer access token for authorization: bearerAuth
let bearerAuth = defaultClient.authentications['bearerAuth'];
bearerAuth.accessToken = "YOUR ACCESS TOKEN"

let apiInstance = new garage.BucketApi();
let bucketId = b4018dc61b27ccb5c64ec1b24f53454bbbd180697c758c4d47a22a8921864a87; // String | The exact bucket identifier, a 32 bytes hexadecimal string
apiInstance.getBucketInfo(bucketId).then((data) => {
  console.log('API called successfully. Returned data: ' + data);
}, (error) => {
  console.error(error);
});

Parameters

Name Type Description Notes
bucketId String The exact bucket identifier, a 32 bytes hexadecimal string

Return type

BucketInfo

Authorization

bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

listBuckets

[ListBuckets200ResponseInner] listBuckets()

List all buckets

List all the buckets on the cluster with their UUID and their global and local aliases.

Example

import garage from 'garage_administration_api_v0garage_v0_8_0';
let defaultClient = garage.ApiClient.instance;
// Configure Bearer access token for authorization: bearerAuth
let bearerAuth = defaultClient.authentications['bearerAuth'];
bearerAuth.accessToken = "YOUR ACCESS TOKEN"

let apiInstance = new garage.BucketApi();
apiInstance.listBuckets().then((data) => {
  console.log('API called successfully. Returned data: ' + data);
}, (error) => {
  console.error(error);
});

Parameters

This endpoint does not need any parameter.

Return type

[ListBuckets200ResponseInner]

Authorization

bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

putBucketGlobalAlias

BucketInfo putBucketGlobalAlias(id, alias)

Add a global alias

Add a global alias to the target bucket

Example

import garage from 'garage_administration_api_v0garage_v0_8_0';
let defaultClient = garage.ApiClient.instance;
// Configure Bearer access token for authorization: bearerAuth
let bearerAuth = defaultClient.authentications['bearerAuth'];
bearerAuth.accessToken = "YOUR ACCESS TOKEN"

let apiInstance = new garage.BucketApi();
let id = e6a14cd6a27f48684579ec6b381c078ab11697e6bc8513b72b2f5307e25fff9b; // String | 
let alias = my_documents; // String | 
apiInstance.putBucketGlobalAlias(id, alias).then((data) => {
  console.log('API called successfully. Returned data: ' + data);
}, (error) => {
  console.error(error);
});

Parameters

Name Type Description Notes
id String
alias String

Return type

BucketInfo

Authorization

bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

putBucketLocalAlias

BucketInfo putBucketLocalAlias(id, accessKeyId, alias)

Add a local alias

Add a local alias, bound to specified account, to the target bucket

Example

import garage from 'garage_administration_api_v0garage_v0_8_0';
let defaultClient = garage.ApiClient.instance;
// Configure Bearer access token for authorization: bearerAuth
let bearerAuth = defaultClient.authentications['bearerAuth'];
bearerAuth.accessToken = "YOUR ACCESS TOKEN"

let apiInstance = new garage.BucketApi();
let id = e6a14cd6a27f48684579ec6b381c078ab11697e6bc8513b72b2f5307e25fff9b; // String | 
let accessKeyId = GK31c2f218a2e44f485b94239e; // String | 
let alias = my_documents; // String | 
apiInstance.putBucketLocalAlias(id, accessKeyId, alias).then((data) => {
  console.log('API called successfully. Returned data: ' + data);
}, (error) => {
  console.error(error);
});

Parameters

Name Type Description Notes
id String
accessKeyId String
alias String

Return type

BucketInfo

Authorization

bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

updateBucket

BucketInfo updateBucket(bucketId, updateBucketRequest)

Update a bucket

All fields (`websiteAccess` and `quotas`) are optionnal. If they are present, the corresponding modifications are applied to the bucket, otherwise nothing is changed. In `websiteAccess`: if `enabled` is `true`, `indexDocument` must be specified. The field `errorDocument` is optional, if no error document is set a generic error message is displayed when errors happen. Conversely, if `enabled` is `false`, neither `indexDocument` nor `errorDocument` must be specified. In `quotas`: new values of `maxSize` and `maxObjects` must both be specified, or set to `null` to remove the quotas. An absent value will be considered the same as a `null`. It is not possible to change only one of the two quotas.

Example

import garage from 'garage_administration_api_v0garage_v0_8_0';
let defaultClient = garage.ApiClient.instance;
// Configure Bearer access token for authorization: bearerAuth
let bearerAuth = defaultClient.authentications['bearerAuth'];
bearerAuth.accessToken = "YOUR ACCESS TOKEN"

let apiInstance = new garage.BucketApi();
let bucketId = b4018dc61b27ccb5c64ec1b24f53454bbbd180697c758c4d47a22a8921864a87; // String | The exact bucket identifier, a 32 bytes hexadecimal string
let updateBucketRequest = new garage.UpdateBucketRequest(); // UpdateBucketRequest | Requested changes on the bucket. Both root fields are optionals. 
apiInstance.updateBucket(bucketId, updateBucketRequest).then((data) => {
  console.log('API called successfully. Returned data: ' + data);
}, (error) => {
  console.error(error);
});

Parameters

Name Type Description Notes
bucketId String The exact bucket identifier, a 32 bytes hexadecimal string
updateBucketRequest UpdateBucketRequest Requested changes on the bucket. Both root fields are optionals.

Return type

BucketInfo

Authorization

bearerAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json