Compare commits
7 Commits
developmen
...
improvemen
Author | SHA1 | Date |
---|---|---|
williamlardier | 2ccbe1c0b4 | |
williamlardier | 44d0f48623 | |
williamlardier | 56c675c31e | |
williamlardier | 938a08a28e | |
williamlardier | 5053e8d392 | |
williamlardier | 35fa8e1718 | |
williamlardier | 1fbc3be1fe |
|
@ -198,6 +198,49 @@ The Tag Set of a bucket is an array of objects with Key and Value:
|
|||
]
|
||||
```
|
||||
|
||||
## Model version 16
|
||||
|
||||
### Properties Added
|
||||
|
||||
```javascript
|
||||
this._dataReport = dataReport || null;
|
||||
```
|
||||
|
||||
For capacity-enabled buckets, contains the following data:
|
||||
|
||||
```javascript
|
||||
{
|
||||
_capabilitie: {
|
||||
SystemInfo?: {
|
||||
ProtocolVersion: String,
|
||||
ModelName: String,
|
||||
ProtocolCapabilities: {
|
||||
CapacityInfo: Boolean,
|
||||
UploadSessions: Boolean,
|
||||
IAMSTS: Boolean,
|
||||
},
|
||||
APIEndpoints: {
|
||||
IAMEndpoint: String,
|
||||
STSEndpoint: String,
|
||||
},
|
||||
SystemRecommendations?: {
|
||||
S3ConcurrentTaskLimit: Number,
|
||||
S3MultiObjectDelete: Number,
|
||||
StorageCurrentTasksLimit: Number,
|
||||
KbBlockSize: Number,
|
||||
}
|
||||
LastModified?: String,
|
||||
},
|
||||
CapacityInfo?: {
|
||||
Capacity: Number,
|
||||
Available: Number,
|
||||
Used: Number,
|
||||
LastModified?: String,
|
||||
},
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Usage
|
||||
|
||||
Used to store bucket tagging
|
|
@ -13,7 +13,7 @@ import { areTagsValid, BucketTag } from '../s3middleware/tagging';
|
|||
// WHEN UPDATING THIS NUMBER, UPDATE BucketInfoModelVersion.md CHANGELOG
|
||||
// BucketInfoModelVersion.md can be found in documentation/ at the root
|
||||
// of this repository
|
||||
const modelVersion = 14;
|
||||
const modelVersion = 16;
|
||||
|
||||
export type CORS = {
|
||||
id: string;
|
||||
|
@ -37,6 +37,41 @@ export type VersioningConfiguration = {
|
|||
MfaDelete: any;
|
||||
};
|
||||
|
||||
export type VeeamCapacity = {
|
||||
SystemInfo?: {
|
||||
ProtocolVersion: string,
|
||||
ModelName: string,
|
||||
ProtocolCapabilities: {
|
||||
CapacityInfo: boolean,
|
||||
UploadSessions: boolean,
|
||||
IAMSTS?: boolean,
|
||||
},
|
||||
APIEndpoints?: {
|
||||
IAMEndpoint: string,
|
||||
STSEndpoint: string,
|
||||
},
|
||||
SystemRecommendations?: {
|
||||
S3ConcurrentTaskLimit: number,
|
||||
S3MultiObjectDelete: number,
|
||||
StorageCurrentTasksLimit: number,
|
||||
KbBlockSize: number,
|
||||
}
|
||||
LastModified?: string,
|
||||
},
|
||||
CapacityInfo?: {
|
||||
Capacity: number,
|
||||
Available: number,
|
||||
Used: number,
|
||||
LastModified?: string,
|
||||
},
|
||||
};
|
||||
|
||||
// Capacity contains all specifics from external products supported by
|
||||
// our S3 implementation, at bucket level
|
||||
export type Capacity = {
|
||||
VeeamSOSApi?: VeeamCapacity,
|
||||
};
|
||||
|
||||
export type ACL = OACL & { WRITE: string[] }
|
||||
|
||||
export default class BucketInfo {
|
||||
|
@ -65,6 +100,7 @@ export default class BucketInfo {
|
|||
_isNFS: boolean | null;
|
||||
_azureInfo: any | null;
|
||||
_ingestion: { status: 'enabled' | 'disabled' } | null;
|
||||
_capabilities: Capacity | null;
|
||||
|
||||
/**
|
||||
* Represents all bucket information.
|
||||
|
@ -120,6 +156,7 @@ export default class BucketInfo {
|
|||
* @param [objectLockConfiguration] - object lock configuration
|
||||
* @param [notificationConfiguration] - bucket notification configuration
|
||||
* @param [tags] - bucket tag set
|
||||
* @param [capabilities] - capabilities for the bucket
|
||||
*/
|
||||
constructor(
|
||||
name: string,
|
||||
|
@ -147,6 +184,7 @@ export default class BucketInfo {
|
|||
objectLockConfiguration?: any,
|
||||
notificationConfiguration?: any,
|
||||
tags?: Array<BucketTag> | [],
|
||||
capabilities?: Capacity,
|
||||
) {
|
||||
assert.strictEqual(typeof name, 'string');
|
||||
assert.strictEqual(typeof owner, 'string');
|
||||
|
@ -274,6 +312,7 @@ export default class BucketInfo {
|
|||
this._objectLockConfiguration = objectLockConfiguration || null;
|
||||
this._notificationConfiguration = notificationConfiguration || null;
|
||||
this._tags = tags;
|
||||
this._capabilities = capabilities || null;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -308,6 +347,7 @@ export default class BucketInfo {
|
|||
objectLockConfiguration: this._objectLockConfiguration,
|
||||
notificationConfiguration: this._notificationConfiguration,
|
||||
tags: this._tags,
|
||||
capabilities: this._capabilities,
|
||||
};
|
||||
const final = this._websiteConfiguration
|
||||
? {
|
||||
|
@ -333,7 +373,8 @@ export default class BucketInfo {
|
|||
obj.cors, obj.replicationConfiguration, obj.lifecycleConfiguration,
|
||||
obj.bucketPolicy, obj.uid, obj.readLocationConstraint, obj.isNFS,
|
||||
obj.ingestion, obj.azureInfo, obj.objectLockEnabled,
|
||||
obj.objectLockConfiguration, obj.notificationConfiguration, obj.tags);
|
||||
obj.objectLockConfiguration, obj.notificationConfiguration, obj.tags,
|
||||
obj.capabilities);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -360,7 +401,7 @@ export default class BucketInfo {
|
|||
data._bucketPolicy, data._uid, data._readLocationConstraint,
|
||||
data._isNFS, data._ingestion, data._azureInfo,
|
||||
data._objectLockEnabled, data._objectLockConfiguration,
|
||||
data._notificationConfiguration, data._tags);
|
||||
data._notificationConfiguration, data._tags, data._capabilities);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -868,4 +909,25 @@ export default class BucketInfo {
|
|||
this._tags = tags;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value of bucket capabilities
|
||||
* @param capacity? - if provided, will return a specific capacity
|
||||
* @return - capabilities of the bucket, or null
|
||||
*/
|
||||
getCapabilities(capacity?: string) {
|
||||
if (capacity && this._capabilities && this._capabilities[capacity]) {
|
||||
return this._capabilities[capacity];
|
||||
}
|
||||
return this._capabilities;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set bucket capabilities
|
||||
* @return - bucket info instance
|
||||
*/
|
||||
setCapabilities(capabilities: Capacity) {
|
||||
this._capabilities = capabilities;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -132,6 +132,7 @@ const testAzureInfo = {
|
|||
managementPolicies: [],
|
||||
httpsOnly: false,
|
||||
tags: { foo: 'bar' },
|
||||
daraReport: null,
|
||||
networkACL: [],
|
||||
cname: 'www.example.com',
|
||||
azureFilesAADIntegration: false,
|
||||
|
@ -199,6 +200,35 @@ const testBucketTagging = [
|
|||
},
|
||||
];
|
||||
|
||||
const testBucketCapacity = {
|
||||
VeeamSOSApi: {
|
||||
SystemInfo: {
|
||||
ProtocolVersion: '"1.0"',
|
||||
ModelName: 'ARTESCA',
|
||||
ProtocolCapabilities: {
|
||||
CapacityInfo: true,
|
||||
UploadSessions: false,
|
||||
IAMSTS: false,
|
||||
},
|
||||
APIEndpoints: {
|
||||
IAMEndpoint: '',
|
||||
STSEndpoint: '',
|
||||
},
|
||||
SystemRecommendations: {
|
||||
S3ConcurrentTaskLimit: 64,
|
||||
S3MultiObjectDelete: 1000,
|
||||
StorageCurrentTasksLimit: 0,
|
||||
KbBlockSize: 1024,
|
||||
},
|
||||
},
|
||||
CapacityInfo: {
|
||||
Capacity: 1,
|
||||
Available: 1,
|
||||
Used: 0,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
// create a dummy bucket to test getters and setters
|
||||
Object.keys(acl).forEach(
|
||||
aclObj => describe(`different acl configurations : ${aclObj}`, () => {
|
||||
|
@ -222,6 +252,7 @@ Object.keys(acl).forEach(
|
|||
testObjectLockConfiguration,
|
||||
testNotificationConfiguration,
|
||||
testBucketTagging,
|
||||
testBucketCapacity,
|
||||
);
|
||||
|
||||
describe('serialize/deSerialize on BucketInfo class', () => {
|
||||
|
@ -259,6 +290,7 @@ Object.keys(acl).forEach(
|
|||
dummyBucket._objectLockConfiguration,
|
||||
notificationConfiguration: dummyBucket._notificationConfiguration,
|
||||
tags: dummyBucket._tags,
|
||||
capabilities: dummyBucket._capabilities,
|
||||
};
|
||||
assert.strictEqual(serialized, JSON.stringify(bucketInfos));
|
||||
done();
|
||||
|
@ -307,6 +339,7 @@ Object.keys(acl).forEach(
|
|||
_notificationConfiguration:
|
||||
dummyBucket._notificationConfiguration,
|
||||
_tags: dummyBucket._tags,
|
||||
_capabilities: dummyBucket._capabilities,
|
||||
};
|
||||
const fromObj = BucketInfo.fromObj(dataObj);
|
||||
assert(fromObj instanceof BucketInfo);
|
||||
|
|
Loading…
Reference in New Issue