-
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.
[Synthetics] Filters tls certs by saved objects (#160113)
Co-authored-by: Kibana Machine <[email protected]>
- Loading branch information
1 parent
b20ccb2
commit 79d8349
Showing
18 changed files
with
250 additions
and
63 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
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
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
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
11 changes: 11 additions & 0 deletions
11
x-pack/plugins/synthetics/public/apps/synthetics/state/certs/actions.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,11 @@ | ||
/* | ||
* 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 { CertResult, GetCertsParams } from '../../../../../common/runtime_types'; | ||
import { createAsyncAction } from '../utils/actions'; | ||
|
||
export const getCertsListAction = createAsyncAction<GetCertsParams, CertResult>('GET CERTS LIST'); |
24 changes: 24 additions & 0 deletions
24
x-pack/plugins/synthetics/public/apps/synthetics/state/certs/api.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,24 @@ | ||
/* | ||
* 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 { SYNTHETICS_API_URLS } from '../../../../../common/constants'; | ||
import { CertResult, GetCertsParams } from '../../../../../common/runtime_types'; | ||
import { apiService } from '../../../../utils/api_service/api_service'; | ||
|
||
export const getCertsList = async (queryParams: GetCertsParams): Promise<CertResult> => { | ||
const { pageIndex, size, search, sortBy, direction } = queryParams; | ||
const result = (await apiService.get(SYNTHETICS_API_URLS.CERTS, { | ||
pageIndex, | ||
size, | ||
search, | ||
sortBy, | ||
direction, | ||
})) as { | ||
data: CertResult; | ||
}; | ||
return result.data; | ||
}; |
29 changes: 29 additions & 0 deletions
29
x-pack/plugins/synthetics/public/apps/synthetics/state/certs/effects.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,29 @@ | ||
/* | ||
* 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 { takeLeading } from 'redux-saga/effects'; | ||
import { i18n } from '@kbn/i18n'; | ||
import { fetchEffectFactory } from '../utils/fetch_effect'; | ||
import { getCertsList } from './api'; | ||
import { getCertsListAction } from './actions'; | ||
|
||
export function* getCertsListEffect() { | ||
yield takeLeading( | ||
getCertsListAction.get, | ||
fetchEffectFactory( | ||
getCertsList, | ||
getCertsListAction.success, | ||
getCertsListAction.fail, | ||
undefined, | ||
getFailMessage | ||
) | ||
); | ||
} | ||
|
||
const getFailMessage = i18n.translate('xpack.synthetics.getCerts.failed', { | ||
defaultMessage: 'Failed to get TLS certificates.', | ||
}); |
45 changes: 45 additions & 0 deletions
45
x-pack/plugins/synthetics/public/apps/synthetics/state/certs/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,45 @@ | ||
/* | ||
* 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 { createReducer } from '@reduxjs/toolkit'; | ||
import { CertResult, SyntheticsParamSO } from '../../../../../common/runtime_types'; | ||
import { IHttpSerializedFetchError } from '..'; | ||
import { getCertsListAction } from './actions'; | ||
|
||
export interface CertsListState { | ||
isLoading?: boolean; | ||
data?: CertResult; | ||
error: IHttpSerializedFetchError | null; | ||
isSaving?: boolean; | ||
savedData?: SyntheticsParamSO; | ||
} | ||
|
||
const initialState: CertsListState = { | ||
isLoading: false, | ||
error: null, | ||
data: { certs: [], total: 0 }, | ||
}; | ||
|
||
export const certsListReducer = createReducer(initialState, (builder) => { | ||
builder | ||
.addCase(getCertsListAction.get, (state) => { | ||
state.isLoading = true; | ||
}) | ||
.addCase(getCertsListAction.success, (state, action) => { | ||
state.isLoading = false; | ||
state.data = action.payload; | ||
}) | ||
.addCase(getCertsListAction.fail, (state, action) => { | ||
state.isLoading = false; | ||
state.error = action.payload; | ||
}); | ||
}); | ||
|
||
export * from './actions'; | ||
export * from './effects'; | ||
export * from './selectors'; | ||
export * from './api'; |
10 changes: 10 additions & 0 deletions
10
x-pack/plugins/synthetics/public/apps/synthetics/state/certs/selectors.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,10 @@ | ||
/* | ||
* 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 { AppState } from '..'; | ||
|
||
export const selectCertsListState = (state: AppState) => state.certsList; |
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
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
Oops, something went wrong.