-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
69ec214
commit 4e5efcf
Showing
5 changed files
with
108 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
x-pack/test/cases_api_integration/common/plugins/cases/server/files/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import { HttpApiTagOperation } from '@kbn/cases-plugin/common/constants/types'; | ||
import type { FileKind } from '@kbn/files-plugin/common'; | ||
import type { FilesSetup } from '@kbn/files-plugin/server'; | ||
|
||
export const CASES_TEST_FIXTURE_OWNER = 'casesTestFixtureOwner'; | ||
export const CASES_TEST_FIXTURE_FILE_KIND_ID = `${CASES_TEST_FIXTURE_OWNER}_file_kind_id`; | ||
|
||
const buildFileKind = (): FileKind => { | ||
return { | ||
id: CASES_TEST_FIXTURE_FILE_KIND_ID, | ||
http: fileKindHttpTags(), | ||
allowedMimeTypes: ['image/png'], | ||
}; | ||
}; | ||
|
||
const fileKindHttpTags = (): FileKind['http'] => { | ||
return { | ||
create: buildTag(HttpApiTagOperation.Create), | ||
download: buildTag(HttpApiTagOperation.Read), | ||
getById: buildTag(HttpApiTagOperation.Read), | ||
list: buildTag(HttpApiTagOperation.Read), | ||
}; | ||
}; | ||
|
||
const access = 'access:'; | ||
|
||
const buildTag = (operation: HttpApiTagOperation) => { | ||
return { | ||
tags: [`${access}${CASES_TEST_FIXTURE_OWNER}${operation}`], | ||
}; | ||
}; | ||
|
||
export const registerCaseFixtureFileKinds = (filesSetupPlugin: FilesSetup) => { | ||
const fileKind = buildFileKind(); | ||
filesSetupPlugin.registerFileKind(fileKind); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters