Compare commits
1 Commits
developmen
...
ft/ZENKO-3
Author | SHA1 | Date |
---|---|---|
Bennett Buchanan | ef4cfa02ba |
|
@ -53,13 +53,14 @@ class BucketInfo {
|
||||||
* @param {string} [uid] - unique identifier for the bucket, necessary
|
* @param {string} [uid] - unique identifier for the bucket, necessary
|
||||||
* @param {string} readLocationConstraint - readLocationConstraint for bucket
|
* @param {string} readLocationConstraint - readLocationConstraint for bucket
|
||||||
* addition for use with lifecycle operations
|
* addition for use with lifecycle operations
|
||||||
|
* @param {boolean} [isNFS] - whether the bucket is on NFS
|
||||||
*/
|
*/
|
||||||
constructor(name, owner, ownerDisplayName, creationDate,
|
constructor(name, owner, ownerDisplayName, creationDate,
|
||||||
mdBucketModelVersion, acl, transient, deleted,
|
mdBucketModelVersion, acl, transient, deleted,
|
||||||
serverSideEncryption, versioningConfiguration,
|
serverSideEncryption, versioningConfiguration,
|
||||||
locationConstraint, websiteConfiguration, cors,
|
locationConstraint, websiteConfiguration, cors,
|
||||||
replicationConfiguration, lifecycleConfiguration, uid,
|
replicationConfiguration, lifecycleConfiguration, uid,
|
||||||
readLocationConstraint) {
|
readLocationConstraint, isNFS) {
|
||||||
assert.strictEqual(typeof name, 'string');
|
assert.strictEqual(typeof name, 'string');
|
||||||
assert.strictEqual(typeof owner, 'string');
|
assert.strictEqual(typeof owner, 'string');
|
||||||
assert.strictEqual(typeof ownerDisplayName, 'string');
|
assert.strictEqual(typeof ownerDisplayName, 'string');
|
||||||
|
@ -153,6 +154,7 @@ class BucketInfo {
|
||||||
this._cors = cors || null;
|
this._cors = cors || null;
|
||||||
this._lifecycleConfiguration = lifecycleConfiguration || null;
|
this._lifecycleConfiguration = lifecycleConfiguration || null;
|
||||||
this._uid = uid || uuid();
|
this._uid = uid || uuid();
|
||||||
|
this._isNFS = isNFS || null;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
@ -178,6 +180,7 @@ class BucketInfo {
|
||||||
replicationConfiguration: this._replicationConfiguration,
|
replicationConfiguration: this._replicationConfiguration,
|
||||||
lifecycleConfiguration: this._lifecycleConfiguration,
|
lifecycleConfiguration: this._lifecycleConfiguration,
|
||||||
uid: this._uid,
|
uid: this._uid,
|
||||||
|
isNFS: this._isNFS,
|
||||||
};
|
};
|
||||||
if (this._websiteConfiguration) {
|
if (this._websiteConfiguration) {
|
||||||
bucketInfos.websiteConfiguration =
|
bucketInfos.websiteConfiguration =
|
||||||
|
@ -199,7 +202,7 @@ class BucketInfo {
|
||||||
obj.transient, obj.deleted, obj.serverSideEncryption,
|
obj.transient, obj.deleted, obj.serverSideEncryption,
|
||||||
obj.versioningConfiguration, obj.locationConstraint, websiteConfig,
|
obj.versioningConfiguration, obj.locationConstraint, websiteConfig,
|
||||||
obj.cors, obj.replicationConfiguration, obj.lifecycleConfiguration,
|
obj.cors, obj.replicationConfiguration, obj.lifecycleConfiguration,
|
||||||
obj.uid, obj.readLocationConstraint);
|
obj.uid, obj.readLocationConstraint, obj.isNFS);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -223,7 +226,7 @@ class BucketInfo {
|
||||||
data._versioningConfiguration, data._locationConstraint,
|
data._versioningConfiguration, data._locationConstraint,
|
||||||
data._websiteConfiguration, data._cors,
|
data._websiteConfiguration, data._cors,
|
||||||
data._replicationConfiguration, data._lifecycleConfiguration,
|
data._replicationConfiguration, data._lifecycleConfiguration,
|
||||||
data._uid, data._readLocationConstraint);
|
data._uid, data._readLocationConstraint, data._isNFS);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -559,6 +562,22 @@ class BucketInfo {
|
||||||
getUid() {
|
getUid() {
|
||||||
return this._uid;
|
return this._uid;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Check if the bucket is an NFS bucket.
|
||||||
|
* @return {boolean} - Wether the bucket is NFS or not
|
||||||
|
*/
|
||||||
|
isNFS() {
|
||||||
|
return this._isNFS;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Set whether the bucket is an NFS bucket.
|
||||||
|
* @param {boolean} isNFS - Wether the bucket is NFS or not
|
||||||
|
* @return {BucketInfo} - bucket info instance
|
||||||
|
*/
|
||||||
|
setIsNFS(isNFS) {
|
||||||
|
this._isNFS = isNFS;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = BucketInfo;
|
module.exports = BucketInfo;
|
||||||
|
|
|
@ -136,7 +136,7 @@ Object.keys(acl).forEach(
|
||||||
testCorsConfiguration,
|
testCorsConfiguration,
|
||||||
testReplicationConfiguration,
|
testReplicationConfiguration,
|
||||||
testLifecycleConfiguration,
|
testLifecycleConfiguration,
|
||||||
testUid);
|
testUid, undefined, true);
|
||||||
|
|
||||||
describe('serialize/deSerialize on BucketInfo class', () => {
|
describe('serialize/deSerialize on BucketInfo class', () => {
|
||||||
const serialized = dummyBucket.serialize();
|
const serialized = dummyBucket.serialize();
|
||||||
|
@ -164,6 +164,7 @@ Object.keys(acl).forEach(
|
||||||
lifecycleConfiguration:
|
lifecycleConfiguration:
|
||||||
dummyBucket._lifecycleConfiguration,
|
dummyBucket._lifecycleConfiguration,
|
||||||
uid: dummyBucket._uid,
|
uid: dummyBucket._uid,
|
||||||
|
isNFS: dummyBucket._isNFS,
|
||||||
};
|
};
|
||||||
assert.strictEqual(serialized, JSON.stringify(bucketInfos));
|
assert.strictEqual(serialized, JSON.stringify(bucketInfos));
|
||||||
done();
|
done();
|
||||||
|
@ -279,6 +280,13 @@ Object.keys(acl).forEach(
|
||||||
it('getUid should return unique id of bucket', () => {
|
it('getUid should return unique id of bucket', () => {
|
||||||
assert.deepStrictEqual(dummyBucket.getUid(), testUid);
|
assert.deepStrictEqual(dummyBucket.getUid(), testUid);
|
||||||
});
|
});
|
||||||
|
it('get should return whether bucket is on NFS', () => {
|
||||||
|
assert.deepStrictEqual(dummyBucket.isNFS(), true);
|
||||||
|
});
|
||||||
|
it('set should set whether bucket is on NFS', () => {
|
||||||
|
dummyBucket.setIsNFS(false);
|
||||||
|
assert.deepStrictEqual(dummyBucket.isNFS(), false);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('setters on BucketInfo class', () => {
|
describe('setters on BucketInfo class', () => {
|
||||||
|
|
Loading…
Reference in New Issue