-
Notifications
You must be signed in to change notification settings - Fork 576
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
29 changed files
with
1,324 additions
and
227 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
const _checkBucketName = require('../utils/checkBucketName'); | ||
|
||
const proto = exports; | ||
/** | ||
* getBucketVersioning | ||
* @param {String} bucketName - bucket name | ||
*/ | ||
|
||
proto.getBucketVersioning = async function getBucketVersioning(bucketName, options) { | ||
_checkBucketName(bucketName); | ||
const params = this._bucketRequestParams('GET', bucketName, 'versioning', options); | ||
params.xmlResponse = true; | ||
params.successStatuses = [200]; | ||
const result = await this.request(params); | ||
|
||
const versionStatus = result.data.Status; | ||
return { | ||
status: result.status, | ||
versionStatus, | ||
res: result.res | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
const _checkBucketName = require('../utils/checkBucketName'); | ||
const obj2xml = require('../utils/obj2xml'); | ||
|
||
const proto = exports; | ||
/** | ||
* putBucketVersioning | ||
* @param {String} name - bucket name | ||
* @param {String} status | ||
* @param {Object} options | ||
*/ | ||
|
||
proto.putBucketVersioning = async function putBucketVersioning(name, status, options = {}) { | ||
_checkBucketName(name); | ||
if (!['Enabled', 'Suspended'].includes(status)) { | ||
throw new Error('status must be Enabled or Suspended'); | ||
} | ||
const params = this._bucketRequestParams('PUT', name, 'versioning', options); | ||
|
||
const paramXMLObj = { | ||
VersioningConfiguration: { | ||
Status: status | ||
} | ||
}; | ||
|
||
params.mime = 'xml'; | ||
params.content = obj2xml(paramXMLObj, { | ||
headers: true | ||
}); | ||
|
||
const result = await this.request(params); | ||
return { | ||
res: result.res, | ||
status: result.status | ||
}; | ||
}; |
Oops, something went wrong.