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