Skip to content

Commit

Permalink
ZKUI-390: Prepare all the mutation needed for Veeam
Browse files Browse the repository at this point in the history
  • Loading branch information
ChengYanJin committed Nov 16, 2023
1 parent f01fda3 commit a5fad46
Show file tree
Hide file tree
Showing 5 changed files with 795 additions and 3 deletions.
3 changes: 1 addition & 2 deletions src/react/databrowser/objects/ObjectList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { useQueryParams } from '../../utils/hooks';
import { useHistory, useLocation } from 'react-router-dom';
import { Box } from '@scality/core-ui/dist/next';
import { useBucketVersionning } from '../../next-architecture/domain/business/buckets';
import { VEEAM_XML_PREFIX } from '../../ui-elements/Veeam/VeeamConstants';
type Props = {
objects: List<ObjectEntity>;
bucketName: string;
Expand All @@ -26,8 +27,6 @@ type Props = {
listType: ListObjectsType;
};

export const VEEAM_XML_PREFIX = '.system-d26a9498-cb7c-4a87-a44a-8ae204f5ba6c';

export default function ObjectList({
objects,
bucketName,
Expand Down
3 changes: 2 additions & 1 deletion src/react/databrowser/objects/__tests__/ObjectList.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import * as s3object from '../../../actions/s3object';
import * as hooks from '../../../next-architecture/domain/business/buckets';
import * as queryHooks from '../../../utils/hooks';
import { checkBox, reduxMount } from '../../../utils/testUtil';
import ObjectList, { VEEAM_XML_PREFIX } from '../ObjectList';
import ObjectList from '../ObjectList';
import {
FIRST_FORMATTED_OBJECT,
SECOND_FORMATTED_OBJECT,
Expand All @@ -15,6 +15,7 @@ import { TEST_API_BASE_URL, reduxRender } from '../../../utils/testUtil';
import { screen, waitFor } from '@testing-library/react';
import { rest } from 'msw';
import { setupServer } from 'msw/node';
import { VEEAM_XML_PREFIX } from '../../../ui-elements/Veeam/VeeamConstants';

const server = setupServer(
rest.get(`${TEST_API_BASE_URL}/${BUCKET_NAME}`, (req, res, ctx) => {
Expand Down
41 changes: 41 additions & 0 deletions src/react/ui-elements/Veeam/VeeamConstants.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,44 @@
export const BUCKET_TAG_USECASE = 'X-Scality-Usecase';
export const VEEAMVERSION11 = 'Veeam 11';
export const VEEAMVERSION12 = 'Veeam 12';
export type VeeamVersion = 'Veeam 12' | 'Veeam 11';
export const VEEAM_IMMUTABLE_POLICY_NAME = 'Scality-Veeam-Immutable-Policy';
export const GET_VEEAM_IMMUTABLE_POLICY = (bucketName: string) =>
JSON.stringify({
Version: '2012-10-17',
Statement: [
{
Sid: 'VisualEditor0',
Effect: 'Allow',
Action: [
's3:GetBucketLocation',
's3:GetObject',
's3:PutObject',
's3:DeleteObject',
's3:GetBucketVersioning',
's3:GetBucketObjectLockConfiguration',
's3:ListBucketVersions',
's3:GetObjectVersion',
's3:GetObjectRetention',
's3:GetObjectLegalHold',
's3:PutObjectRetention',
's3:PutObjectLegalHold',
's3:DeleteObjectVersion',
],
Resource: [
`arn:aws:s3:::${bucketName}/*`,
`arn:aws:s3:::${bucketName}`,
],
},
{
Sid: 'VisualEditor1',
Effect: 'Allow',
Action: ['s3:ListAllMyBuckets', 's3:ListBucket'],
Resource: '*',
},
],
});
export const VEEAM_XML_PREFIX = '.system-d26a9498-cb7c-4a87-a44a-8ae204f5ba6c';
export const SYSTEM_XML_CONTENT = `<?xml version="1.0" encoding="UTF-8"?><SystemInfo><ProtocolVersion>"1.0"</ProtocolVersion><ModelName>"ARTESCA v1.7"</ModelName><ProtocolCapabilities><CapacityInfo>true</CapacityInfo><UploadSessions>false</UploadSessions><IAMSTS>false</IAMSTS></ProtocolCapabilities></SystemInfo>`;
export const GET_CAPACITY_XML_CONTENT = (capacity: number) =>
`<?xml version="1.0" encoding="utf-8" ?><CapacityInfo><Capacity>${capacity}</Capacity><Available>0</Available><Used>0</Used></CapacityInfo>`;
Loading

0 comments on commit a5fad46

Please sign in to comment.