Use promises

This commit is contained in:
Quentin 2022-11-13 12:56:24 +01:00
parent 10360d3b3c
commit 97a1ec9712
Signed by: quentin
GPG Key ID: E9602264D639FF68
12 changed files with 517 additions and 441 deletions

View File

@ -1,6 +1,5 @@
.babelrc .babelrc
.gitignore .gitignore
.openapi-generator-ignore
.travis.yml .travis.yml
README.md README.md
docs/AddKeyRequest.md docs/AddKeyRequest.md
@ -76,37 +75,3 @@ src/model/UpdateBucketRequestWebsiteAccess.js
src/model/UpdateKeyRequest.js src/model/UpdateKeyRequest.js
src/model/UpdateKeyRequestAllow.js src/model/UpdateKeyRequestAllow.js
src/model/UpdateKeyRequestDeny.js src/model/UpdateKeyRequestDeny.js
test/api/BucketApi.spec.js
test/api/KeyApi.spec.js
test/api/LayoutApi.spec.js
test/api/NodesApi.spec.js
test/model/AddKeyRequest.spec.js
test/model/AddNode200ResponseInner.spec.js
test/model/AllowBucketKeyRequest.spec.js
test/model/AllowBucketKeyRequestPermissions.spec.js
test/model/BucketInfo.spec.js
test/model/BucketInfoQuotas.spec.js
test/model/BucketInfoWebsiteConfig.spec.js
test/model/BucketKeyInfo.spec.js
test/model/ClusterLayout.spec.js
test/model/CreateBucketRequest.spec.js
test/model/CreateBucketRequestLocalAlias.spec.js
test/model/CreateBucketRequestLocalAliasAllow.spec.js
test/model/GetNodes200Response.spec.js
test/model/ImportKeyRequest.spec.js
test/model/KeyInfo.spec.js
test/model/KeyInfoBucketsInner.spec.js
test/model/KeyInfoBucketsInnerPermissions.spec.js
test/model/KeyInfoPermissions.spec.js
test/model/LayoutVersion.spec.js
test/model/ListBuckets200ResponseInner.spec.js
test/model/ListBuckets200ResponseInnerLocalAliasesInner.spec.js
test/model/ListKeys200ResponseInner.spec.js
test/model/NodeClusterInfo.spec.js
test/model/NodeNetworkInfo.spec.js
test/model/UpdateBucketRequest.spec.js
test/model/UpdateBucketRequestQuotas.spec.js
test/model/UpdateBucketRequestWebsiteAccess.spec.js
test/model/UpdateKeyRequest.spec.js
test/model/UpdateKeyRequestAllow.spec.js
test/model/UpdateKeyRequestDeny.spec.js

View File

@ -110,14 +110,12 @@ bearerAuth.accessToken = "YOUR ACCESS TOKEN"
var api = new garage.BucketApi() var api = new garage.BucketApi()
var allowBucketKeyRequest = new garage.AllowBucketKeyRequest(); // {AllowBucketKeyRequest} Aliases to put on the new bucket var allowBucketKeyRequest = new garage.AllowBucketKeyRequest(); // {AllowBucketKeyRequest} Aliases to put on the new bucket
var callback = function(error, data, response) { api.allowBucketKey(allowBucketKeyRequest).then(function(data) {
if (error) { console.log('API called successfully. Returned data: ' + data);
console.error(error); }, function(error) {
} else { console.error(error);
console.log('API called successfully. Returned data: ' + data); });
}
};
api.allowBucketKey(allowBucketKeyRequest, callback);
``` ```

View File

@ -38,13 +38,12 @@ bearerAuth.accessToken = "YOUR ACCESS TOKEN"
let apiInstance = new garage.BucketApi(); let apiInstance = new garage.BucketApi();
let allowBucketKeyRequest = new garage.AllowBucketKeyRequest(); // AllowBucketKeyRequest | Aliases to put on the new bucket let allowBucketKeyRequest = new garage.AllowBucketKeyRequest(); // AllowBucketKeyRequest | Aliases to put on the new bucket
apiInstance.allowBucketKey(allowBucketKeyRequest, (error, data, response) => { apiInstance.allowBucketKey(allowBucketKeyRequest).then((data) => {
if (error) { console.log('API called successfully. Returned data: ' + data);
console.error(error); }, (error) => {
} else { console.error(error);
console.log('API called successfully. Returned data: ' + data);
}
}); });
``` ```
### Parameters ### Parameters
@ -87,13 +86,12 @@ bearerAuth.accessToken = "YOUR ACCESS TOKEN"
let apiInstance = new garage.BucketApi(); let apiInstance = new garage.BucketApi();
let createBucketRequest = new garage.CreateBucketRequest(); // CreateBucketRequest | Aliases to put on the new bucket let createBucketRequest = new garage.CreateBucketRequest(); // CreateBucketRequest | Aliases to put on the new bucket
apiInstance.createBucket(createBucketRequest, (error, data, response) => { apiInstance.createBucket(createBucketRequest).then((data) => {
if (error) { console.log('API called successfully. Returned data: ' + data);
console.error(error); }, (error) => {
} else { console.error(error);
console.log('API called successfully. Returned data: ' + data);
}
}); });
``` ```
### Parameters ### Parameters
@ -136,13 +134,12 @@ bearerAuth.accessToken = "YOUR ACCESS TOKEN"
let apiInstance = new garage.BucketApi(); let apiInstance = new garage.BucketApi();
let bucketId = b4018dc61b27ccb5c64ec1b24f53454bbbd180697c758c4d47a22a8921864a87; // String | The exact bucket identifier, a 32 bytes hexadecimal string let bucketId = b4018dc61b27ccb5c64ec1b24f53454bbbd180697c758c4d47a22a8921864a87; // String | The exact bucket identifier, a 32 bytes hexadecimal string
apiInstance.deleteBucket(bucketId, (error, data, response) => { apiInstance.deleteBucket(bucketId).then(() => {
if (error) { console.log('API called successfully.');
console.error(error); }, (error) => {
} else { console.error(error);
console.log('API called successfully.');
}
}); });
``` ```
### Parameters ### Parameters
@ -186,13 +183,12 @@ bearerAuth.accessToken = "YOUR ACCESS TOKEN"
let apiInstance = new garage.BucketApi(); let apiInstance = new garage.BucketApi();
let id = e6a14cd6a27f48684579ec6b381c078ab11697e6bc8513b72b2f5307e25fff9b; // String | let id = e6a14cd6a27f48684579ec6b381c078ab11697e6bc8513b72b2f5307e25fff9b; // String |
let alias = my_documents; // String | let alias = my_documents; // String |
apiInstance.deleteBucketGlobalAlias(id, alias, (error, data, response) => { apiInstance.deleteBucketGlobalAlias(id, alias).then((data) => {
if (error) { console.log('API called successfully. Returned data: ' + data);
console.error(error); }, (error) => {
} else { console.error(error);
console.log('API called successfully. Returned data: ' + data);
}
}); });
``` ```
### Parameters ### Parameters
@ -238,13 +234,12 @@ let apiInstance = new garage.BucketApi();
let id = e6a14cd6a27f48684579ec6b381c078ab11697e6bc8513b72b2f5307e25fff9b; // String | let id = e6a14cd6a27f48684579ec6b381c078ab11697e6bc8513b72b2f5307e25fff9b; // String |
let accessKeyId = GK31c2f218a2e44f485b94239e; // String | let accessKeyId = GK31c2f218a2e44f485b94239e; // String |
let alias = my_documents; // String | let alias = my_documents; // String |
apiInstance.deleteBucketLocalAlias(id, accessKeyId, alias, (error, data, response) => { apiInstance.deleteBucketLocalAlias(id, accessKeyId, alias).then((data) => {
if (error) { console.log('API called successfully. Returned data: ' + data);
console.error(error); }, (error) => {
} else { console.error(error);
console.log('API called successfully. Returned data: ' + data);
}
}); });
``` ```
### Parameters ### Parameters
@ -289,13 +284,12 @@ bearerAuth.accessToken = "YOUR ACCESS TOKEN"
let apiInstance = new garage.BucketApi(); let apiInstance = new garage.BucketApi();
let allowBucketKeyRequest = new garage.AllowBucketKeyRequest(); // AllowBucketKeyRequest | Aliases to put on the new bucket let allowBucketKeyRequest = new garage.AllowBucketKeyRequest(); // AllowBucketKeyRequest | Aliases to put on the new bucket
apiInstance.denyBucketKey(allowBucketKeyRequest, (error, data, response) => { apiInstance.denyBucketKey(allowBucketKeyRequest).then((data) => {
if (error) { console.log('API called successfully. Returned data: ' + data);
console.error(error); }, (error) => {
} else { console.error(error);
console.log('API called successfully. Returned data: ' + data);
}
}); });
``` ```
### Parameters ### Parameters
@ -338,13 +332,12 @@ bearerAuth.accessToken = "YOUR ACCESS TOKEN"
let apiInstance = new garage.BucketApi(); let apiInstance = new garage.BucketApi();
let alias = my_documents; // String | The exact global alias of one of the existing buckets let alias = my_documents; // String | The exact global alias of one of the existing buckets
apiInstance.findBucketInfo(alias, (error, data, response) => { apiInstance.findBucketInfo(alias).then((data) => {
if (error) { console.log('API called successfully. Returned data: ' + data);
console.error(error); }, (error) => {
} else { console.error(error);
console.log('API called successfully. Returned data: ' + data);
}
}); });
``` ```
### Parameters ### Parameters
@ -387,13 +380,12 @@ bearerAuth.accessToken = "YOUR ACCESS TOKEN"
let apiInstance = new garage.BucketApi(); let apiInstance = new garage.BucketApi();
let bucketId = b4018dc61b27ccb5c64ec1b24f53454bbbd180697c758c4d47a22a8921864a87; // String | The exact bucket identifier, a 32 bytes hexadecimal string let bucketId = b4018dc61b27ccb5c64ec1b24f53454bbbd180697c758c4d47a22a8921864a87; // String | The exact bucket identifier, a 32 bytes hexadecimal string
apiInstance.getBucketInfo(bucketId, (error, data, response) => { apiInstance.getBucketInfo(bucketId).then((data) => {
if (error) { console.log('API called successfully. Returned data: ' + data);
console.error(error); }, (error) => {
} else { console.error(error);
console.log('API called successfully. Returned data: ' + data);
}
}); });
``` ```
### Parameters ### Parameters
@ -435,13 +427,12 @@ let bearerAuth = defaultClient.authentications['bearerAuth'];
bearerAuth.accessToken = "YOUR ACCESS TOKEN" bearerAuth.accessToken = "YOUR ACCESS TOKEN"
let apiInstance = new garage.BucketApi(); let apiInstance = new garage.BucketApi();
apiInstance.listBuckets((error, data, response) => { apiInstance.listBuckets().then((data) => {
if (error) { console.log('API called successfully. Returned data: ' + data);
console.error(error); }, (error) => {
} else { console.error(error);
console.log('API called successfully. Returned data: ' + data);
}
}); });
``` ```
### Parameters ### Parameters
@ -482,13 +473,12 @@ bearerAuth.accessToken = "YOUR ACCESS TOKEN"
let apiInstance = new garage.BucketApi(); let apiInstance = new garage.BucketApi();
let id = e6a14cd6a27f48684579ec6b381c078ab11697e6bc8513b72b2f5307e25fff9b; // String | let id = e6a14cd6a27f48684579ec6b381c078ab11697e6bc8513b72b2f5307e25fff9b; // String |
let alias = my_documents; // String | let alias = my_documents; // String |
apiInstance.putBucketGlobalAlias(id, alias, (error, data, response) => { apiInstance.putBucketGlobalAlias(id, alias).then((data) => {
if (error) { console.log('API called successfully. Returned data: ' + data);
console.error(error); }, (error) => {
} else { console.error(error);
console.log('API called successfully. Returned data: ' + data);
}
}); });
``` ```
### Parameters ### Parameters
@ -534,13 +524,12 @@ let apiInstance = new garage.BucketApi();
let id = e6a14cd6a27f48684579ec6b381c078ab11697e6bc8513b72b2f5307e25fff9b; // String | let id = e6a14cd6a27f48684579ec6b381c078ab11697e6bc8513b72b2f5307e25fff9b; // String |
let accessKeyId = GK31c2f218a2e44f485b94239e; // String | let accessKeyId = GK31c2f218a2e44f485b94239e; // String |
let alias = my_documents; // String | let alias = my_documents; // String |
apiInstance.putBucketLocalAlias(id, accessKeyId, alias, (error, data, response) => { apiInstance.putBucketLocalAlias(id, accessKeyId, alias).then((data) => {
if (error) { console.log('API called successfully. Returned data: ' + data);
console.error(error); }, (error) => {
} else { console.error(error);
console.log('API called successfully. Returned data: ' + data);
}
}); });
``` ```
### Parameters ### Parameters
@ -586,13 +575,12 @@ bearerAuth.accessToken = "YOUR ACCESS TOKEN"
let apiInstance = new garage.BucketApi(); let apiInstance = new garage.BucketApi();
let bucketId = b4018dc61b27ccb5c64ec1b24f53454bbbd180697c758c4d47a22a8921864a87; // String | The exact bucket identifier, a 32 bytes hexadecimal string 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. let updateBucketRequest = new garage.UpdateBucketRequest(); // UpdateBucketRequest | Requested changes on the bucket. Both root fields are optionals.
apiInstance.updateBucket(bucketId, updateBucketRequest, (error, data, response) => { apiInstance.updateBucket(bucketId, updateBucketRequest).then((data) => {
if (error) { console.log('API called successfully. Returned data: ' + data);
console.error(error); }, (error) => {
} else { console.error(error);
console.log('API called successfully. Returned data: ' + data);
}
}); });
``` ```
### Parameters ### Parameters

View File

@ -33,13 +33,12 @@ bearerAuth.accessToken = "YOUR ACCESS TOKEN"
let apiInstance = new garage.KeyApi(); let apiInstance = new garage.KeyApi();
let addKeyRequest = new garage.AddKeyRequest(); // AddKeyRequest | \"You can set a friendly name for this key, send an empty string instead\" let addKeyRequest = new garage.AddKeyRequest(); // AddKeyRequest | \"You can set a friendly name for this key, send an empty string instead\"
apiInstance.addKey(addKeyRequest, (error, data, response) => { apiInstance.addKey(addKeyRequest).then((data) => {
if (error) { console.log('API called successfully. Returned data: ' + data);
console.error(error); }, (error) => {
} else { console.error(error);
console.log('API called successfully. Returned data: ' + data);
}
}); });
``` ```
### Parameters ### Parameters
@ -82,13 +81,12 @@ bearerAuth.accessToken = "YOUR ACCESS TOKEN"
let apiInstance = new garage.KeyApi(); let apiInstance = new garage.KeyApi();
let accessKey = GK31c2f218a2e44f485b94239e; // String | The exact API access key generated by Garage let accessKey = GK31c2f218a2e44f485b94239e; // String | The exact API access key generated by Garage
apiInstance.deleteKey(accessKey, (error, data, response) => { apiInstance.deleteKey(accessKey).then(() => {
if (error) { console.log('API called successfully.');
console.error(error); }, (error) => {
} else { console.error(error);
console.log('API called successfully.');
}
}); });
``` ```
### Parameters ### Parameters
@ -131,13 +129,12 @@ bearerAuth.accessToken = "YOUR ACCESS TOKEN"
let apiInstance = new garage.KeyApi(); let apiInstance = new garage.KeyApi();
let accessKey = GK31c2f218a2e44f485b94239e; // String | The exact API access key generated by Garage let accessKey = GK31c2f218a2e44f485b94239e; // String | The exact API access key generated by Garage
apiInstance.getKey(accessKey, (error, data, response) => { apiInstance.getKey(accessKey).then((data) => {
if (error) { console.log('API called successfully. Returned data: ' + data);
console.error(error); }, (error) => {
} else { console.error(error);
console.log('API called successfully. Returned data: ' + data);
}
}); });
``` ```
### Parameters ### Parameters
@ -180,13 +177,12 @@ bearerAuth.accessToken = "YOUR ACCESS TOKEN"
let apiInstance = new garage.KeyApi(); let apiInstance = new garage.KeyApi();
let importKeyRequest = new garage.ImportKeyRequest(); // ImportKeyRequest | Information on the key to import let importKeyRequest = new garage.ImportKeyRequest(); // ImportKeyRequest | Information on the key to import
apiInstance.importKey(importKeyRequest, (error, data, response) => { apiInstance.importKey(importKeyRequest).then((data) => {
if (error) { console.log('API called successfully. Returned data: ' + data);
console.error(error); }, (error) => {
} else { console.error(error);
console.log('API called successfully. Returned data: ' + data);
}
}); });
``` ```
### Parameters ### Parameters
@ -228,13 +224,12 @@ let bearerAuth = defaultClient.authentications['bearerAuth'];
bearerAuth.accessToken = "YOUR ACCESS TOKEN" bearerAuth.accessToken = "YOUR ACCESS TOKEN"
let apiInstance = new garage.KeyApi(); let apiInstance = new garage.KeyApi();
apiInstance.listKeys((error, data, response) => { apiInstance.listKeys().then((data) => {
if (error) { console.log('API called successfully. Returned data: ' + data);
console.error(error); }, (error) => {
} else { console.error(error);
console.log('API called successfully. Returned data: ' + data);
}
}); });
``` ```
### Parameters ### Parameters
@ -274,13 +269,12 @@ bearerAuth.accessToken = "YOUR ACCESS TOKEN"
let apiInstance = new garage.KeyApi(); let apiInstance = new garage.KeyApi();
let pattern = test-k; // String | A pattern (beginning or full string) corresponding to a key identifier or friendly name let pattern = test-k; // String | A pattern (beginning or full string) corresponding to a key identifier or friendly name
apiInstance.searchKey(pattern, (error, data, response) => { apiInstance.searchKey(pattern).then((data) => {
if (error) { console.log('API called successfully. Returned data: ' + data);
console.error(error); }, (error) => {
} else { console.error(error);
console.log('API called successfully. Returned data: ' + data);
}
}); });
``` ```
### Parameters ### Parameters
@ -324,13 +318,12 @@ bearerAuth.accessToken = "YOUR ACCESS TOKEN"
let apiInstance = new garage.KeyApi(); let apiInstance = new garage.KeyApi();
let accessKey = GK31c2f218a2e44f485b94239e; // String | The exact API access key generated by Garage let accessKey = GK31c2f218a2e44f485b94239e; // String | The exact API access key generated by Garage
let updateKeyRequest = new garage.UpdateKeyRequest(); // UpdateKeyRequest | For a given key, provide a first set with the permissions to grant, and a second set with the permissions to remove let updateKeyRequest = new garage.UpdateKeyRequest(); // UpdateKeyRequest | For a given key, provide a first set with the permissions to grant, and a second set with the permissions to remove
apiInstance.updateKey(accessKey, updateKeyRequest, (error, data, response) => { apiInstance.updateKey(accessKey, updateKeyRequest).then((data) => {
if (error) { console.log('API called successfully. Returned data: ' + data);
console.error(error); }, (error) => {
} else { console.error(error);
console.log('API called successfully. Returned data: ' + data);
}
}); });
``` ```
### Parameters ### Parameters

View File

@ -30,13 +30,12 @@ bearerAuth.accessToken = "YOUR ACCESS TOKEN"
let apiInstance = new garage.LayoutApi(); let apiInstance = new garage.LayoutApi();
let requestBody = {key: new garage.NodeClusterInfo()}; // {String: NodeClusterInfo} | To add a new node to the layout or to change the configuration of an existing node, simply set the values you want. To remove a node, set it to `null` instead of passing a configuration object. Contrary to the CLI that may update only a subset of the fields capacity, zone and tags, when calling this API all of these values must be specified. let requestBody = {key: new garage.NodeClusterInfo()}; // {String: NodeClusterInfo} | To add a new node to the layout or to change the configuration of an existing node, simply set the values you want. To remove a node, set it to `null` instead of passing a configuration object. Contrary to the CLI that may update only a subset of the fields capacity, zone and tags, when calling this API all of these values must be specified.
apiInstance.addLayout(requestBody, (error, data, response) => { apiInstance.addLayout(requestBody).then(() => {
if (error) { console.log('API called successfully.');
console.error(error); }, (error) => {
} else { console.error(error);
console.log('API called successfully.');
}
}); });
``` ```
### Parameters ### Parameters
@ -79,13 +78,12 @@ bearerAuth.accessToken = "YOUR ACCESS TOKEN"
let apiInstance = new garage.LayoutApi(); let apiInstance = new garage.LayoutApi();
let layoutVersion = new garage.LayoutVersion(); // LayoutVersion | Similarly to the CLI, the body must include the version of the new layout that will be created, which MUST be 1 + the value of the currently existing layout in the cluster. let layoutVersion = new garage.LayoutVersion(); // LayoutVersion | Similarly to the CLI, the body must include the version of the new layout that will be created, which MUST be 1 + the value of the currently existing layout in the cluster.
apiInstance.applyLayout(layoutVersion, (error, data, response) => { apiInstance.applyLayout(layoutVersion).then(() => {
if (error) { console.log('API called successfully.');
console.error(error); }, (error) => {
} else { console.error(error);
console.log('API called successfully.');
}
}); });
``` ```
### Parameters ### Parameters
@ -127,13 +125,12 @@ let bearerAuth = defaultClient.authentications['bearerAuth'];
bearerAuth.accessToken = "YOUR ACCESS TOKEN" bearerAuth.accessToken = "YOUR ACCESS TOKEN"
let apiInstance = new garage.LayoutApi(); let apiInstance = new garage.LayoutApi();
apiInstance.getLayout((error, data, response) => { apiInstance.getLayout().then((data) => {
if (error) { console.log('API called successfully. Returned data: ' + data);
console.error(error); }, (error) => {
} else { console.error(error);
console.log('API called successfully. Returned data: ' + data);
}
}); });
``` ```
### Parameters ### Parameters
@ -173,13 +170,12 @@ bearerAuth.accessToken = "YOUR ACCESS TOKEN"
let apiInstance = new garage.LayoutApi(); let apiInstance = new garage.LayoutApi();
let layoutVersion = new garage.LayoutVersion(); // LayoutVersion | Reverting the staged changes is done by incrementing the version number and clearing the contents of the staged change list. Similarly to the CLI, the body must include the incremented version number, which MUST be 1 + the value of the currently existing layout in the cluster. let layoutVersion = new garage.LayoutVersion(); // LayoutVersion | Reverting the staged changes is done by incrementing the version number and clearing the contents of the staged change list. Similarly to the CLI, the body must include the incremented version number, which MUST be 1 + the value of the currently existing layout in the cluster.
apiInstance.revertLayout(layoutVersion, (error, data, response) => { apiInstance.revertLayout(layoutVersion).then(() => {
if (error) { console.log('API called successfully.');
console.error(error); }, (error) => {
} else { console.error(error);
console.log('API called successfully.');
}
}); });
``` ```
### Parameters ### Parameters

View File

@ -28,13 +28,12 @@ bearerAuth.accessToken = "YOUR ACCESS TOKEN"
let apiInstance = new garage.NodesApi(); let apiInstance = new garage.NodesApi();
let requestBody = ["null"]; // [String] | let requestBody = ["null"]; // [String] |
apiInstance.addNode(requestBody, (error, data, response) => { apiInstance.addNode(requestBody).then((data) => {
if (error) { console.log('API called successfully. Returned data: ' + data);
console.error(error); }, (error) => {
} else { console.error(error);
console.log('API called successfully. Returned data: ' + data);
}
}); });
``` ```
### Parameters ### Parameters
@ -76,13 +75,12 @@ let bearerAuth = defaultClient.authentications['bearerAuth'];
bearerAuth.accessToken = "YOUR ACCESS TOKEN" bearerAuth.accessToken = "YOUR ACCESS TOKEN"
let apiInstance = new garage.NodesApi(); let apiInstance = new garage.NodesApi();
apiInstance.getNodes((error, data, response) => { apiInstance.getNodes().then((data) => {
if (error) { console.log('API called successfully. Returned data: ' + data);
console.error(error); }, (error) => {
} else { console.error(error);
console.log('API called successfully. Returned data: ' + data);
}
}); });
``` ```
### Parameters ### Parameters

View File

@ -12,6 +12,9 @@
"browser": { "browser": {
"fs": false "fs": false
}, },
"publishConfig":{
"registry":"@dxflrs/garage-admin-sdk-js"
},
"dependencies": { "dependencies": {
"@babel/cli": "^7.0.0", "@babel/cli": "^7.0.0",
"superagent": "^5.3.0" "superagent": "^5.3.0"

View File

@ -368,13 +368,6 @@ class ApiClient {
return ApiClient.convertToType(data, returnType); return ApiClient.convertToType(data, returnType);
} }
/**
* Callback function to receive the result of the operation.
* @callback module:ApiClient~callApiCallback
* @param {String} error Error message, if any.
* @param data The data returned by the service call.
* @param {String} response The complete HTTP response.
*/
/** /**
* Invokes the REST service using the supplied settings and parameters. * Invokes the REST service using the supplied settings and parameters.
@ -391,12 +384,11 @@ class ApiClient {
* @param {(String|Array|ObjectFunction)} returnType The required type to return; can be a string for simple types or the * @param {(String|Array|ObjectFunction)} returnType The required type to return; can be a string for simple types or the
* constructor for a complex type. * constructor for a complex type.
* @param {String} apiBasePath base path defined in the operation/path level to override the default one * @param {String} apiBasePath base path defined in the operation/path level to override the default one
* @param {module:ApiClient~callApiCallback} callback The callback function. * @returns {Promise} A {@link https://www.promisejs.org/|Promise} object.
* @returns {Object} The SuperAgent request object.
*/ */
callApi(path, httpMethod, pathParams, callApi(path, httpMethod, pathParams,
queryParams, headerParams, formParams, bodyParam, authNames, contentTypes, accepts, queryParams, headerParams, formParams, bodyParam, authNames, contentTypes, accepts,
returnType, apiBasePath, callback) { returnType, apiBasePath) {
var url = this.buildUrl(path, pathParams, apiBasePath); var url = this.buildUrl(path, pathParams, apiBasePath);
var request = superagent(httpMethod, url); var request = superagent(httpMethod, url);
@ -485,25 +477,34 @@ class ApiClient {
} }
} }
request.end((error, response) => { return new Promise((resolve, reject) => {
if (callback) { request.end((error, response) => {
var data = null; if (error) {
if (!error) { var err = {};
if (response) {
err.status = response.status;
err.statusText = response.statusText;
err.body = response.body;
err.response = response;
}
err.error = error;
reject(err);
} else {
try { try {
data = this.deserialize(response, returnType); var data = this.deserialize(response, returnType);
if (this.enableCookies && typeof window === 'undefined'){ if (this.enableCookies && typeof window === 'undefined'){
this.agent._saveCookies(response); this.agent._saveCookies(response);
} }
resolve({data, response});
} catch (err) { } catch (err) {
error = err; reject(err);
} }
} }
});
callback(error, data, response);
}
}); });
return request;
} }
/** /**

View File

@ -38,22 +38,14 @@ export default class BucketApi {
} }
/**
* Callback function to receive the result of the allowBucketKey operation.
* @callback module:api/BucketApi~allowBucketKeyCallback
* @param {String} error Error message, if any.
* @param {module:model/BucketInfo} data The data returned by the service call.
* @param {String} response The complete HTTP response.
*/
/** /**
* Allow key * 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. * **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.
* @param {module:model/AllowBucketKeyRequest} allowBucketKeyRequest Aliases to put on the new bucket * @param {module:model/AllowBucketKeyRequest} allowBucketKeyRequest Aliases to put on the new bucket
* @param {module:api/BucketApi~allowBucketKeyCallback} callback The callback function, accepting three arguments: error, data, response * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/BucketInfo} and HTTP response
* data is of type: {@link module:model/BucketInfo}
*/ */
allowBucketKey(allowBucketKeyRequest, callback) { allowBucketKeyWithHttpInfo(allowBucketKeyRequest) {
let postBody = allowBucketKeyRequest; let postBody = allowBucketKeyRequest;
// verify the required parameter 'allowBucketKeyRequest' is set // verify the required parameter 'allowBucketKeyRequest' is set
if (allowBucketKeyRequest === undefined || allowBucketKeyRequest === null) { if (allowBucketKeyRequest === undefined || allowBucketKeyRequest === null) {
@ -76,26 +68,31 @@ export default class BucketApi {
return this.apiClient.callApi( return this.apiClient.callApi(
'/bucket/allow', 'POST', '/bucket/allow', 'POST',
pathParams, queryParams, headerParams, formParams, postBody, pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType, null, callback authNames, contentTypes, accepts, returnType, null
); );
} }
/** /**
* Callback function to receive the result of the createBucket operation. * Allow key
* @callback module:api/BucketApi~createBucketCallback * **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.
* @param {String} error Error message, if any. * @param {module:model/AllowBucketKeyRequest} allowBucketKeyRequest Aliases to put on the new bucket
* @param {module:model/BucketInfo} data The data returned by the service call. * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/BucketInfo}
* @param {String} response The complete HTTP response.
*/ */
allowBucketKey(allowBucketKeyRequest) {
return this.allowBucketKeyWithHttpInfo(allowBucketKeyRequest)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/** /**
* Create a bucket * 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. * 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.
* @param {module:model/CreateBucketRequest} createBucketRequest Aliases to put on the new bucket * @param {module:model/CreateBucketRequest} createBucketRequest Aliases to put on the new bucket
* @param {module:api/BucketApi~createBucketCallback} callback The callback function, accepting three arguments: error, data, response * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/BucketInfo} and HTTP response
* data is of type: {@link module:model/BucketInfo}
*/ */
createBucket(createBucketRequest, callback) { createBucketWithHttpInfo(createBucketRequest) {
let postBody = createBucketRequest; let postBody = createBucketRequest;
// verify the required parameter 'createBucketRequest' is set // verify the required parameter 'createBucketRequest' is set
if (createBucketRequest === undefined || createBucketRequest === null) { if (createBucketRequest === undefined || createBucketRequest === null) {
@ -118,25 +115,31 @@ export default class BucketApi {
return this.apiClient.callApi( return this.apiClient.callApi(
'/bucket', 'POST', '/bucket', 'POST',
pathParams, queryParams, headerParams, formParams, postBody, pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType, null, callback authNames, contentTypes, accepts, returnType, null
); );
} }
/** /**
* Callback function to receive the result of the deleteBucket operation. * Create a bucket
* @callback module:api/BucketApi~deleteBucketCallback * 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.
* @param {String} error Error message, if any. * @param {module:model/CreateBucketRequest} createBucketRequest Aliases to put on the new bucket
* @param data This operation does not return a value. * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/BucketInfo}
* @param {String} response The complete HTTP response.
*/ */
createBucket(createBucketRequest) {
return this.createBucketWithHttpInfo(createBucketRequest)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/** /**
* Delete a bucket * 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! * 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!
* @param {String} bucketId The exact bucket identifier, a 32 bytes hexadecimal string * @param {String} bucketId The exact bucket identifier, a 32 bytes hexadecimal string
* @param {module:api/BucketApi~deleteBucketCallback} callback The callback function, accepting three arguments: error, data, response * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing HTTP response
*/ */
deleteBucket(bucketId, callback) { deleteBucketWithHttpInfo(bucketId) {
let postBody = null; let postBody = null;
// verify the required parameter 'bucketId' is set // verify the required parameter 'bucketId' is set
if (bucketId === undefined || bucketId === null) { if (bucketId === undefined || bucketId === null) {
@ -160,27 +163,32 @@ export default class BucketApi {
return this.apiClient.callApi( return this.apiClient.callApi(
'/bucket?id={bucket_id}', 'DELETE', '/bucket?id={bucket_id}', 'DELETE',
pathParams, queryParams, headerParams, formParams, postBody, pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType, null, callback authNames, contentTypes, accepts, returnType, null
); );
} }
/** /**
* Callback function to receive the result of the deleteBucketGlobalAlias operation. * Delete a bucket
* @callback module:api/BucketApi~deleteBucketGlobalAliasCallback * 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!
* @param {String} error Error message, if any. * @param {String} bucketId The exact bucket identifier, a 32 bytes hexadecimal string
* @param {module:model/BucketInfo} data The data returned by the service call. * @return {Promise} a {@link https://www.promisejs.org/|Promise}
* @param {String} response The complete HTTP response.
*/ */
deleteBucket(bucketId) {
return this.deleteBucketWithHttpInfo(bucketId)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/** /**
* Delete a global alias * Delete a global alias
* Delete a global alias from the target bucket * Delete a global alias from the target bucket
* @param {String} id * @param {String} id
* @param {String} alias * @param {String} alias
* @param {module:api/BucketApi~deleteBucketGlobalAliasCallback} callback The callback function, accepting three arguments: error, data, response * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/BucketInfo} and HTTP response
* data is of type: {@link module:model/BucketInfo}
*/ */
deleteBucketGlobalAlias(id, alias, callback) { deleteBucketGlobalAliasWithHttpInfo(id, alias) {
let postBody = null; let postBody = null;
// verify the required parameter 'id' is set // verify the required parameter 'id' is set
if (id === undefined || id === null) { if (id === undefined || id === null) {
@ -209,17 +217,24 @@ export default class BucketApi {
return this.apiClient.callApi( return this.apiClient.callApi(
'/bucket/alias/global', 'DELETE', '/bucket/alias/global', 'DELETE',
pathParams, queryParams, headerParams, formParams, postBody, pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType, null, callback authNames, contentTypes, accepts, returnType, null
); );
} }
/** /**
* Callback function to receive the result of the deleteBucketLocalAlias operation. * Delete a global alias
* @callback module:api/BucketApi~deleteBucketLocalAliasCallback * Delete a global alias from the target bucket
* @param {String} error Error message, if any. * @param {String} id
* @param {module:model/BucketInfo} data The data returned by the service call. * @param {String} alias
* @param {String} response The complete HTTP response. * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/BucketInfo}
*/ */
deleteBucketGlobalAlias(id, alias) {
return this.deleteBucketGlobalAliasWithHttpInfo(id, alias)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/** /**
* Delete a local alias * Delete a local alias
@ -227,10 +242,9 @@ export default class BucketApi {
* @param {String} id * @param {String} id
* @param {String} accessKeyId * @param {String} accessKeyId
* @param {String} alias * @param {String} alias
* @param {module:api/BucketApi~deleteBucketLocalAliasCallback} callback The callback function, accepting three arguments: error, data, response * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/BucketInfo} and HTTP response
* data is of type: {@link module:model/BucketInfo}
*/ */
deleteBucketLocalAlias(id, accessKeyId, alias, callback) { deleteBucketLocalAliasWithHttpInfo(id, accessKeyId, alias) {
let postBody = null; let postBody = null;
// verify the required parameter 'id' is set // verify the required parameter 'id' is set
if (id === undefined || id === null) { if (id === undefined || id === null) {
@ -264,26 +278,33 @@ export default class BucketApi {
return this.apiClient.callApi( return this.apiClient.callApi(
'/bucket/alias/local', 'DELETE', '/bucket/alias/local', 'DELETE',
pathParams, queryParams, headerParams, formParams, postBody, pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType, null, callback authNames, contentTypes, accepts, returnType, null
); );
} }
/** /**
* Callback function to receive the result of the denyBucketKey operation. * Delete a local alias
* @callback module:api/BucketApi~denyBucketKeyCallback * Delete a local alias, bound to specified account, from the target bucket
* @param {String} error Error message, if any. * @param {String} id
* @param {module:model/BucketInfo} data The data returned by the service call. * @param {String} accessKeyId
* @param {String} response The complete HTTP response. * @param {String} alias
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/BucketInfo}
*/ */
deleteBucketLocalAlias(id, accessKeyId, alias) {
return this.deleteBucketLocalAliasWithHttpInfo(id, accessKeyId, alias)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/** /**
* Deny key * 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. * **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.
* @param {module:model/AllowBucketKeyRequest} allowBucketKeyRequest Aliases to put on the new bucket * @param {module:model/AllowBucketKeyRequest} allowBucketKeyRequest Aliases to put on the new bucket
* @param {module:api/BucketApi~denyBucketKeyCallback} callback The callback function, accepting three arguments: error, data, response * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/BucketInfo} and HTTP response
* data is of type: {@link module:model/BucketInfo}
*/ */
denyBucketKey(allowBucketKeyRequest, callback) { denyBucketKeyWithHttpInfo(allowBucketKeyRequest) {
let postBody = allowBucketKeyRequest; let postBody = allowBucketKeyRequest;
// verify the required parameter 'allowBucketKeyRequest' is set // verify the required parameter 'allowBucketKeyRequest' is set
if (allowBucketKeyRequest === undefined || allowBucketKeyRequest === null) { if (allowBucketKeyRequest === undefined || allowBucketKeyRequest === null) {
@ -306,26 +327,31 @@ export default class BucketApi {
return this.apiClient.callApi( return this.apiClient.callApi(
'/bucket/deny', 'POST', '/bucket/deny', 'POST',
pathParams, queryParams, headerParams, formParams, postBody, pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType, null, callback authNames, contentTypes, accepts, returnType, null
); );
} }
/** /**
* Callback function to receive the result of the findBucketInfo operation. * Deny key
* @callback module:api/BucketApi~findBucketInfoCallback * **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.
* @param {String} error Error message, if any. * @param {module:model/AllowBucketKeyRequest} allowBucketKeyRequest Aliases to put on the new bucket
* @param {module:model/BucketInfo} data The data returned by the service call. * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/BucketInfo}
* @param {String} response The complete HTTP response.
*/ */
denyBucketKey(allowBucketKeyRequest) {
return this.denyBucketKeyWithHttpInfo(allowBucketKeyRequest)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/** /**
* Find a bucket * Find a bucket
* Find a bucket by its global alias * Find a bucket by its global alias
* @param {String} alias The exact global alias of one of the existing buckets * @param {String} alias The exact global alias of one of the existing buckets
* @param {module:api/BucketApi~findBucketInfoCallback} callback The callback function, accepting three arguments: error, data, response * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/BucketInfo} and HTTP response
* data is of type: {@link module:model/BucketInfo}
*/ */
findBucketInfo(alias, callback) { findBucketInfoWithHttpInfo(alias) {
let postBody = null; let postBody = null;
// verify the required parameter 'alias' is set // verify the required parameter 'alias' is set
if (alias === undefined || alias === null) { if (alias === undefined || alias === null) {
@ -349,26 +375,31 @@ export default class BucketApi {
return this.apiClient.callApi( return this.apiClient.callApi(
'/bucket?globalAlias={alias}', 'GET', '/bucket?globalAlias={alias}', 'GET',
pathParams, queryParams, headerParams, formParams, postBody, pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType, null, callback authNames, contentTypes, accepts, returnType, null
); );
} }
/** /**
* Callback function to receive the result of the getBucketInfo operation. * Find a bucket
* @callback module:api/BucketApi~getBucketInfoCallback * Find a bucket by its global alias
* @param {String} error Error message, if any. * @param {String} alias The exact global alias of one of the existing buckets
* @param {module:model/BucketInfo} data The data returned by the service call. * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/BucketInfo}
* @param {String} response The complete HTTP response.
*/ */
findBucketInfo(alias) {
return this.findBucketInfoWithHttpInfo(alias)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/** /**
* Get a bucket * 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). * 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).
* @param {String} bucketId The exact bucket identifier, a 32 bytes hexadecimal string * @param {String} bucketId The exact bucket identifier, a 32 bytes hexadecimal string
* @param {module:api/BucketApi~getBucketInfoCallback} callback The callback function, accepting three arguments: error, data, response * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/BucketInfo} and HTTP response
* data is of type: {@link module:model/BucketInfo}
*/ */
getBucketInfo(bucketId, callback) { getBucketInfoWithHttpInfo(bucketId) {
let postBody = null; let postBody = null;
// verify the required parameter 'bucketId' is set // verify the required parameter 'bucketId' is set
if (bucketId === undefined || bucketId === null) { if (bucketId === undefined || bucketId === null) {
@ -392,25 +423,30 @@ export default class BucketApi {
return this.apiClient.callApi( return this.apiClient.callApi(
'/bucket?id={bucket_id}', 'GET', '/bucket?id={bucket_id}', 'GET',
pathParams, queryParams, headerParams, formParams, postBody, pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType, null, callback authNames, contentTypes, accepts, returnType, null
); );
} }
/** /**
* Callback function to receive the result of the listBuckets operation. * Get a bucket
* @callback module:api/BucketApi~listBucketsCallback * 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).
* @param {String} error Error message, if any. * @param {String} bucketId The exact bucket identifier, a 32 bytes hexadecimal string
* @param {Array.<module:model/ListBuckets200ResponseInner>} data The data returned by the service call. * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/BucketInfo}
* @param {String} response The complete HTTP response.
*/ */
getBucketInfo(bucketId) {
return this.getBucketInfoWithHttpInfo(bucketId)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/** /**
* List all buckets * List all buckets
* List all the buckets on the cluster with their UUID and their global and local aliases. * List all the buckets on the cluster with their UUID and their global and local aliases.
* @param {module:api/BucketApi~listBucketsCallback} callback The callback function, accepting three arguments: error, data, response * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link Array.<module:model/ListBuckets200ResponseInner>} and HTTP response
* data is of type: {@link Array.<module:model/ListBuckets200ResponseInner>}
*/ */
listBuckets(callback) { listBucketsWithHttpInfo() {
let postBody = null; let postBody = null;
let pathParams = { let pathParams = {
@ -429,27 +465,31 @@ export default class BucketApi {
return this.apiClient.callApi( return this.apiClient.callApi(
'/bucket', 'GET', '/bucket', 'GET',
pathParams, queryParams, headerParams, formParams, postBody, pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType, null, callback authNames, contentTypes, accepts, returnType, null
); );
} }
/** /**
* Callback function to receive the result of the putBucketGlobalAlias operation. * List all buckets
* @callback module:api/BucketApi~putBucketGlobalAliasCallback * List all the buckets on the cluster with their UUID and their global and local aliases.
* @param {String} error Error message, if any. * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link Array.<module:model/ListBuckets200ResponseInner>}
* @param {module:model/BucketInfo} data The data returned by the service call.
* @param {String} response The complete HTTP response.
*/ */
listBuckets() {
return this.listBucketsWithHttpInfo()
.then(function(response_and_data) {
return response_and_data.data;
});
}
/** /**
* Add a global alias * Add a global alias
* Add a global alias to the target bucket * Add a global alias to the target bucket
* @param {String} id * @param {String} id
* @param {String} alias * @param {String} alias
* @param {module:api/BucketApi~putBucketGlobalAliasCallback} callback The callback function, accepting three arguments: error, data, response * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/BucketInfo} and HTTP response
* data is of type: {@link module:model/BucketInfo}
*/ */
putBucketGlobalAlias(id, alias, callback) { putBucketGlobalAliasWithHttpInfo(id, alias) {
let postBody = null; let postBody = null;
// verify the required parameter 'id' is set // verify the required parameter 'id' is set
if (id === undefined || id === null) { if (id === undefined || id === null) {
@ -478,17 +518,24 @@ export default class BucketApi {
return this.apiClient.callApi( return this.apiClient.callApi(
'/bucket/alias/global', 'PUT', '/bucket/alias/global', 'PUT',
pathParams, queryParams, headerParams, formParams, postBody, pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType, null, callback authNames, contentTypes, accepts, returnType, null
); );
} }
/** /**
* Callback function to receive the result of the putBucketLocalAlias operation. * Add a global alias
* @callback module:api/BucketApi~putBucketLocalAliasCallback * Add a global alias to the target bucket
* @param {String} error Error message, if any. * @param {String} id
* @param {module:model/BucketInfo} data The data returned by the service call. * @param {String} alias
* @param {String} response The complete HTTP response. * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/BucketInfo}
*/ */
putBucketGlobalAlias(id, alias) {
return this.putBucketGlobalAliasWithHttpInfo(id, alias)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/** /**
* Add a local alias * Add a local alias
@ -496,10 +543,9 @@ export default class BucketApi {
* @param {String} id * @param {String} id
* @param {String} accessKeyId * @param {String} accessKeyId
* @param {String} alias * @param {String} alias
* @param {module:api/BucketApi~putBucketLocalAliasCallback} callback The callback function, accepting three arguments: error, data, response * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/BucketInfo} and HTTP response
* data is of type: {@link module:model/BucketInfo}
*/ */
putBucketLocalAlias(id, accessKeyId, alias, callback) { putBucketLocalAliasWithHttpInfo(id, accessKeyId, alias) {
let postBody = null; let postBody = null;
// verify the required parameter 'id' is set // verify the required parameter 'id' is set
if (id === undefined || id === null) { if (id === undefined || id === null) {
@ -533,27 +579,34 @@ export default class BucketApi {
return this.apiClient.callApi( return this.apiClient.callApi(
'/bucket/alias/local', 'PUT', '/bucket/alias/local', 'PUT',
pathParams, queryParams, headerParams, formParams, postBody, pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType, null, callback authNames, contentTypes, accepts, returnType, null
); );
} }
/** /**
* Callback function to receive the result of the updateBucket operation. * Add a local alias
* @callback module:api/BucketApi~updateBucketCallback * Add a local alias, bound to specified account, to the target bucket
* @param {String} error Error message, if any. * @param {String} id
* @param {module:model/BucketInfo} data The data returned by the service call. * @param {String} accessKeyId
* @param {String} response The complete HTTP response. * @param {String} alias
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/BucketInfo}
*/ */
putBucketLocalAlias(id, accessKeyId, alias) {
return this.putBucketLocalAliasWithHttpInfo(id, accessKeyId, alias)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/** /**
* Update a bucket * 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. * 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.
* @param {String} bucketId The exact bucket identifier, a 32 bytes hexadecimal string * @param {String} bucketId The exact bucket identifier, a 32 bytes hexadecimal string
* @param {module:model/UpdateBucketRequest} updateBucketRequest Requested changes on the bucket. Both root fields are optionals. * @param {module:model/UpdateBucketRequest} updateBucketRequest Requested changes on the bucket. Both root fields are optionals.
* @param {module:api/BucketApi~updateBucketCallback} callback The callback function, accepting three arguments: error, data, response * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/BucketInfo} and HTTP response
* data is of type: {@link module:model/BucketInfo}
*/ */
updateBucket(bucketId, updateBucketRequest, callback) { updateBucketWithHttpInfo(bucketId, updateBucketRequest) {
let postBody = updateBucketRequest; let postBody = updateBucketRequest;
// verify the required parameter 'bucketId' is set // verify the required parameter 'bucketId' is set
if (bucketId === undefined || bucketId === null) { if (bucketId === undefined || bucketId === null) {
@ -581,9 +634,23 @@ export default class BucketApi {
return this.apiClient.callApi( return this.apiClient.callApi(
'/bucket?id={bucket_id}', 'PUT', '/bucket?id={bucket_id}', 'PUT',
pathParams, queryParams, headerParams, formParams, postBody, pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType, null, callback authNames, contentTypes, accepts, returnType, null
); );
} }
/**
* 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.
* @param {String} bucketId The exact bucket identifier, a 32 bytes hexadecimal string
* @param {module:model/UpdateBucketRequest} updateBucketRequest Requested changes on the bucket. Both root fields are optionals.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/BucketInfo}
*/
updateBucket(bucketId, updateBucketRequest) {
return this.updateBucketWithHttpInfo(bucketId, updateBucketRequest)
.then(function(response_and_data) {
return response_and_data.data;
});
}
} }

View File

@ -38,22 +38,14 @@ export default class KeyApi {
} }
/**
* Callback function to receive the result of the addKey operation.
* @callback module:api/KeyApi~addKeyCallback
* @param {String} error Error message, if any.
* @param {module:model/KeyInfo} data The data returned by the service call.
* @param {String} response The complete HTTP response.
*/
/** /**
* Create a new API key * Create a new API key
* Creates a new API access key. * Creates a new API access key.
* @param {module:model/AddKeyRequest} addKeyRequest \"You can set a friendly name for this key, send an empty string instead\" * @param {module:model/AddKeyRequest} addKeyRequest \"You can set a friendly name for this key, send an empty string instead\"
* @param {module:api/KeyApi~addKeyCallback} callback The callback function, accepting three arguments: error, data, response * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/KeyInfo} and HTTP response
* data is of type: {@link module:model/KeyInfo}
*/ */
addKey(addKeyRequest, callback) { addKeyWithHttpInfo(addKeyRequest) {
let postBody = addKeyRequest; let postBody = addKeyRequest;
// verify the required parameter 'addKeyRequest' is set // verify the required parameter 'addKeyRequest' is set
if (addKeyRequest === undefined || addKeyRequest === null) { if (addKeyRequest === undefined || addKeyRequest === null) {
@ -76,25 +68,31 @@ export default class KeyApi {
return this.apiClient.callApi( return this.apiClient.callApi(
'/key', 'POST', '/key', 'POST',
pathParams, queryParams, headerParams, formParams, postBody, pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType, null, callback authNames, contentTypes, accepts, returnType, null
); );
} }
/** /**
* Callback function to receive the result of the deleteKey operation. * Create a new API key
* @callback module:api/KeyApi~deleteKeyCallback * Creates a new API access key.
* @param {String} error Error message, if any. * @param {module:model/AddKeyRequest} addKeyRequest \"You can set a friendly name for this key, send an empty string instead\"
* @param data This operation does not return a value. * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/KeyInfo}
* @param {String} response The complete HTTP response.
*/ */
addKey(addKeyRequest) {
return this.addKeyWithHttpInfo(addKeyRequest)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/** /**
* Delete a key * Delete a key
* Delete a key from the cluster. Its access will be removed from all the buckets. Buckets are not automatically deleted and can be dangling. You should manually delete them before. * Delete a key from the cluster. Its access will be removed from all the buckets. Buckets are not automatically deleted and can be dangling. You should manually delete them before.
* @param {String} accessKey The exact API access key generated by Garage * @param {String} accessKey The exact API access key generated by Garage
* @param {module:api/KeyApi~deleteKeyCallback} callback The callback function, accepting three arguments: error, data, response * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing HTTP response
*/ */
deleteKey(accessKey, callback) { deleteKeyWithHttpInfo(accessKey) {
let postBody = null; let postBody = null;
// verify the required parameter 'accessKey' is set // verify the required parameter 'accessKey' is set
if (accessKey === undefined || accessKey === null) { if (accessKey === undefined || accessKey === null) {
@ -118,26 +116,31 @@ export default class KeyApi {
return this.apiClient.callApi( return this.apiClient.callApi(
'/key?id={access_key}', 'DELETE', '/key?id={access_key}', 'DELETE',
pathParams, queryParams, headerParams, formParams, postBody, pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType, null, callback authNames, contentTypes, accepts, returnType, null
); );
} }
/** /**
* Callback function to receive the result of the getKey operation. * Delete a key
* @callback module:api/KeyApi~getKeyCallback * Delete a key from the cluster. Its access will be removed from all the buckets. Buckets are not automatically deleted and can be dangling. You should manually delete them before.
* @param {String} error Error message, if any. * @param {String} accessKey The exact API access key generated by Garage
* @param {module:model/KeyInfo} data The data returned by the service call. * @return {Promise} a {@link https://www.promisejs.org/|Promise}
* @param {String} response The complete HTTP response.
*/ */
deleteKey(accessKey) {
return this.deleteKeyWithHttpInfo(accessKey)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/** /**
* Get key information * Get key information
* Return information about a specific key and return its information * Return information about a specific key and return its information
* @param {String} accessKey The exact API access key generated by Garage * @param {String} accessKey The exact API access key generated by Garage
* @param {module:api/KeyApi~getKeyCallback} callback The callback function, accepting three arguments: error, data, response * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/KeyInfo} and HTTP response
* data is of type: {@link module:model/KeyInfo}
*/ */
getKey(accessKey, callback) { getKeyWithHttpInfo(accessKey) {
let postBody = null; let postBody = null;
// verify the required parameter 'accessKey' is set // verify the required parameter 'accessKey' is set
if (accessKey === undefined || accessKey === null) { if (accessKey === undefined || accessKey === null) {
@ -161,26 +164,31 @@ export default class KeyApi {
return this.apiClient.callApi( return this.apiClient.callApi(
'/key?id={access_key}', 'GET', '/key?id={access_key}', 'GET',
pathParams, queryParams, headerParams, formParams, postBody, pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType, null, callback authNames, contentTypes, accepts, returnType, null
); );
} }
/** /**
* Callback function to receive the result of the importKey operation. * Get key information
* @callback module:api/KeyApi~importKeyCallback * Return information about a specific key and return its information
* @param {String} error Error message, if any. * @param {String} accessKey The exact API access key generated by Garage
* @param {module:model/KeyInfo} data The data returned by the service call. * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/KeyInfo}
* @param {String} response The complete HTTP response.
*/ */
getKey(accessKey) {
return this.getKeyWithHttpInfo(accessKey)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/** /**
* Import an existing key * Import an existing key
* Imports an existing API key. This feature must only be used for migrations and backup restore. **Do not use it to generate custom key identifiers or you will break your Garage cluster.** * Imports an existing API key. This feature must only be used for migrations and backup restore. **Do not use it to generate custom key identifiers or you will break your Garage cluster.**
* @param {module:model/ImportKeyRequest} importKeyRequest Information on the key to import * @param {module:model/ImportKeyRequest} importKeyRequest Information on the key to import
* @param {module:api/KeyApi~importKeyCallback} callback The callback function, accepting three arguments: error, data, response * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/KeyInfo} and HTTP response
* data is of type: {@link module:model/KeyInfo}
*/ */
importKey(importKeyRequest, callback) { importKeyWithHttpInfo(importKeyRequest) {
let postBody = importKeyRequest; let postBody = importKeyRequest;
// verify the required parameter 'importKeyRequest' is set // verify the required parameter 'importKeyRequest' is set
if (importKeyRequest === undefined || importKeyRequest === null) { if (importKeyRequest === undefined || importKeyRequest === null) {
@ -203,25 +211,30 @@ export default class KeyApi {
return this.apiClient.callApi( return this.apiClient.callApi(
'/key/import', 'POST', '/key/import', 'POST',
pathParams, queryParams, headerParams, formParams, postBody, pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType, null, callback authNames, contentTypes, accepts, returnType, null
); );
} }
/** /**
* Callback function to receive the result of the listKeys operation. * Import an existing key
* @callback module:api/KeyApi~listKeysCallback * Imports an existing API key. This feature must only be used for migrations and backup restore. **Do not use it to generate custom key identifiers or you will break your Garage cluster.**
* @param {String} error Error message, if any. * @param {module:model/ImportKeyRequest} importKeyRequest Information on the key to import
* @param {Array.<module:model/ListKeys200ResponseInner>} data The data returned by the service call. * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/KeyInfo}
* @param {String} response The complete HTTP response.
*/ */
importKey(importKeyRequest) {
return this.importKeyWithHttpInfo(importKeyRequest)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/** /**
* List all keys * List all keys
* Returns all API access keys in the cluster. * Returns all API access keys in the cluster.
* @param {module:api/KeyApi~listKeysCallback} callback The callback function, accepting three arguments: error, data, response * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link Array.<module:model/ListKeys200ResponseInner>} and HTTP response
* data is of type: {@link Array.<module:model/ListKeys200ResponseInner>}
*/ */
listKeys(callback) { listKeysWithHttpInfo() {
let postBody = null; let postBody = null;
let pathParams = { let pathParams = {
@ -240,26 +253,30 @@ export default class KeyApi {
return this.apiClient.callApi( return this.apiClient.callApi(
'/key', 'GET', '/key', 'GET',
pathParams, queryParams, headerParams, formParams, postBody, pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType, null, callback authNames, contentTypes, accepts, returnType, null
); );
} }
/** /**
* Callback function to receive the result of the searchKey operation. * List all keys
* @callback module:api/KeyApi~searchKeyCallback * Returns all API access keys in the cluster.
* @param {String} error Error message, if any. * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link Array.<module:model/ListKeys200ResponseInner>}
* @param {module:model/KeyInfo} data The data returned by the service call.
* @param {String} response The complete HTTP response.
*/ */
listKeys() {
return this.listKeysWithHttpInfo()
.then(function(response_and_data) {
return response_and_data.data;
});
}
/** /**
* Select key by pattern * Select key by pattern
* Find the first key matching the given pattern based on its identifier aor friendly name and return its information. * Find the first key matching the given pattern based on its identifier aor friendly name and return its information.
* @param {String} pattern A pattern (beginning or full string) corresponding to a key identifier or friendly name * @param {String} pattern A pattern (beginning or full string) corresponding to a key identifier or friendly name
* @param {module:api/KeyApi~searchKeyCallback} callback The callback function, accepting three arguments: error, data, response * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/KeyInfo} and HTTP response
* data is of type: {@link module:model/KeyInfo}
*/ */
searchKey(pattern, callback) { searchKeyWithHttpInfo(pattern) {
let postBody = null; let postBody = null;
// verify the required parameter 'pattern' is set // verify the required parameter 'pattern' is set
if (pattern === undefined || pattern === null) { if (pattern === undefined || pattern === null) {
@ -283,27 +300,32 @@ export default class KeyApi {
return this.apiClient.callApi( return this.apiClient.callApi(
'/key?search={pattern}', 'GET', '/key?search={pattern}', 'GET',
pathParams, queryParams, headerParams, formParams, postBody, pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType, null, callback authNames, contentTypes, accepts, returnType, null
); );
} }
/** /**
* Callback function to receive the result of the updateKey operation. * Select key by pattern
* @callback module:api/KeyApi~updateKeyCallback * Find the first key matching the given pattern based on its identifier aor friendly name and return its information.
* @param {String} error Error message, if any. * @param {String} pattern A pattern (beginning or full string) corresponding to a key identifier or friendly name
* @param {module:model/KeyInfo} data The data returned by the service call. * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/KeyInfo}
* @param {String} response The complete HTTP response.
*/ */
searchKey(pattern) {
return this.searchKeyWithHttpInfo(pattern)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/** /**
* Update a key * Update a key
* Updates information about the specified API access key. * Updates information about the specified API access key.
* @param {String} accessKey The exact API access key generated by Garage * @param {String} accessKey The exact API access key generated by Garage
* @param {module:model/UpdateKeyRequest} updateKeyRequest For a given key, provide a first set with the permissions to grant, and a second set with the permissions to remove * @param {module:model/UpdateKeyRequest} updateKeyRequest For a given key, provide a first set with the permissions to grant, and a second set with the permissions to remove
* @param {module:api/KeyApi~updateKeyCallback} callback The callback function, accepting three arguments: error, data, response * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/KeyInfo} and HTTP response
* data is of type: {@link module:model/KeyInfo}
*/ */
updateKey(accessKey, updateKeyRequest, callback) { updateKeyWithHttpInfo(accessKey, updateKeyRequest) {
let postBody = updateKeyRequest; let postBody = updateKeyRequest;
// verify the required parameter 'accessKey' is set // verify the required parameter 'accessKey' is set
if (accessKey === undefined || accessKey === null) { if (accessKey === undefined || accessKey === null) {
@ -331,9 +353,23 @@ export default class KeyApi {
return this.apiClient.callApi( return this.apiClient.callApi(
'/key?id={access_key}', 'POST', '/key?id={access_key}', 'POST',
pathParams, queryParams, headerParams, formParams, postBody, pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType, null, callback authNames, contentTypes, accepts, returnType, null
); );
} }
/**
* Update a key
* Updates information about the specified API access key.
* @param {String} accessKey The exact API access key generated by Garage
* @param {module:model/UpdateKeyRequest} updateKeyRequest For a given key, provide a first set with the permissions to grant, and a second set with the permissions to remove
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/KeyInfo}
*/
updateKey(accessKey, updateKeyRequest) {
return this.updateKeyWithHttpInfo(accessKey, updateKeyRequest)
.then(function(response_and_data) {
return response_and_data.data;
});
}
} }

View File

@ -36,21 +36,14 @@ export default class LayoutApi {
} }
/**
* Callback function to receive the result of the addLayout operation.
* @callback module:api/LayoutApi~addLayoutCallback
* @param {String} error Error message, if any.
* @param data This operation does not return a value.
* @param {String} response The complete HTTP response.
*/
/** /**
* Send modifications to the cluster layout * Send modifications to the cluster layout
* Send modifications to the cluster layout. These modifications will be included in the staged role changes, visible in subsequent calls of `GET /layout`. Once the set of staged changes is satisfactory, the user may call `POST /layout/apply` to apply the changed changes, or `POST /layout/revert` to clear all of the staged changes in the layout. Note that setting the capacity to `null` will configure the node as a gateway. * Send modifications to the cluster layout. These modifications will be included in the staged role changes, visible in subsequent calls of `GET /layout`. Once the set of staged changes is satisfactory, the user may call `POST /layout/apply` to apply the changed changes, or `POST /layout/revert` to clear all of the staged changes in the layout. Note that setting the capacity to `null` will configure the node as a gateway.
* @param {Object.<String, module:model/{String: NodeClusterInfo}>} requestBody To add a new node to the layout or to change the configuration of an existing node, simply set the values you want. To remove a node, set it to `null` instead of passing a configuration object. Contrary to the CLI that may update only a subset of the fields capacity, zone and tags, when calling this API all of these values must be specified. * @param {Object.<String, module:model/{String: NodeClusterInfo}>} requestBody To add a new node to the layout or to change the configuration of an existing node, simply set the values you want. To remove a node, set it to `null` instead of passing a configuration object. Contrary to the CLI that may update only a subset of the fields capacity, zone and tags, when calling this API all of these values must be specified.
* @param {module:api/LayoutApi~addLayoutCallback} callback The callback function, accepting three arguments: error, data, response * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing HTTP response
*/ */
addLayout(requestBody, callback) { addLayoutWithHttpInfo(requestBody) {
let postBody = requestBody; let postBody = requestBody;
// verify the required parameter 'requestBody' is set // verify the required parameter 'requestBody' is set
if (requestBody === undefined || requestBody === null) { if (requestBody === undefined || requestBody === null) {
@ -73,25 +66,31 @@ export default class LayoutApi {
return this.apiClient.callApi( return this.apiClient.callApi(
'/layout', 'POST', '/layout', 'POST',
pathParams, queryParams, headerParams, formParams, postBody, pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType, null, callback authNames, contentTypes, accepts, returnType, null
); );
} }
/** /**
* Callback function to receive the result of the applyLayout operation. * Send modifications to the cluster layout
* @callback module:api/LayoutApi~applyLayoutCallback * Send modifications to the cluster layout. These modifications will be included in the staged role changes, visible in subsequent calls of `GET /layout`. Once the set of staged changes is satisfactory, the user may call `POST /layout/apply` to apply the changed changes, or `POST /layout/revert` to clear all of the staged changes in the layout. Note that setting the capacity to `null` will configure the node as a gateway.
* @param {String} error Error message, if any. * @param {Object.<String, module:model/{String: NodeClusterInfo}>} requestBody To add a new node to the layout or to change the configuration of an existing node, simply set the values you want. To remove a node, set it to `null` instead of passing a configuration object. Contrary to the CLI that may update only a subset of the fields capacity, zone and tags, when calling this API all of these values must be specified.
* @param data This operation does not return a value. * @return {Promise} a {@link https://www.promisejs.org/|Promise}
* @param {String} response The complete HTTP response.
*/ */
addLayout(requestBody) {
return this.addLayoutWithHttpInfo(requestBody)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/** /**
* Apply staged layout * Apply staged layout
* Applies to the cluster the layout changes currently registered as staged layout changes. * Applies to the cluster the layout changes currently registered as staged layout changes.
* @param {module:model/LayoutVersion} layoutVersion Similarly to the CLI, the body must include the version of the new layout that will be created, which MUST be 1 + the value of the currently existing layout in the cluster. * @param {module:model/LayoutVersion} layoutVersion Similarly to the CLI, the body must include the version of the new layout that will be created, which MUST be 1 + the value of the currently existing layout in the cluster.
* @param {module:api/LayoutApi~applyLayoutCallback} callback The callback function, accepting three arguments: error, data, response * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing HTTP response
*/ */
applyLayout(layoutVersion, callback) { applyLayoutWithHttpInfo(layoutVersion) {
let postBody = layoutVersion; let postBody = layoutVersion;
// verify the required parameter 'layoutVersion' is set // verify the required parameter 'layoutVersion' is set
if (layoutVersion === undefined || layoutVersion === null) { if (layoutVersion === undefined || layoutVersion === null) {
@ -114,25 +113,30 @@ export default class LayoutApi {
return this.apiClient.callApi( return this.apiClient.callApi(
'/layout/apply', 'POST', '/layout/apply', 'POST',
pathParams, queryParams, headerParams, formParams, postBody, pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType, null, callback authNames, contentTypes, accepts, returnType, null
); );
} }
/** /**
* Callback function to receive the result of the getLayout operation. * Apply staged layout
* @callback module:api/LayoutApi~getLayoutCallback * Applies to the cluster the layout changes currently registered as staged layout changes.
* @param {String} error Error message, if any. * @param {module:model/LayoutVersion} layoutVersion Similarly to the CLI, the body must include the version of the new layout that will be created, which MUST be 1 + the value of the currently existing layout in the cluster.
* @param {module:model/ClusterLayout} data The data returned by the service call. * @return {Promise} a {@link https://www.promisejs.org/|Promise}
* @param {String} response The complete HTTP response.
*/ */
applyLayout(layoutVersion) {
return this.applyLayoutWithHttpInfo(layoutVersion)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/** /**
* Details on the current and staged layout * Details on the current and staged layout
* Returns the cluster's current layout, including: - Currently configured cluster layout - Staged changes to the cluster layout *The info returned by this endpoint is a subset of the info returned by `GET /status`.* * Returns the cluster's current layout, including: - Currently configured cluster layout - Staged changes to the cluster layout *The info returned by this endpoint is a subset of the info returned by `GET /status`.*
* @param {module:api/LayoutApi~getLayoutCallback} callback The callback function, accepting three arguments: error, data, response * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/ClusterLayout} and HTTP response
* data is of type: {@link module:model/ClusterLayout}
*/ */
getLayout(callback) { getLayoutWithHttpInfo() {
let postBody = null; let postBody = null;
let pathParams = { let pathParams = {
@ -151,25 +155,30 @@ export default class LayoutApi {
return this.apiClient.callApi( return this.apiClient.callApi(
'/layout', 'GET', '/layout', 'GET',
pathParams, queryParams, headerParams, formParams, postBody, pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType, null, callback authNames, contentTypes, accepts, returnType, null
); );
} }
/** /**
* Callback function to receive the result of the revertLayout operation. * Details on the current and staged layout
* @callback module:api/LayoutApi~revertLayoutCallback * Returns the cluster's current layout, including: - Currently configured cluster layout - Staged changes to the cluster layout *The info returned by this endpoint is a subset of the info returned by `GET /status`.*
* @param {String} error Error message, if any. * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/ClusterLayout}
* @param data This operation does not return a value.
* @param {String} response The complete HTTP response.
*/ */
getLayout() {
return this.getLayoutWithHttpInfo()
.then(function(response_and_data) {
return response_and_data.data;
});
}
/** /**
* Clear staged layout * Clear staged layout
* Clears all of the staged layout changes. * Clears all of the staged layout changes.
* @param {module:model/LayoutVersion} layoutVersion Reverting the staged changes is done by incrementing the version number and clearing the contents of the staged change list. Similarly to the CLI, the body must include the incremented version number, which MUST be 1 + the value of the currently existing layout in the cluster. * @param {module:model/LayoutVersion} layoutVersion Reverting the staged changes is done by incrementing the version number and clearing the contents of the staged change list. Similarly to the CLI, the body must include the incremented version number, which MUST be 1 + the value of the currently existing layout in the cluster.
* @param {module:api/LayoutApi~revertLayoutCallback} callback The callback function, accepting three arguments: error, data, response * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing HTTP response
*/ */
revertLayout(layoutVersion, callback) { revertLayoutWithHttpInfo(layoutVersion) {
let postBody = layoutVersion; let postBody = layoutVersion;
// verify the required parameter 'layoutVersion' is set // verify the required parameter 'layoutVersion' is set
if (layoutVersion === undefined || layoutVersion === null) { if (layoutVersion === undefined || layoutVersion === null) {
@ -192,9 +201,22 @@ export default class LayoutApi {
return this.apiClient.callApi( return this.apiClient.callApi(
'/layout/revert', 'POST', '/layout/revert', 'POST',
pathParams, queryParams, headerParams, formParams, postBody, pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType, null, callback authNames, contentTypes, accepts, returnType, null
); );
} }
/**
* Clear staged layout
* Clears all of the staged layout changes.
* @param {module:model/LayoutVersion} layoutVersion Reverting the staged changes is done by incrementing the version number and clearing the contents of the staged change list. Similarly to the CLI, the body must include the incremented version number, which MUST be 1 + the value of the currently existing layout in the cluster.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}
*/
revertLayout(layoutVersion) {
return this.revertLayoutWithHttpInfo(layoutVersion)
.then(function(response_and_data) {
return response_and_data.data;
});
}
} }

View File

@ -35,22 +35,14 @@ export default class NodesApi {
} }
/**
* Callback function to receive the result of the addNode operation.
* @callback module:api/NodesApi~addNodeCallback
* @param {String} error Error message, if any.
* @param {Array.<module:model/AddNode200ResponseInner>} data The data returned by the service call.
* @param {String} response The complete HTTP response.
*/
/** /**
* Connect target node to other Garage nodes * Connect target node to other Garage nodes
* Instructs this Garage node to connect to other Garage nodes at specified `<node_id>@<net_address>`. `node_id` is generated automatically on node start. * Instructs this Garage node to connect to other Garage nodes at specified `<node_id>@<net_address>`. `node_id` is generated automatically on node start.
* @param {Array.<String>} requestBody * @param {Array.<String>} requestBody
* @param {module:api/NodesApi~addNodeCallback} callback The callback function, accepting three arguments: error, data, response * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link Array.<module:model/AddNode200ResponseInner>} and HTTP response
* data is of type: {@link Array.<module:model/AddNode200ResponseInner>}
*/ */
addNode(requestBody, callback) { addNodeWithHttpInfo(requestBody) {
let postBody = requestBody; let postBody = requestBody;
// verify the required parameter 'requestBody' is set // verify the required parameter 'requestBody' is set
if (requestBody === undefined || requestBody === null) { if (requestBody === undefined || requestBody === null) {
@ -73,25 +65,30 @@ export default class NodesApi {
return this.apiClient.callApi( return this.apiClient.callApi(
'/connect', 'POST', '/connect', 'POST',
pathParams, queryParams, headerParams, formParams, postBody, pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType, null, callback authNames, contentTypes, accepts, returnType, null
); );
} }
/** /**
* Callback function to receive the result of the getNodes operation. * Connect target node to other Garage nodes
* @callback module:api/NodesApi~getNodesCallback * Instructs this Garage node to connect to other Garage nodes at specified `<node_id>@<net_address>`. `node_id` is generated automatically on node start.
* @param {String} error Error message, if any. * @param {Array.<String>} requestBody
* @param {module:model/GetNodes200Response} data The data returned by the service call. * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link Array.<module:model/AddNode200ResponseInner>}
* @param {String} response The complete HTTP response.
*/ */
addNode(requestBody) {
return this.addNodeWithHttpInfo(requestBody)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/** /**
* Status of this node and other nodes in the cluster * Status of this node and other nodes in the cluster
* Returns the cluster's current status, including: - ID of the node being queried and its version of the Garage daemon - Live nodes - Currently configured cluster layout - Staged changes to the cluster layout * Returns the cluster's current status, including: - ID of the node being queried and its version of the Garage daemon - Live nodes - Currently configured cluster layout - Staged changes to the cluster layout
* @param {module:api/NodesApi~getNodesCallback} callback The callback function, accepting three arguments: error, data, response * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/GetNodes200Response} and HTTP response
* data is of type: {@link module:model/GetNodes200Response}
*/ */
getNodes(callback) { getNodesWithHttpInfo() {
let postBody = null; let postBody = null;
let pathParams = { let pathParams = {
@ -110,9 +107,21 @@ export default class NodesApi {
return this.apiClient.callApi( return this.apiClient.callApi(
'/status', 'GET', '/status', 'GET',
pathParams, queryParams, headerParams, formParams, postBody, pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType, null, callback authNames, contentTypes, accepts, returnType, null
); );
} }
/**
* Status of this node and other nodes in the cluster
* Returns the cluster's current status, including: - ID of the node being queried and its version of the Garage daemon - Live nodes - Currently configured cluster layout - Staged changes to the cluster layout
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/GetNodes200Response}
*/
getNodes() {
return this.getNodesWithHttpInfo()
.then(function(response_and_data) {
return response_and_data.data;
});
}
} }