Compare commits
1 Commits
developmen
...
ft/S3C-972
Author | SHA1 | Date |
---|---|---|
Bennett Buchanan | 6a231a7c23 |
|
@ -60,6 +60,7 @@ module.exports = class ObjectMD {
|
|||
destination: '',
|
||||
storageClass: '',
|
||||
role: '',
|
||||
storageType: '',
|
||||
},
|
||||
'dataStoreName': '',
|
||||
};
|
||||
|
@ -586,14 +587,15 @@ module.exports = class ObjectMD {
|
|||
* @return {ObjectMD} itself
|
||||
*/
|
||||
setReplicationInfo(replicationInfo) {
|
||||
const { status, content, destination, storageClass, role } =
|
||||
replicationInfo;
|
||||
const { status, content, destination, storageClass, role,
|
||||
storageType } = replicationInfo;
|
||||
this._data.replicationInfo = {
|
||||
status,
|
||||
content,
|
||||
destination,
|
||||
storageClass: storageClass || '',
|
||||
role,
|
||||
storageType: storageType || '',
|
||||
};
|
||||
return this;
|
||||
}
|
||||
|
|
|
@ -148,10 +148,10 @@ class ReplicationConfiguration {
|
|||
}
|
||||
const role = parsedRole[0];
|
||||
const rolesArr = role.split(',');
|
||||
if (rolesArr.length !== 2) {
|
||||
if (rolesArr.length > 2) {
|
||||
return errors.InvalidArgument.customizeDescription(
|
||||
'Invalid Role specified in replication configuration: ' +
|
||||
'Role must be a comma-separated list of two IAM roles');
|
||||
'Invalid Role specified in replication configuration: Role ' +
|
||||
'cannot be a comma-separated list of more than two IAM roles');
|
||||
}
|
||||
const invalidRole = rolesArr.find(r => !this._isValidRoleARN(r));
|
||||
if (invalidRole !== undefined) {
|
||||
|
@ -262,7 +262,9 @@ class ReplicationConfiguration {
|
|||
return errors.InvalidRequest.customizeDescription(
|
||||
'Rule Id must be unique');
|
||||
}
|
||||
if (id !== undefined) {
|
||||
this._configIDs.push(id);
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
|
@ -278,7 +280,10 @@ class ReplicationConfiguration {
|
|||
|
||||
const replicationEndpoints = this._config.replicationEndpoints
|
||||
.map(endpoint => endpoint.site);
|
||||
const locationConstraints =
|
||||
Object.keys(this._config.locationConstraints);
|
||||
return replicationEndpoints.includes(storageClass) ||
|
||||
locationConstraints.includes(storageClass) ||
|
||||
validStorageClasses.includes(storageClass);
|
||||
}
|
||||
|
||||
|
@ -326,11 +331,6 @@ class ReplicationConfiguration {
|
|||
return errors.InvalidArgument
|
||||
.customizeDescription('The specified bucket is not valid');
|
||||
}
|
||||
// We can replicate objects only to one destination bucket.
|
||||
if (this._destination && this._destination !== bucketARN) {
|
||||
return errors.InvalidRequest.customizeDescription(
|
||||
'The destination bucket must be same for all rules');
|
||||
}
|
||||
this._destination = bucketARN;
|
||||
return undefined;
|
||||
}
|
||||
|
|
|
@ -79,6 +79,7 @@ describe('ObjectMD class setters/getters', () => {
|
|||
destination: '',
|
||||
storageClass: '',
|
||||
role: '',
|
||||
storageType: '',
|
||||
}],
|
||||
['ReplicationInfo', {
|
||||
status: 'PENDING',
|
||||
|
@ -87,6 +88,7 @@ describe('ObjectMD class setters/getters', () => {
|
|||
storageClass: 'STANDARD',
|
||||
role: 'arn:aws:iam::account-id:role/src-resource,' +
|
||||
'arn:aws:iam::account-id:role/dest-resource',
|
||||
storageType: 'aws_s3',
|
||||
}],
|
||||
['DataStoreName', null, ''],
|
||||
].forEach(test => {
|
||||
|
|
Loading…
Reference in New Issue