[Guided onboarding] Change the API prefix to /internal (#155643)

## Summary

Fixes https://github.com/elastic/kibana/issues/155611
This PR changes the API prefix to indicate that the endpoints are
intended for internal use only. The plugin has been setup incorrectly
initially with the prefix `/api` that is intended for a public API.
There should not be any changes to the UI or functionality of the
plugin.


### Release Note
Fixed the guided onboarding API prefix to indicate that it's intended
for internal use

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
Yulia Čech 2023-04-25 19:21:20 +02:00 committed by GitHub
parent 672e9925b0
commit 13fd4f0847
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 21 additions and 13 deletions

View file

@ -9,4 +9,4 @@
export const PLUGIN_ID = 'guidedOnboarding';
export const PLUGIN_NAME = 'guidedOnboarding';
export const API_BASE_PATH = '/api/guided_onboarding';
export const API_BASE_PATH = '/internal/guided_onboarding';

View file

@ -7,13 +7,14 @@
*/
import expect from '@kbn/expect';
import { API_BASE_PATH } from '@kbn/guided-onboarding-plugin/common';
import type { FtrProviderContext } from '../../ftr_provider_context';
const getConfigsPath = '/api/guided_onboarding/configs';
const getConfigsPath = `${API_BASE_PATH}/configs`;
export default function testGetGuideConfig({ getService }: FtrProviderContext) {
const supertest = getService('supertest');
describe('GET /api/guided_onboarding/configs', () => {
describe(`GET ${getConfigsPath}`, () => {
// check that production guides are present
['siem', 'appSearch', 'websiteSearch', 'databaseSearch', 'kubernetes'].map((guideId) => {
it(`returns config for ${guideId}`, async () => {

View file

@ -13,15 +13,16 @@ import {
pluginStateSavedObjectsType,
} from '@kbn/guided-onboarding-plugin/server/saved_objects/guided_setup';
import { appSearchGuideId } from '@kbn/enterprise-search-plugin/common/guided_onboarding/search_guide_config';
import { API_BASE_PATH } from '@kbn/guided-onboarding-plugin/common';
import type { FtrProviderContext } from '../../ftr_provider_context';
import { createGuides } from './helpers';
const getGuidesPath = '/api/guided_onboarding/guides';
const getGuidesPath = `${API_BASE_PATH}/guides`;
export default function testGetGuidesState({ getService }: FtrProviderContext) {
const supertest = getService('supertest');
const kibanaServer = getService('kibanaServer');
describe('GET /api/guided_onboarding/guides', () => {
describe(`GET ${getGuidesPath}`, () => {
afterEach(async () => {
// Clean up saved objects
await kibanaServer.savedObjects.clean({

View file

@ -17,6 +17,7 @@ import {
guideStateSavedObjectsType,
pluginStateSavedObjectsType,
} from '@kbn/guided-onboarding-plugin/server/saved_objects/guided_setup';
import { API_BASE_PATH } from '@kbn/guided-onboarding-plugin/common';
import type { FtrProviderContext } from '../../ftr_provider_context';
import { createPluginState, createGuides } from './helpers';
@ -26,12 +27,12 @@ const getDateXDaysAgo = (daysAgo: number): string => {
return date.toISOString();
};
const getStatePath = '/api/guided_onboarding/state';
const getStatePath = `${API_BASE_PATH}/state`;
export default function testGetState({ getService }: FtrProviderContext) {
const supertest = getService('supertest');
const kibanaServer = getService('kibanaServer');
describe('GET /api/guided_onboarding/state', () => {
describe(`GET ${getStatePath}`, () => {
afterEach(async () => {
// Clean up saved objects
await kibanaServer.savedObjects.clean({

View file

@ -21,15 +21,16 @@ import {
} from '@kbn/guided-onboarding-plugin/server/saved_objects/guided_setup';
import { testGuideId } from '@kbn/guided-onboarding';
import { appSearchGuideId } from '@kbn/enterprise-search-plugin/common/guided_onboarding/search_guide_config';
import { API_BASE_PATH } from '@kbn/guided-onboarding-plugin/common';
import type { FtrProviderContext } from '../../ftr_provider_context';
import { createGuides, createPluginState } from './helpers';
const putStatePath = `/api/guided_onboarding/state`;
const putStatePath = `${API_BASE_PATH}/state`;
export default function testPutState({ getService }: FtrProviderContext) {
const supertest = getService('supertest');
const kibanaServer = getService('kibanaServer');
describe('PUT /api/guided_onboarding/state', () => {
describe(`PUT ${putStatePath}`, () => {
afterEach(async () => {
// Clean up saved objects
await kibanaServer.savedObjects.clean({

View file

@ -5,6 +5,7 @@
* 2.0.
*/
import { API_BASE_PATH } from '@kbn/guided-onboarding-plugin/common';
import { siemGuideId } from '../../../common/guided_onboarding/siem_guide_config';
const alertsGuideActiveState = {
@ -21,7 +22,7 @@ const alertsGuideActiveState = {
export const startAlertsCasesTour = () =>
cy.request({
method: 'PUT',
url: 'api/guided_onboarding/state',
url: `${API_BASE_PATH}/state`,
headers: { 'kbn-xsrf': 'cypress-creds' },
body: {
status: 'in_progress',
@ -32,7 +33,7 @@ export const startAlertsCasesTour = () =>
export const quitGlobalTour = () =>
cy.request({
method: 'PUT',
url: 'api/guided_onboarding/state',
url: `${API_BASE_PATH}/state`,
headers: { 'kbn-xsrf': 'cypress-creds' },
body: {
status: 'quit',

View file

@ -29,6 +29,7 @@
},
"@kbn/rison",
"@kbn/datemath",
"@kbn/guided-onboarding-plugin",
"@kbn/alerting-plugin"
]
}

View file

@ -155,6 +155,6 @@
"@kbn/security-solution-side-nav",
"@kbn/core-lifecycle-browser",
"@kbn/ecs",
"@kbn/url-state"
"@kbn/url-state",
]
}

View file

@ -7,6 +7,7 @@
import expect from '@kbn/expect';
import { observTourStepStorageKey } from '@kbn/observability-plugin/public/components/shared/tour';
import { API_BASE_PATH } from '@kbn/guided-onboarding-plugin/common';
import { FtrProviderContext } from '../../ftr_provider_context';
export default ({ getPageObjects, getService }: FtrProviderContext) => {
@ -44,7 +45,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
beforeEach(async () => {
// Activate the Observability guide, step 3, in order to trigger the EuiTour
await supertest
.put(`/api/guided_onboarding/state`)
.put(`${API_BASE_PATH}/state`)
.set('kbn-xsrf', 'true')
.send({
status: 'in_progress',

View file

@ -122,6 +122,7 @@
"@kbn/securitysolution-io-ts-alerting-types",
"@kbn/alerting-state-types",
"@kbn/assetManager-plugin",
"@kbn/guided-onboarding-plugin",
"@kbn/field-formats-plugin",
]
}