-
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
25 changed files
with
577 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export declare function abortBucketWorm(this: any, name: string, options: any): Promise<{ | ||
res: any; | ||
status: any; | ||
}>; |
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,14 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.abortBucketWorm = void 0; | ||
const checkBucketName_1 = require("../utils/checkBucketName"); | ||
async function abortBucketWorm(name, options) { | ||
checkBucketName_1.checkBucketName(name); | ||
const params = this._bucketRequestParams('DELETE', name, 'worm', options); | ||
const result = await this.request(params); | ||
return { | ||
res: result.res, | ||
status: result.status | ||
}; | ||
} | ||
exports.abortBucketWorm = abortBucketWorm; |
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,12 @@ | ||
import { checkBucketName } from '../utils/checkBucketName'; | ||
|
||
export async function abortBucketWorm(this: any, name: string, options) { | ||
checkBucketName(name); | ||
const params = this._bucketRequestParams('DELETE', name, 'worm', options); | ||
|
||
const result = await this.request(params); | ||
return { | ||
res: result.res, | ||
status: result.status | ||
}; | ||
} |
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,4 @@ | ||
export declare function completeBucketWorm(this: any, name: string, wormId: string, options: any): Promise<{ | ||
res: any; | ||
status: any; | ||
}>; |
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,14 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.completeBucketWorm = void 0; | ||
const checkBucketName_1 = require("../utils/checkBucketName"); | ||
async function completeBucketWorm(name, wormId, options) { | ||
checkBucketName_1.checkBucketName(name); | ||
const params = this._bucketRequestParams('POST', name, { wormId }, options); | ||
const result = await this.request(params); | ||
return { | ||
res: result.res, | ||
status: result.status | ||
}; | ||
} | ||
exports.completeBucketWorm = completeBucketWorm; |
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,12 @@ | ||
import { checkBucketName } from '../utils/checkBucketName'; | ||
|
||
export async function completeBucketWorm(this: any, name: string, wormId: string, options) { | ||
checkBucketName(name); | ||
const params = this._bucketRequestParams('POST', name, { wormId }, options); | ||
|
||
const result = await this.request(params); | ||
return { | ||
res: result.res, | ||
status: result.status | ||
}; | ||
} |
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,4 @@ | ||
export declare function extendBucketWorm(this: any, name: string, wormId: string, days: string, options: any): Promise<{ | ||
res: any; | ||
status: any; | ||
}>; |
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,23 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.extendBucketWorm = void 0; | ||
const checkBucketName_1 = require("../utils/checkBucketName"); | ||
const obj2xml_1 = require("../utils/obj2xml"); | ||
async function extendBucketWorm(name, wormId, days, options) { | ||
checkBucketName_1.checkBucketName(name); | ||
const params = this._bucketRequestParams('POST', name, { wormExtend: '', wormId }, options); | ||
const paramlXMLObJ = { | ||
ExtendWormConfiguration: { | ||
RetentionPeriodInDays: days | ||
} | ||
}; | ||
params.mime = 'xml'; | ||
params.content = obj2xml_1.obj2xml(paramlXMLObJ, { headers: true }); | ||
params.successStatuses = [200]; | ||
const result = await this.request(params); | ||
return { | ||
res: result.res, | ||
status: result.status | ||
}; | ||
} | ||
exports.extendBucketWorm = extendBucketWorm; |
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,21 @@ | ||
import { checkBucketName } from '../utils/checkBucketName'; | ||
import { obj2xml } from '../utils/obj2xml'; | ||
|
||
export async function extendBucketWorm(this: any, name: string, wormId: string, days: string | number, options) { | ||
checkBucketName(name); | ||
const params = this._bucketRequestParams('POST', name, { wormExtend: '', wormId }, options); | ||
const paramlXMLObJ = { | ||
ExtendWormConfiguration: { | ||
RetentionPeriodInDays: days | ||
} | ||
}; | ||
|
||
params.mime = 'xml'; | ||
params.content = obj2xml(paramlXMLObJ, { headers: true }); | ||
params.successStatuses = [200]; | ||
const result = await this.request(params); | ||
return { | ||
res: result.res, | ||
status: result.status | ||
}; | ||
} |
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 @@ | ||
export declare function getBucketWorm(this: any, name: string, options: any): Promise<any>; |
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,20 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getBucketWorm = void 0; | ||
const checkBucketName_1 = require("../utils/checkBucketName"); | ||
const dataFix_1 = require("../utils/dataFix"); | ||
async function getBucketWorm(name, options) { | ||
checkBucketName_1.checkBucketName(name); | ||
const params = this._bucketRequestParams('GET', name, 'worm', options); | ||
params.successStatuses = [200]; | ||
params.xmlResponse = true; | ||
const result = await this.request(params); | ||
dataFix_1.dataFix(result.data, { | ||
lowerFirst: true, | ||
rename: { | ||
RetentionPeriodInDays: 'days' | ||
} | ||
}); | ||
return Object.assign(Object.assign({}, result.data), { res: result.res, status: result.status }); | ||
} | ||
exports.getBucketWorm = getBucketWorm; |
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 @@ | ||
import { checkBucketName } from '../utils/checkBucketName'; | ||
import { dataFix } from '../utils/dataFix'; | ||
|
||
export async function getBucketWorm(this: any, name: string, options) { | ||
checkBucketName(name); | ||
const params = this._bucketRequestParams('GET', name, 'worm', options); | ||
params.successStatuses = [200]; | ||
params.xmlResponse = true; | ||
|
||
const result = await this.request(params); | ||
dataFix(result.data, { | ||
lowerFirst: true, | ||
rename: { | ||
RetentionPeriodInDays: 'days' | ||
} | ||
}); | ||
return { | ||
...result.data, | ||
res: result.res, | ||
status: result.status | ||
}; | ||
} |
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,5 @@ | ||
export declare function initiateBucketWorm(this: any, name: string, days: string, options: any): Promise<{ | ||
res: any; | ||
wormId: any; | ||
status: any; | ||
}>; |
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,24 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.initiateBucketWorm = void 0; | ||
const obj2xml_1 = require("../utils/obj2xml"); | ||
const checkBucketName_1 = require("../utils/checkBucketName"); | ||
async function initiateBucketWorm(name, days, options) { | ||
checkBucketName_1.checkBucketName(name); | ||
const params = this._bucketRequestParams('POST', name, 'worm', options); | ||
const paramlXMLObJ = { | ||
InitiateWormConfiguration: { | ||
RetentionPeriodInDays: days | ||
} | ||
}; | ||
params.mime = 'xml'; | ||
params.content = obj2xml_1.obj2xml(paramlXMLObJ, { headers: true }); | ||
params.successStatuses = [200]; | ||
const result = await this.request(params); | ||
return { | ||
res: result.res, | ||
wormId: result.res.headers['x-oss-worm-id'], | ||
status: result.status | ||
}; | ||
} | ||
exports.initiateBucketWorm = initiateBucketWorm; |
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,28 @@ | ||
import { obj2xml } from '../utils/obj2xml'; | ||
import { checkBucketName } from '../utils/checkBucketName'; | ||
|
||
export async function initiateBucketWorm( | ||
this: any, | ||
name: string, | ||
days: string, | ||
options | ||
) { | ||
checkBucketName(name); | ||
const params = this._bucketRequestParams('POST', name, 'worm', options); | ||
const paramlXMLObJ = { | ||
InitiateWormConfiguration: { | ||
RetentionPeriodInDays: days | ||
} | ||
}; | ||
|
||
params.mime = 'xml'; | ||
params.content = obj2xml(paramlXMLObJ, { headers: true }); | ||
params.successStatuses = [200]; | ||
|
||
const result = await this.request(params); | ||
return { | ||
res: result.res, | ||
wormId: result.res.headers['x-oss-worm-id'], | ||
status: result.status | ||
}; | ||
} |
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 |
---|---|---|
@@ -1 +1 @@ | ||
export declare const checkBucketName: (name: string, createBucket: boolean) => void; | ||
export declare const checkBucketName: (name: string, createBucket?: boolean) => void; |
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,12 @@ | ||
interface Rename { | ||
[propName: string]: string; | ||
} | ||
interface Config { | ||
lowerFirst?: boolean; | ||
rename?: Rename; | ||
remove?: string[]; | ||
camel?: string[]; | ||
bool?: string[]; | ||
} | ||
export declare function dataFix(o: object, conf: Config, finalKill?: Function): typeof dataFix | undefined; | ||
export {}; |
Oops, something went wrong.