[7.17] Add Elasticsearch Serverless Forwarder to integrations UI (#130085) (#133477)

* Add Elasticsearch Serverless Forwarder to integrations UI (#130085)

(cherry picked from commit 34e51a6807)

# Conflicts:
#	test/api_integration/apis/custom_integration/integrations.ts

* fix import CoreSetup

Co-authored-by: Mario Castro <mariocaster@gmail.com>
This commit is contained in:
Andrea Spacca 2022-06-03 19:26:04 +09:00 committed by GitHub
parent 4917dee172
commit 4300032c31
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 188 additions and 12 deletions

View file

@ -79,6 +79,7 @@ export const SHIPPER_DISPLAY = {
sample_data: 'Sample data',
tests: 'Tests',
tutorial: 'Tutorials',
placeholders: 'Extra Integrations',
};
/**
@ -110,6 +111,7 @@ export interface CustomIntegration {
description: string;
type: 'ui_link';
uiInternalPath: string;
uiExternalLink?: string;
isBeta: boolean;
icons: CustomIntegrationIcon[];
categories: IntegrationCategory[];

View file

@ -0,0 +1,84 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
width="54mm"
height="54mm"
viewBox="0 0 54 54"
version="1.1"
id="svg5"
inkscape:version="1.1.2 (0a00cf5339, 2022-02-04)"
sodipodi:docname="esf.svg"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<sodipodi:namedview
id="namedview7"
pagecolor="#505050"
bordercolor="#ffffff"
borderopacity="1"
inkscape:pageshadow="0"
inkscape:pageopacity="0"
inkscape:pagecheckerboard="1"
inkscape:document-units="mm"
showgrid="false"
inkscape:zoom="2.8284271"
inkscape:cx="50.381358"
inkscape:cy="144.60334"
inkscape:window-width="2560"
inkscape:window-height="1371"
inkscape:window-x="2560"
inkscape:window-y="32"
inkscape:window-maximized="1"
inkscape:current-layer="layer1"
lock-margins="false"
fit-margin-top="1"
fit-margin-left="1"
fit-margin-right="1"
fit-margin-bottom="1" />
<defs
id="defs2">
<linearGradient
inkscape:collect="always"
id="linearGradient8295">
<stop
style="stop-color:#f16442;stop-opacity:1"
offset="0"
id="stop8291" />
<stop
style="stop-color:#f7991c;stop-opacity:1"
offset="1"
id="stop8293" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient8295"
id="linearGradient8299"
x1="148.84142"
y1="158.98425"
x2="201.0446"
y2="158.98425"
gradientUnits="userSpaceOnUse"
gradientTransform="translate(-79.450192,-27.206506)" />
</defs>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(-68.840572,-104.77776)">
<path
style="fill:url(#linearGradient8299);fill-opacity:1;stroke:none;stroke-width:0.265;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 78.867238,148.4107 c -0.77933,-0.10913 -1.65509,-0.30241 -1.94613,-0.42951 -4.16837,-1.82034 -5.82464,-3.40113 -7.03606,-6.71541 -1.5431,-4.22175 0.65151,-9.34242 4.8934,-11.41778 1.35977,-0.66528 1.42045,-0.74053 1.56884,-1.94567 0.28007,-2.27454 0.62553,-3.48648 1.50031,-5.2634 1.78984,-3.63568 4.11989,-5.70251 8.20163,-7.27512 1.26163,-0.48608 6.95389,-0.48263 8.20209,0.005 2.83467,1.10734 5.15455,2.54409 6.422602,3.97766 0.92285,1.0433 2.57323,3.60824 2.57323,3.99918 0,0.17182 0.41277,0.0687 0.99219,-0.24799 3.5533,-1.94183 7.41379,-0.57124 9.12813,3.24074 0.25466,0.56626 0.46302,1.36897 0.46302,1.7838 0,0.65938 0.14142,0.79559 1.12448,1.08301 3.50051,1.02347 6.22474,3.58034 7.06293,6.62905 0.51889,1.88729 0.26162,5.83379 -0.48518,7.44294 -0.74891,1.61366 -2.32581,3.33221 -3.64481,3.97221 -0.55809,0.27079 -1.25284,0.62798 -1.54388,0.79375 -0.36888,0.2101 -4.09548,0.32173 -12.30313,0.36854 -6.475672,0.0369 -14.470082,0.0965 -17.765332,0.13229 -3.29525,0.0358 -6.629,-0.0241 -7.40833,-0.13326 z m 37.354522,-2.34219 c 1.7236,-0.80924 2.63218,-1.59598 3.37927,-2.92612 0.56984,-1.01454 1.20592,-3.81908 0.9574,-4.22121 -0.0795,-0.12867 -3.56444,-0.23395 -7.74426,-0.23395 h -7.59968 l -0.0213,1.47579 c -0.0357,2.47122 -1.53196,3.93935 -4.01477,3.93935 -2.509852,0 -3.753692,-1.18772 -4.008492,-3.82764 l -0.14046,-1.4552 -5.3453,-0.1323 c -6.05283,-0.1498 -6.27208,-0.21795 -5.55289,-1.72611 0.84845,-1.77924 0.43071,-3.17938 -1.1431,-3.83127 -0.6754,-0.27976 -0.94179,-0.2746 -1.5319,0.0297 -0.39287,0.20258 -0.85936,0.54692 -1.03663,0.7652 -0.4719,0.58107 -0.40828,2.21791 0.12212,3.14208 0.78914,1.375 0.44814,1.47195 -5.69933,1.62042 l -5.47756,0.1323 0.0943,1.058 c 0.23244,2.60658 2.99245,5.44042 6.25565,6.423 1.72961,0.5208 1.95665,0.52641 19.84375,0.49047 l 17.197922,-0.0346 z m -13.40756,-4.37465 c 0.80249,-0.80249 0.91038,-1.90666 0.28025,-2.86835 -0.2295,-0.35027 -0.37833,-0.91162 -0.33072,-1.24746 l 0.0866,-0.61061 8.80154,-0.0697 8.80154,-0.0697 -0.17948,-0.72404 c -0.47812,-1.92871 -2.78172,-4.11325 -5.19587,-4.92732 -0.69631,-0.23481 -1.40131,-0.42692 -1.56667,-0.42692 -0.57072,0 -1.26835,-0.87796 -1.26835,-1.59619 0,-0.39624 -0.19222,-1.18146 -0.42714,-1.74493 -1.01527,-2.43512 -2.19154,-3.27346 -4.59297,-3.27346 -1.33094,0 -1.62066,0.10395 -2.5811,0.92604 -1.578,1.35071 -1.90045,1.24307 -2.98053,-0.99492 -1.11786,-2.31627 -3.696262,-5.00824 -5.830032,-6.08682 -0.79618,-0.40246 -1.5369,-0.72988 -1.64605,-0.72761 -0.10914,0.002 -0.19843,1.7826 -0.19843,3.95626 v 3.95211 l 0.92167,-0.14956 c 1.56452,-0.25389 3.44736,0.78518 4.26284,2.35251 0.514832,0.98948 0.469962,2.9867 -0.0867,3.8589 -0.87247,1.36707 -2.33338,2.17351 -3.93744,2.17351 h -1.16042 v 1.71979 1.71979 h 2.65413 c 2.975622,0 3.270262,0.18816 2.65056,1.69266 -0.65086,1.58015 -0.62898,2.13235 0.11975,3.02217 0.939402,1.11641 2.370002,1.1769 3.403022,0.14388 z m -22.639902,-5.53324 c -0.23841,-0.52326 -0.22909,-0.8941 0.0416,-1.65364 0.79202,-2.22247 2.05671,-3.22808 4.05976,-3.22808 2.49382,0 4.02254,1.53314 4.02254,4.03416 v 1.52061 l 1.91823,8e-4 1.91823,6.8e-4 v -2.53094 c 0,-3.52401 0.32895,-4.00978 2.11273,-3.11991 1.29152,0.6443 2.62955,0.24716 3.28372,-0.97463 0.47732,-0.89149 0.47991,-0.98274 0.0534,-1.88157 -0.42977,-0.90568 -1.32761,-1.54712 -2.16553,-1.54712 -0.21724,0 -0.85482,0.2346 -1.41687,0.52134 -1.62867,0.83089 -1.72084,0.55572 -1.8167,-5.42391 l -0.0816,-5.08736 -0.85293,-0.13841 c -1.14682,-0.1861 -3.21844,0.0435 -4.67167,0.51772 -3.11463,1.01642 -5.59645,3.16748 -7.00535,6.07172 -0.41477,0.85499 -0.86024,1.77142 -0.98993,2.03651 -0.12969,0.26509 -0.24802,1.42342 -0.26297,2.57407 -0.0215,1.65767 -0.13062,2.20314 -0.52539,2.62688 -0.27402,0.29413 -0.66855,0.53478 -0.87674,0.53478 -0.40897,0 -1.93147,0.80277 -3.11492,1.64242 -0.80725,0.57273 -2.30035,2.98018 -2.3043,3.71539 -0.002,0.42289 0.38688,0.46302 4.48976,0.46302 h 4.49225 z"
id="path1988" />
<path
style="fill:#000000;stroke-width:0.264583"
id="path1968"
d="" />
<path
style="fill:#000000;stroke-width:0.264583"
id="path1948"
d="" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 6.2 KiB

View file

@ -0,0 +1,74 @@
/*
* 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 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
import { i18n } from '@kbn/i18n';
import { CoreSetup } from 'kibana/server';
import { CustomIntegrationRegistry } from '../custom_integration_registry';
import { CustomIntegrationIcon, IntegrationCategory, PLUGIN_ID } from '../../common';
interface ExternalIntegration {
id: string;
title: string;
icon?: string;
euiIconName?: string;
description: string;
docUrlTemplate: string;
categories: IntegrationCategory[];
}
export const integrations: ExternalIntegration[] = [
{
id: 'esf',
title: i18n.translate('customIntegrations.placeholders.EsfTitle', {
defaultMessage: 'AWS Serverless Application Repository',
}),
icon: 'logo_esf.svg',
description: i18n.translate('customIntegrations.placeholders.EsfDescription', {
defaultMessage:
'Collect logs using AWS Lambda application available in AWS Serverless Application Repository.',
}),
docUrlTemplate: `https://serverlessrepo.aws.amazon.com/applications/eu-central-1/267093732750/elastic-serverless-forwarder`,
categories: ['aws', 'custom'],
},
];
export function registerExternalIntegrations(
core: CoreSetup,
registry: CustomIntegrationRegistry,
branch: string
) {
integrations.forEach((integration: ExternalIntegration) => {
const icons: CustomIntegrationIcon[] = [];
if (integration.euiIconName) {
icons.push({
type: 'eui',
src: integration.euiIconName,
});
} else if (integration.icon) {
icons.push({
type: 'svg',
src: core.http.basePath.prepend(
`/plugins/${PLUGIN_ID}/assets/placeholders/${integration.icon}`
),
});
}
registry.registerCustomIntegration({
uiInternalPath: '',
id: `placeholder.${integration.id}`,
title: integration.title,
description: integration.description,
type: 'ui_link',
shipper: 'placeholders',
uiExternalLink: integration.docUrlTemplate,
isBeta: false,
icons,
categories: integration.categories,
});
});
}

View file

@ -28,7 +28,7 @@ describe('CustomIntegrationsPlugin', () => {
expect(setup).toHaveProperty('getAppendCustomIntegrations');
});
test('should register language clients', () => {
test('should register custom integrations', () => {
const setup = new CustomIntegrationsPlugin(initContext).setup(mockCoreSetup);
expect(setup.getAppendCustomIntegrations()).toEqual([
{
@ -40,7 +40,7 @@ describe('CustomIntegrationsPlugin', () => {
uiInternalPath:
'https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/branch/introduction.html',
isBeta: false,
icons: [{ type: 'svg' }],
icons: [{ type: 'svg', src: undefined }],
categories: ['elastic_stack', 'custom', 'language_client'],
},
{
@ -52,7 +52,7 @@ describe('CustomIntegrationsPlugin', () => {
uiInternalPath:
'https://www.elastic.co/guide/en/elasticsearch/client/ruby-api/branch/ruby_client.html',
isBeta: false,
icons: [{ type: 'svg' }],
icons: [{ type: 'svg', src: undefined }],
categories: ['elastic_stack', 'custom', 'language_client'],
},
{
@ -64,7 +64,7 @@ describe('CustomIntegrationsPlugin', () => {
uiInternalPath:
'https://www.elastic.co/guide/en/elasticsearch/client/go-api/branch/overview.html',
isBeta: false,
icons: [{ type: 'svg' }],
icons: [{ type: 'svg', src: undefined }],
categories: ['elastic_stack', 'custom', 'language_client'],
},
{
@ -76,7 +76,7 @@ describe('CustomIntegrationsPlugin', () => {
uiInternalPath:
'https://www.elastic.co/guide/en/elasticsearch/client/net-api/branch/index.html',
isBeta: false,
icons: [{ type: 'svg' }],
icons: [{ type: 'svg', src: undefined }],
categories: ['elastic_stack', 'custom', 'language_client'],
},
{
@ -88,7 +88,7 @@ describe('CustomIntegrationsPlugin', () => {
uiInternalPath:
'https://www.elastic.co/guide/en/elasticsearch/client/php-api/branch/index.html',
isBeta: false,
icons: [{ type: 'svg' }],
icons: [{ type: 'svg', src: undefined }],
categories: ['elastic_stack', 'custom', 'language_client'],
},
{
@ -100,7 +100,7 @@ describe('CustomIntegrationsPlugin', () => {
uiInternalPath:
'https://www.elastic.co/guide/en/elasticsearch/client/perl-api/current/index.html',
isBeta: false,
icons: [{ type: 'svg' }],
icons: [{ type: 'svg', src: undefined }],
categories: ['elastic_stack', 'custom', 'language_client'],
},
{
@ -112,7 +112,7 @@ describe('CustomIntegrationsPlugin', () => {
uiInternalPath:
'https://www.elastic.co/guide/en/elasticsearch/client/python-api/branch/index.html',
isBeta: false,
icons: [{ type: 'svg' }],
icons: [{ type: 'svg', src: undefined }],
categories: ['elastic_stack', 'custom', 'language_client'],
},
{
@ -124,7 +124,7 @@ describe('CustomIntegrationsPlugin', () => {
uiInternalPath:
'https://www.elastic.co/guide/en/elasticsearch/client/rust-api/current/index.html',
isBeta: false,
icons: [{ type: 'svg' }],
icons: [{ type: 'svg', src: undefined }],
categories: ['elastic_stack', 'custom', 'language_client'],
},
{
@ -136,9 +136,23 @@ describe('CustomIntegrationsPlugin', () => {
uiInternalPath:
'https://www.elastic.co/guide/en/elasticsearch/client/java-api-client/branch/index.html',
isBeta: false,
icons: [{ type: 'svg' }],
icons: [{ type: 'svg', src: undefined }],
categories: ['elastic_stack', 'custom', 'language_client'],
},
{
id: 'placeholder.esf',
title: 'AWS Serverless Application Repository',
description:
'Collect logs using AWS Lambda application available in AWS Serverless Application Repository.',
type: 'ui_link',
shipper: 'placeholders',
uiInternalPath: '',
uiExternalLink:
'https://serverlessrepo.aws.amazon.com/applications/eu-central-1/267093732750/elastic-serverless-forwarder',
isBeta: false,
icons: [{ type: 'svg' }],
categories: ['aws', 'custom'],
},
]);
});
});

View file

@ -13,6 +13,7 @@ import { CustomIntegration } from '../common';
import { CustomIntegrationRegistry } from './custom_integration_registry';
import { defineRoutes } from './routes/define_routes';
import { registerLanguageClients } from './language_clients';
import { registerExternalIntegrations } from './external_integration';
export class CustomIntegrationsPlugin
implements Plugin<CustomIntegrationsPluginSetup, CustomIntegrationsPluginStart>
@ -37,6 +38,7 @@ export class CustomIntegrationsPlugin
defineRoutes(router, this.customIngegrationRegistry);
registerLanguageClients(core, this.customIngegrationRegistry, this.branch);
registerExternalIntegrations(core, this.customIngegrationRegistry, this.branch);
return {
registerCustomIntegration: (integration: Omit<CustomIntegration, 'type'>) => {

View file

@ -22,7 +22,7 @@ export default function ({ getService }: FtrProviderContext) {
expect(resp.body).to.be.an('array');
expect(resp.body.length).to.be(34);
expect(resp.body.length).to.be(35);
// Test for sample data card
expect(resp.body.findIndex((c: { id: string }) => c.id === 'sample_data_all')).to.be.above(

View file

@ -50,7 +50,7 @@ export const mapToCard = (
let uiInternalPathUrl;
if (item.type === 'ui_link') {
uiInternalPathUrl = getAbsolutePath(item.uiInternalPath);
uiInternalPathUrl = item.uiExternalLink || getAbsolutePath(item.uiInternalPath);
} else {
let urlVersion = item.version;