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
.gitignore
.openapi-generator-ignore
.travis.yml
README.md
docs/AddKeyRequest.md
@ -76,37 +75,3 @@ src/model/UpdateBucketRequestWebsiteAccess.js
src/model/UpdateKeyRequest.js
src/model/UpdateKeyRequestAllow.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 allowBucketKeyRequest = new garage.AllowBucketKeyRequest(); // {AllowBucketKeyRequest} Aliases to put on the new bucket
var callback = function(error, data, response) {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
};
api.allowBucketKey(allowBucketKeyRequest, callback);
api.allowBucketKey(allowBucketKeyRequest).then(function(data) {
console.log('API called successfully. Returned data: ' + data);
}, function(error) {
console.error(error);
});
```

View File

@ -38,13 +38,12 @@ 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, (error, data, response) => {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
apiInstance.allowBucketKey(allowBucketKeyRequest).then((data) => {
console.log('API called successfully. Returned data: ' + data);
}, (error) => {
console.error(error);
});
```
### Parameters
@ -87,13 +86,12 @@ 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, (error, data, response) => {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
apiInstance.createBucket(createBucketRequest).then((data) => {
console.log('API called successfully. Returned data: ' + data);
}, (error) => {
console.error(error);
});
```
### Parameters
@ -136,13 +134,12 @@ 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, (error, data, response) => {
if (error) {
console.error(error);
} else {
console.log('API called successfully.');
}
apiInstance.deleteBucket(bucketId).then(() => {
console.log('API called successfully.');
}, (error) => {
console.error(error);
});
```
### Parameters
@ -186,13 +183,12 @@ bearerAuth.accessToken = "YOUR ACCESS TOKEN"
let apiInstance = new garage.BucketApi();
let id = e6a14cd6a27f48684579ec6b381c078ab11697e6bc8513b72b2f5307e25fff9b; // String |
let alias = my_documents; // String |
apiInstance.deleteBucketGlobalAlias(id, alias, (error, data, response) => {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
apiInstance.deleteBucketGlobalAlias(id, alias).then((data) => {
console.log('API called successfully. Returned data: ' + data);
}, (error) => {
console.error(error);
});
```
### Parameters
@ -238,13 +234,12 @@ let apiInstance = new garage.BucketApi();
let id = e6a14cd6a27f48684579ec6b381c078ab11697e6bc8513b72b2f5307e25fff9b; // String |
let accessKeyId = GK31c2f218a2e44f485b94239e; // String |
let alias = my_documents; // String |
apiInstance.deleteBucketLocalAlias(id, accessKeyId, alias, (error, data, response) => {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
apiInstance.deleteBucketLocalAlias(id, accessKeyId, alias).then((data) => {
console.log('API called successfully. Returned data: ' + data);
}, (error) => {
console.error(error);
});
```
### Parameters
@ -289,13 +284,12 @@ 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, (error, data, response) => {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
apiInstance.denyBucketKey(allowBucketKeyRequest).then((data) => {
console.log('API called successfully. Returned data: ' + data);
}, (error) => {
console.error(error);
});
```
### Parameters
@ -338,13 +332,12 @@ 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, (error, data, response) => {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
apiInstance.findBucketInfo(alias).then((data) => {
console.log('API called successfully. Returned data: ' + data);
}, (error) => {
console.error(error);
});
```
### Parameters
@ -387,13 +380,12 @@ 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, (error, data, response) => {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
apiInstance.getBucketInfo(bucketId).then((data) => {
console.log('API called successfully. Returned data: ' + data);
}, (error) => {
console.error(error);
});
```
### Parameters
@ -435,13 +427,12 @@ let bearerAuth = defaultClient.authentications['bearerAuth'];
bearerAuth.accessToken = "YOUR ACCESS TOKEN"
let apiInstance = new garage.BucketApi();
apiInstance.listBuckets((error, data, response) => {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
apiInstance.listBuckets().then((data) => {
console.log('API called successfully. Returned data: ' + data);
}, (error) => {
console.error(error);
});
```
### Parameters
@ -482,13 +473,12 @@ bearerAuth.accessToken = "YOUR ACCESS TOKEN"
let apiInstance = new garage.BucketApi();
let id = e6a14cd6a27f48684579ec6b381c078ab11697e6bc8513b72b2f5307e25fff9b; // String |
let alias = my_documents; // String |
apiInstance.putBucketGlobalAlias(id, alias, (error, data, response) => {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
apiInstance.putBucketGlobalAlias(id, alias).then((data) => {
console.log('API called successfully. Returned data: ' + data);
}, (error) => {
console.error(error);
});
```
### Parameters
@ -534,13 +524,12 @@ let apiInstance = new garage.BucketApi();
let id = e6a14cd6a27f48684579ec6b381c078ab11697e6bc8513b72b2f5307e25fff9b; // String |
let accessKeyId = GK31c2f218a2e44f485b94239e; // String |
let alias = my_documents; // String |
apiInstance.putBucketLocalAlias(id, accessKeyId, alias, (error, data, response) => {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
apiInstance.putBucketLocalAlias(id, accessKeyId, alias).then((data) => {
console.log('API called successfully. Returned data: ' + data);
}, (error) => {
console.error(error);
});
```
### Parameters
@ -586,13 +575,12 @@ 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, (error, data, response) => {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
apiInstance.updateBucket(bucketId, updateBucketRequest).then((data) => {
console.log('API called successfully. Returned data: ' + data);
}, (error) => {
console.error(error);
});
```
### Parameters

View File

@ -33,13 +33,12 @@ bearerAuth.accessToken = "YOUR ACCESS TOKEN"
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\"
apiInstance.addKey(addKeyRequest, (error, data, response) => {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
apiInstance.addKey(addKeyRequest).then((data) => {
console.log('API called successfully. Returned data: ' + data);
}, (error) => {
console.error(error);
});
```
### Parameters
@ -82,13 +81,12 @@ bearerAuth.accessToken = "YOUR ACCESS TOKEN"
let apiInstance = new garage.KeyApi();
let accessKey = GK31c2f218a2e44f485b94239e; // String | The exact API access key generated by Garage
apiInstance.deleteKey(accessKey, (error, data, response) => {
if (error) {
console.error(error);
} else {
console.log('API called successfully.');
}
apiInstance.deleteKey(accessKey).then(() => {
console.log('API called successfully.');
}, (error) => {
console.error(error);
});
```
### Parameters
@ -131,13 +129,12 @@ bearerAuth.accessToken = "YOUR ACCESS TOKEN"
let apiInstance = new garage.KeyApi();
let accessKey = GK31c2f218a2e44f485b94239e; // String | The exact API access key generated by Garage
apiInstance.getKey(accessKey, (error, data, response) => {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
apiInstance.getKey(accessKey).then((data) => {
console.log('API called successfully. Returned data: ' + data);
}, (error) => {
console.error(error);
});
```
### Parameters
@ -180,13 +177,12 @@ bearerAuth.accessToken = "YOUR ACCESS TOKEN"
let apiInstance = new garage.KeyApi();
let importKeyRequest = new garage.ImportKeyRequest(); // ImportKeyRequest | Information on the key to import
apiInstance.importKey(importKeyRequest, (error, data, response) => {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
apiInstance.importKey(importKeyRequest).then((data) => {
console.log('API called successfully. Returned data: ' + data);
}, (error) => {
console.error(error);
});
```
### Parameters
@ -228,13 +224,12 @@ let bearerAuth = defaultClient.authentications['bearerAuth'];
bearerAuth.accessToken = "YOUR ACCESS TOKEN"
let apiInstance = new garage.KeyApi();
apiInstance.listKeys((error, data, response) => {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
apiInstance.listKeys().then((data) => {
console.log('API called successfully. Returned data: ' + data);
}, (error) => {
console.error(error);
});
```
### Parameters
@ -274,13 +269,12 @@ bearerAuth.accessToken = "YOUR ACCESS TOKEN"
let apiInstance = new garage.KeyApi();
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) => {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
apiInstance.searchKey(pattern).then((data) => {
console.log('API called successfully. Returned data: ' + data);
}, (error) => {
console.error(error);
});
```
### Parameters
@ -324,13 +318,12 @@ bearerAuth.accessToken = "YOUR ACCESS TOKEN"
let apiInstance = new garage.KeyApi();
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
apiInstance.updateKey(accessKey, updateKeyRequest, (error, data, response) => {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
apiInstance.updateKey(accessKey, updateKeyRequest).then((data) => {
console.log('API called successfully. Returned data: ' + data);
}, (error) => {
console.error(error);
});
```
### Parameters

View File

@ -30,13 +30,12 @@ bearerAuth.accessToken = "YOUR ACCESS TOKEN"
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.
apiInstance.addLayout(requestBody, (error, data, response) => {
if (error) {
console.error(error);
} else {
console.log('API called successfully.');
}
apiInstance.addLayout(requestBody).then(() => {
console.log('API called successfully.');
}, (error) => {
console.error(error);
});
```
### Parameters
@ -79,13 +78,12 @@ bearerAuth.accessToken = "YOUR ACCESS TOKEN"
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.
apiInstance.applyLayout(layoutVersion, (error, data, response) => {
if (error) {
console.error(error);
} else {
console.log('API called successfully.');
}
apiInstance.applyLayout(layoutVersion).then(() => {
console.log('API called successfully.');
}, (error) => {
console.error(error);
});
```
### Parameters
@ -127,13 +125,12 @@ let bearerAuth = defaultClient.authentications['bearerAuth'];
bearerAuth.accessToken = "YOUR ACCESS TOKEN"
let apiInstance = new garage.LayoutApi();
apiInstance.getLayout((error, data, response) => {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
apiInstance.getLayout().then((data) => {
console.log('API called successfully. Returned data: ' + data);
}, (error) => {
console.error(error);
});
```
### Parameters
@ -173,13 +170,12 @@ bearerAuth.accessToken = "YOUR ACCESS TOKEN"
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.
apiInstance.revertLayout(layoutVersion, (error, data, response) => {
if (error) {
console.error(error);
} else {
console.log('API called successfully.');
}
apiInstance.revertLayout(layoutVersion).then(() => {
console.log('API called successfully.');
}, (error) => {
console.error(error);
});
```
### Parameters

View File

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

View File

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

View File

@ -368,13 +368,6 @@ class ApiClient {
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.
@ -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
* constructor for a complex type.
* @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 {Object} The SuperAgent request object.
* @returns {Promise} A {@link https://www.promisejs.org/|Promise} object.
*/
callApi(path, httpMethod, pathParams,
queryParams, headerParams, formParams, bodyParam, authNames, contentTypes, accepts,
returnType, apiBasePath, callback) {
returnType, apiBasePath) {
var url = this.buildUrl(path, pathParams, apiBasePath);
var request = superagent(httpMethod, url);
@ -485,25 +477,34 @@ class ApiClient {
}
}
request.end((error, response) => {
if (callback) {
var data = null;
if (!error) {
return new Promise((resolve, reject) => {
request.end((error, response) => {
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 {
data = this.deserialize(response, returnType);
var data = this.deserialize(response, returnType);
if (this.enableCookies && typeof window === 'undefined'){
this.agent._saveCookies(response);
}
resolve({data, response});
} 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
* **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:api/BucketApi~allowBucketKeyCallback} callback The callback function, accepting three arguments: error, data, response
* data is of type: {@link module:model/BucketInfo}
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/BucketInfo} and HTTP response
*/
allowBucketKey(allowBucketKeyRequest, callback) {
allowBucketKeyWithHttpInfo(allowBucketKeyRequest) {
let postBody = allowBucketKeyRequest;
// verify the required parameter 'allowBucketKeyRequest' is set
if (allowBucketKeyRequest === undefined || allowBucketKeyRequest === null) {
@ -76,26 +68,31 @@ export default class BucketApi {
return this.apiClient.callApi(
'/bucket/allow', 'POST',
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.
* @callback module:api/BucketApi~createBucketCallback
* @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
* **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
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/BucketInfo}
*/
allowBucketKey(allowBucketKeyRequest) {
return this.allowBucketKeyWithHttpInfo(allowBucketKeyRequest)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/**
* 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.
* @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
* data is of type: {@link module:model/BucketInfo}
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/BucketInfo} and HTTP response
*/
createBucket(createBucketRequest, callback) {
createBucketWithHttpInfo(createBucketRequest) {
let postBody = createBucketRequest;
// verify the required parameter 'createBucketRequest' is set
if (createBucketRequest === undefined || createBucketRequest === null) {
@ -118,25 +115,31 @@ export default class BucketApi {
return this.apiClient.callApi(
'/bucket', 'POST',
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.
* @callback module:api/BucketApi~deleteBucketCallback
* @param {String} error Error message, if any.
* @param data This operation does not return a value.
* @param {String} response The complete HTTP response.
* 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.
* @param {module:model/CreateBucketRequest} createBucketRequest Aliases to put on the new bucket
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/BucketInfo}
*/
createBucket(createBucketRequest) {
return this.createBucketWithHttpInfo(createBucketRequest)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/**
* 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!
* @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;
// verify the required parameter 'bucketId' is set
if (bucketId === undefined || bucketId === null) {
@ -160,27 +163,32 @@ export default class BucketApi {
return this.apiClient.callApi(
'/bucket?id={bucket_id}', 'DELETE',
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.
* @callback module:api/BucketApi~deleteBucketGlobalAliasCallback
* @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.
* 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!
* @param {String} bucketId The exact bucket identifier, a 32 bytes hexadecimal string
* @return {Promise} a {@link https://www.promisejs.org/|Promise}
*/
deleteBucket(bucketId) {
return this.deleteBucketWithHttpInfo(bucketId)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/**
* Delete a global alias
* Delete a global alias from the target bucket
* @param {String} id
* @param {String} alias
* @param {module:api/BucketApi~deleteBucketGlobalAliasCallback} callback The callback function, accepting three arguments: error, data, response
* data is of type: {@link module:model/BucketInfo}
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/BucketInfo} and HTTP response
*/
deleteBucketGlobalAlias(id, alias, callback) {
deleteBucketGlobalAliasWithHttpInfo(id, alias) {
let postBody = null;
// verify the required parameter 'id' is set
if (id === undefined || id === null) {
@ -209,17 +217,24 @@ export default class BucketApi {
return this.apiClient.callApi(
'/bucket/alias/global', 'DELETE',
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.
* @callback module:api/BucketApi~deleteBucketLocalAliasCallback
* @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.
* Delete a global alias
* Delete a global alias from the target bucket
* @param {String} id
* @param {String} alias
* @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
@ -227,10 +242,9 @@ export default class BucketApi {
* @param {String} id
* @param {String} accessKeyId
* @param {String} alias
* @param {module:api/BucketApi~deleteBucketLocalAliasCallback} callback The callback function, accepting three arguments: error, data, response
* data is of type: {@link module:model/BucketInfo}
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/BucketInfo} and HTTP response
*/
deleteBucketLocalAlias(id, accessKeyId, alias, callback) {
deleteBucketLocalAliasWithHttpInfo(id, accessKeyId, alias) {
let postBody = null;
// verify the required parameter 'id' is set
if (id === undefined || id === null) {
@ -264,26 +278,33 @@ export default class BucketApi {
return this.apiClient.callApi(
'/bucket/alias/local', 'DELETE',
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.
* @callback module:api/BucketApi~denyBucketKeyCallback
* @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.
* Delete a local alias
* Delete a local alias, bound to specified account, from the target bucket
* @param {String} id
* @param {String} accessKeyId
* @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
* **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:api/BucketApi~denyBucketKeyCallback} callback The callback function, accepting three arguments: error, data, response
* data is of type: {@link module:model/BucketInfo}
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/BucketInfo} and HTTP response
*/
denyBucketKey(allowBucketKeyRequest, callback) {
denyBucketKeyWithHttpInfo(allowBucketKeyRequest) {
let postBody = allowBucketKeyRequest;
// verify the required parameter 'allowBucketKeyRequest' is set
if (allowBucketKeyRequest === undefined || allowBucketKeyRequest === null) {
@ -306,26 +327,31 @@ export default class BucketApi {
return this.apiClient.callApi(
'/bucket/deny', 'POST',
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.
* @callback module:api/BucketApi~findBucketInfoCallback
* @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.
* 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.
* @param {module:model/AllowBucketKeyRequest} allowBucketKeyRequest Aliases to put on the new bucket
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/BucketInfo}
*/
denyBucketKey(allowBucketKeyRequest) {
return this.denyBucketKeyWithHttpInfo(allowBucketKeyRequest)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/**
* Find a bucket
* Find a bucket by its global alias
* @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
* data is of type: {@link module:model/BucketInfo}
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/BucketInfo} and HTTP response
*/
findBucketInfo(alias, callback) {
findBucketInfoWithHttpInfo(alias) {
let postBody = null;
// verify the required parameter 'alias' is set
if (alias === undefined || alias === null) {
@ -349,26 +375,31 @@ export default class BucketApi {
return this.apiClient.callApi(
'/bucket?globalAlias={alias}', 'GET',
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.
* @callback module:api/BucketApi~getBucketInfoCallback
* @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.
* Find a bucket
* Find a bucket by its global alias
* @param {String} alias The exact global alias of one of the existing buckets
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/BucketInfo}
*/
findBucketInfo(alias) {
return this.findBucketInfoWithHttpInfo(alias)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/**
* 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).
* @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
* data is of type: {@link module:model/BucketInfo}
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/BucketInfo} and HTTP response
*/
getBucketInfo(bucketId, callback) {
getBucketInfoWithHttpInfo(bucketId) {
let postBody = null;
// verify the required parameter 'bucketId' is set
if (bucketId === undefined || bucketId === null) {
@ -392,25 +423,30 @@ export default class BucketApi {
return this.apiClient.callApi(
'/bucket?id={bucket_id}', 'GET',
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.
* @callback module:api/BucketApi~listBucketsCallback
* @param {String} error Error message, if any.
* @param {Array.<module:model/ListBuckets200ResponseInner>} data The data returned by the service call.
* @param {String} response The complete HTTP response.
* 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).
* @param {String} bucketId The exact bucket identifier, a 32 bytes hexadecimal string
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/BucketInfo}
*/
getBucketInfo(bucketId) {
return this.getBucketInfoWithHttpInfo(bucketId)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/**
* List all buckets
* 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
* data is of type: {@link Array.<module:model/ListBuckets200ResponseInner>}
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link Array.<module:model/ListBuckets200ResponseInner>} and HTTP response
*/
listBuckets(callback) {
listBucketsWithHttpInfo() {
let postBody = null;
let pathParams = {
@ -429,27 +465,31 @@ export default class BucketApi {
return this.apiClient.callApi(
'/bucket', 'GET',
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.
* @callback module:api/BucketApi~putBucketGlobalAliasCallback
* @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.
* List all buckets
* List all the buckets on the cluster with their UUID and their global and local aliases.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link Array.<module:model/ListBuckets200ResponseInner>}
*/
listBuckets() {
return this.listBucketsWithHttpInfo()
.then(function(response_and_data) {
return response_and_data.data;
});
}
/**
* Add a global alias
* Add a global alias to the target bucket
* @param {String} id
* @param {String} alias
* @param {module:api/BucketApi~putBucketGlobalAliasCallback} callback The callback function, accepting three arguments: error, data, response
* data is of type: {@link module:model/BucketInfo}
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/BucketInfo} and HTTP response
*/
putBucketGlobalAlias(id, alias, callback) {
putBucketGlobalAliasWithHttpInfo(id, alias) {
let postBody = null;
// verify the required parameter 'id' is set
if (id === undefined || id === null) {
@ -478,17 +518,24 @@ export default class BucketApi {
return this.apiClient.callApi(
'/bucket/alias/global', 'PUT',
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.
* @callback module:api/BucketApi~putBucketLocalAliasCallback
* @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.
* Add a global alias
* Add a global alias to the target bucket
* @param {String} id
* @param {String} alias
* @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
@ -496,10 +543,9 @@ export default class BucketApi {
* @param {String} id
* @param {String} accessKeyId
* @param {String} alias
* @param {module:api/BucketApi~putBucketLocalAliasCallback} callback The callback function, accepting three arguments: error, data, response
* data is of type: {@link module:model/BucketInfo}
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/BucketInfo} and HTTP response
*/
putBucketLocalAlias(id, accessKeyId, alias, callback) {
putBucketLocalAliasWithHttpInfo(id, accessKeyId, alias) {
let postBody = null;
// verify the required parameter 'id' is set
if (id === undefined || id === null) {
@ -533,27 +579,34 @@ export default class BucketApi {
return this.apiClient.callApi(
'/bucket/alias/local', 'PUT',
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.
* @callback module:api/BucketApi~updateBucketCallback
* @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.
* Add a local alias
* Add a local alias, bound to specified account, to the target bucket
* @param {String} id
* @param {String} accessKeyId
* @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
* 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.
* @param {module:api/BucketApi~updateBucketCallback} callback The callback function, accepting three arguments: error, data, response
* data is of type: {@link module:model/BucketInfo}
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/BucketInfo} and HTTP response
*/
updateBucket(bucketId, updateBucketRequest, callback) {
updateBucketWithHttpInfo(bucketId, updateBucketRequest) {
let postBody = updateBucketRequest;
// verify the required parameter 'bucketId' is set
if (bucketId === undefined || bucketId === null) {
@ -581,9 +634,23 @@ export default class BucketApi {
return this.apiClient.callApi(
'/bucket?id={bucket_id}', 'PUT',
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
* 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:api/KeyApi~addKeyCallback} callback The callback function, accepting three arguments: error, data, response
* data is of type: {@link module:model/KeyInfo}
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/KeyInfo} and HTTP response
*/
addKey(addKeyRequest, callback) {
addKeyWithHttpInfo(addKeyRequest) {
let postBody = addKeyRequest;
// verify the required parameter 'addKeyRequest' is set
if (addKeyRequest === undefined || addKeyRequest === null) {
@ -76,25 +68,31 @@ export default class KeyApi {
return this.apiClient.callApi(
'/key', 'POST',
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.
* @callback module:api/KeyApi~deleteKeyCallback
* @param {String} error Error message, if any.
* @param data This operation does not return a value.
* @param {String} response The complete HTTP response.
* Create a new API 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\"
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/KeyInfo}
*/
addKey(addKeyRequest) {
return this.addKeyWithHttpInfo(addKeyRequest)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/**
* 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.
* @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;
// verify the required parameter 'accessKey' is set
if (accessKey === undefined || accessKey === null) {
@ -118,26 +116,31 @@ export default class KeyApi {
return this.apiClient.callApi(
'/key?id={access_key}', 'DELETE',
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.
* @callback module:api/KeyApi~getKeyCallback
* @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.
* 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.
* @param {String} accessKey The exact API access key generated by Garage
* @return {Promise} a {@link https://www.promisejs.org/|Promise}
*/
deleteKey(accessKey) {
return this.deleteKeyWithHttpInfo(accessKey)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/**
* Get key information
* Return information about a specific key and return its information
* @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
* data is of type: {@link module:model/KeyInfo}
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/KeyInfo} and HTTP response
*/
getKey(accessKey, callback) {
getKeyWithHttpInfo(accessKey) {
let postBody = null;
// verify the required parameter 'accessKey' is set
if (accessKey === undefined || accessKey === null) {
@ -161,26 +164,31 @@ export default class KeyApi {
return this.apiClient.callApi(
'/key?id={access_key}', 'GET',
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.
* @callback module:api/KeyApi~importKeyCallback
* @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.
* Get key information
* Return information about a specific key and return its information
* @param {String} accessKey The exact API access key generated by Garage
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/KeyInfo}
*/
getKey(accessKey) {
return this.getKeyWithHttpInfo(accessKey)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/**
* 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.**
* @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
* data is of type: {@link module:model/KeyInfo}
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/KeyInfo} and HTTP response
*/
importKey(importKeyRequest, callback) {
importKeyWithHttpInfo(importKeyRequest) {
let postBody = importKeyRequest;
// verify the required parameter 'importKeyRequest' is set
if (importKeyRequest === undefined || importKeyRequest === null) {
@ -203,25 +211,30 @@ export default class KeyApi {
return this.apiClient.callApi(
'/key/import', 'POST',
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.
* @callback module:api/KeyApi~listKeysCallback
* @param {String} error Error message, if any.
* @param {Array.<module:model/ListKeys200ResponseInner>} data The data returned by the service call.
* @param {String} response The complete HTTP response.
* 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.**
* @param {module:model/ImportKeyRequest} importKeyRequest Information on the key to import
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/KeyInfo}
*/
importKey(importKeyRequest) {
return this.importKeyWithHttpInfo(importKeyRequest)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/**
* List all keys
* Returns all API access keys in the cluster.
* @param {module:api/KeyApi~listKeysCallback} callback The callback function, accepting three arguments: error, data, response
* data is of type: {@link Array.<module:model/ListKeys200ResponseInner>}
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link Array.<module:model/ListKeys200ResponseInner>} and HTTP response
*/
listKeys(callback) {
listKeysWithHttpInfo() {
let postBody = null;
let pathParams = {
@ -240,26 +253,30 @@ export default class KeyApi {
return this.apiClient.callApi(
'/key', 'GET',
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.
* @callback module:api/KeyApi~searchKeyCallback
* @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.
* List all keys
* Returns all API access keys in the cluster.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link Array.<module:model/ListKeys200ResponseInner>}
*/
listKeys() {
return this.listKeysWithHttpInfo()
.then(function(response_and_data) {
return response_and_data.data;
});
}
/**
* Select key by pattern
* 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 {module:api/KeyApi~searchKeyCallback} callback The callback function, accepting three arguments: error, data, response
* data is of type: {@link module:model/KeyInfo}
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/KeyInfo} and HTTP response
*/
searchKey(pattern, callback) {
searchKeyWithHttpInfo(pattern) {
let postBody = null;
// verify the required parameter 'pattern' is set
if (pattern === undefined || pattern === null) {
@ -283,27 +300,32 @@ export default class KeyApi {
return this.apiClient.callApi(
'/key?search={pattern}', 'GET',
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.
* @callback module:api/KeyApi~updateKeyCallback
* @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.
* Select key by pattern
* 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
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/KeyInfo}
*/
searchKey(pattern) {
return this.searchKeyWithHttpInfo(pattern)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/**
* 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
* @param {module:api/KeyApi~updateKeyCallback} callback The callback function, accepting three arguments: error, data, response
* data is of type: {@link module:model/KeyInfo}
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/KeyInfo} and HTTP response
*/
updateKey(accessKey, updateKeyRequest, callback) {
updateKeyWithHttpInfo(accessKey, updateKeyRequest) {
let postBody = updateKeyRequest;
// verify the required parameter 'accessKey' is set
if (accessKey === undefined || accessKey === null) {
@ -331,9 +353,23 @@ export default class KeyApi {
return this.apiClient.callApi(
'/key?id={access_key}', 'POST',
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. 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 {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;
// verify the required parameter 'requestBody' is set
if (requestBody === undefined || requestBody === null) {
@ -73,25 +66,31 @@ export default class LayoutApi {
return this.apiClient.callApi(
'/layout', 'POST',
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.
* @callback module:api/LayoutApi~applyLayoutCallback
* @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. 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.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}
*/
addLayout(requestBody) {
return this.addLayoutWithHttpInfo(requestBody)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/**
* Apply staged layout
* 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: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;
// verify the required parameter 'layoutVersion' is set
if (layoutVersion === undefined || layoutVersion === null) {
@ -114,25 +113,30 @@ export default class LayoutApi {
return this.apiClient.callApi(
'/layout/apply', 'POST',
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.
* @callback module:api/LayoutApi~getLayoutCallback
* @param {String} error Error message, if any.
* @param {module:model/ClusterLayout} data The data returned by the service call.
* @param {String} response The complete HTTP response.
* Apply staged layout
* 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.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}
*/
applyLayout(layoutVersion) {
return this.applyLayoutWithHttpInfo(layoutVersion)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/**
* 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`.*
* @param {module:api/LayoutApi~getLayoutCallback} callback The callback function, accepting three arguments: error, data, response
* data is of type: {@link module:model/ClusterLayout}
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/ClusterLayout} and HTTP response
*/
getLayout(callback) {
getLayoutWithHttpInfo() {
let postBody = null;
let pathParams = {
@ -151,25 +155,30 @@ export default class LayoutApi {
return this.apiClient.callApi(
'/layout', 'GET',
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.
* @callback module:api/LayoutApi~revertLayoutCallback
* @param {String} error Error message, if any.
* @param data This operation does not return a value.
* @param {String} response The complete HTTP response.
* 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`.*
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/ClusterLayout}
*/
getLayout() {
return this.getLayoutWithHttpInfo()
.then(function(response_and_data) {
return response_and_data.data;
});
}
/**
* 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.
* @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;
// verify the required parameter 'layoutVersion' is set
if (layoutVersion === undefined || layoutVersion === null) {
@ -192,9 +201,22 @@ export default class LayoutApi {
return this.apiClient.callApi(
'/layout/revert', 'POST',
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
* 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 {module:api/NodesApi~addNodeCallback} callback The callback function, accepting three arguments: error, data, response
* data is of type: {@link Array.<module:model/AddNode200ResponseInner>}
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link Array.<module:model/AddNode200ResponseInner>} and HTTP response
*/
addNode(requestBody, callback) {
addNodeWithHttpInfo(requestBody) {
let postBody = requestBody;
// verify the required parameter 'requestBody' is set
if (requestBody === undefined || requestBody === null) {
@ -73,25 +65,30 @@ export default class NodesApi {
return this.apiClient.callApi(
'/connect', 'POST',
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.
* @callback module:api/NodesApi~getNodesCallback
* @param {String} error Error message, if any.
* @param {module:model/GetNodes200Response} data The data returned by the service call.
* @param {String} response The complete HTTP response.
* 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.
* @param {Array.<String>} requestBody
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link Array.<module:model/AddNode200ResponseInner>}
*/
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
* 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
* data is of type: {@link module:model/GetNodes200Response}
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/GetNodes200Response} and HTTP response
*/
getNodes(callback) {
getNodesWithHttpInfo() {
let postBody = null;
let pathParams = {
@ -110,9 +107,21 @@ export default class NodesApi {
return this.apiClient.callApi(
'/status', 'GET',
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;
});
}
}