-
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.
Merge branch 'main' into feature-fleet-space-filtering
- Loading branch information
Showing
144 changed files
with
2,394 additions
and
813 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,10 @@ | ||
#!/usr/bin/env bash | ||
set -euo pipefail | ||
|
||
VALIDATION_PACKAGE_DIR="packages/kbn-esql-validation-autocomplete" | ||
EDITOR_PACKAGE_DIR="packages/kbn-text-based-editor" | ||
GIT_SCOPE="$VALIDATION_PACKAGE_DIR/**/* $EDITOR_PACKAGE_DIR/**/*" | ||
|
||
report_main_step () { | ||
echo "--- $1" | ||
} | ||
|
@@ -19,7 +23,7 @@ main () { | |
|
||
.buildkite/scripts/bootstrap.sh | ||
|
||
cd "$KIBANA_DIR/packages/kbn-esql-validation-autocomplete" | ||
cd "$KIBANA_DIR/$VALIDATION_PACKAGE_DIR" | ||
|
||
report_main_step "Generate function definitions" | ||
|
||
|
@@ -29,9 +33,21 @@ main () { | |
|
||
yarn make:tests | ||
|
||
report_main_step "Generate inline function docs" | ||
|
||
cd "$KIBANA_DIR/$EDITOR_PACKAGE_DIR" | ||
|
||
yarn make:docs $PARENT_DIR/elasticsearch | ||
|
||
report_main_step "Run i18n check" | ||
|
||
cd "$KIBANA_DIR" | ||
|
||
node scripts/i18n_check.js --fix | ||
|
||
# Check for differences | ||
set +e | ||
git diff --exit-code --quiet . | ||
git diff --exit-code --quiet $GIT_SCOPE | ||
if [ $? -eq 0 ]; then | ||
echo "No differences found. Our work is done here." | ||
exit | ||
|
@@ -44,8 +60,8 @@ main () { | |
git config --global user.name "$KIBANA_MACHINE_USERNAME" | ||
git config --global user.email '[email protected]' | ||
|
||
PR_TITLE='[ES|QL] Update function definitions' | ||
PR_BODY='This PR updates the function definitions based on the latest metadata from Elasticsearch.' | ||
PR_TITLE='[ES|QL] Update function metadata' | ||
PR_BODY='This PR updates the function definitions and inline docs based on the latest metadata from Elasticsearch.' | ||
|
||
# Check if a PR already exists | ||
pr_search_result=$(gh pr list --search "$PR_TITLE" --state open --author "$KIBANA_MACHINE_USERNAME" --limit 1 --json title -q ".[].title") | ||
|
@@ -58,12 +74,12 @@ main () { | |
echo "No existing PR found. Committing changes." | ||
|
||
# Make a commit | ||
BRANCH_NAME="esql_generate_function_definitions_$(date +%s)" | ||
BRANCH_NAME="esql_generate_function_metadata_$(date +%s)" | ||
|
||
git checkout -b "$BRANCH_NAME" | ||
|
||
git add ./**/* | ||
git commit -m "Update function definitions" | ||
git add $GIT_SCOPE | ||
git commit -m "Update function metadata" | ||
|
||
report_main_step "Changes committed. Creating pull request." | ||
|
||
|
Validating CODEOWNERS rules …
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
34 changes: 34 additions & 0 deletions
34
packages/kbn-alerting-types/alerting_framework_health_types.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,34 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
export enum HealthStatus { | ||
OK = 'ok', | ||
Warning = 'warn', | ||
Error = 'error', | ||
} | ||
|
||
export interface AlertsHealth { | ||
decryptionHealth: { | ||
status: HealthStatus; | ||
timestamp: string; | ||
}; | ||
executionHealth: { | ||
status: HealthStatus; | ||
timestamp: string; | ||
}; | ||
readHealth: { | ||
status: HealthStatus; | ||
timestamp: string; | ||
}; | ||
} | ||
|
||
export interface AlertingFrameworkHealth { | ||
isSufficientlySecure: boolean; | ||
hasPermanentEncryptionKey: boolean; | ||
alertingFrameworkHealth: AlertsHealth; | ||
} |
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
27 changes: 27 additions & 0 deletions
27
packages/kbn-alerts-ui-shared/src/common/apis/create_rule/create_rule.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,27 @@ | ||
/* | ||
* 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 type { HttpSetup } from '@kbn/core/public'; | ||
import type { AsApiContract } from '@kbn/actions-types'; | ||
import type { Rule } from '../../types'; | ||
import { CreateRuleBody, transformCreateRuleBody } from '.'; | ||
import { BASE_ALERTING_API_PATH } from '../../constants'; | ||
import { transformRule } from '../../transformations'; | ||
|
||
export async function createRule({ | ||
http, | ||
rule, | ||
}: { | ||
http: HttpSetup; | ||
rule: CreateRuleBody; | ||
}): Promise<Rule> { | ||
const res = await http.post<AsApiContract<Rule>>(`${BASE_ALERTING_API_PATH}/rule`, { | ||
body: JSON.stringify(transformCreateRuleBody(rule)), | ||
}); | ||
return transformRule(res); | ||
} |
11 changes: 11 additions & 0 deletions
11
packages/kbn-alerts-ui-shared/src/common/apis/create_rule/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,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 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. | ||
*/ | ||
|
||
export * from './types'; | ||
export * from './create_rule'; | ||
export * from './transform_create_rule_body'; |
103 changes: 103 additions & 0 deletions
103
packages/kbn-alerts-ui-shared/src/common/apis/create_rule/transform_create_rule_body.test.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,103 @@ | ||
/* | ||
* 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 { transformCreateRuleBody } from './transform_create_rule_body'; | ||
import type { RuleTypeParams } from '../../types'; | ||
import type { CreateRuleBody } from './types'; | ||
|
||
const ruleToCreate: CreateRuleBody<RuleTypeParams> = { | ||
params: { | ||
aggType: 'count', | ||
termSize: 5, | ||
thresholdComparator: '>', | ||
timeWindowSize: 5, | ||
timeWindowUnit: 'm', | ||
groupBy: 'all', | ||
threshold: [1000], | ||
index: ['.kibana'], | ||
timeField: 'alert.executionStatus.lastExecutionDate', | ||
}, | ||
consumer: 'alerts', | ||
schedule: { interval: '1m' }, | ||
tags: [], | ||
name: 'test', | ||
enabled: true, | ||
throttle: null, | ||
ruleTypeId: '.index-threshold', | ||
actions: [ | ||
{ | ||
group: 'threshold met', | ||
id: '83d4d860-9316-11eb-a145-93ab369a4461', | ||
params: { | ||
level: 'info', | ||
message: 'test-message', | ||
}, | ||
actionTypeId: '.server-log', | ||
frequency: { | ||
notifyWhen: 'onActionGroupChange', | ||
throttle: null, | ||
summary: false, | ||
}, | ||
useAlertDataForTemplate: true, | ||
}, | ||
{ | ||
id: '.test-system-action', | ||
params: {}, | ||
actionTypeId: '.system-action', | ||
}, | ||
], | ||
notifyWhen: 'onActionGroupChange', | ||
alertDelay: { | ||
active: 10, | ||
}, | ||
}; | ||
|
||
describe('transformCreateRuleBody', () => { | ||
test('should transform create rule body', () => { | ||
expect(transformCreateRuleBody(ruleToCreate)).toEqual({ | ||
params: { | ||
aggType: 'count', | ||
termSize: 5, | ||
thresholdComparator: '>', | ||
timeWindowSize: 5, | ||
timeWindowUnit: 'm', | ||
groupBy: 'all', | ||
threshold: [1000], | ||
index: ['.kibana'], | ||
timeField: 'alert.executionStatus.lastExecutionDate', | ||
}, | ||
consumer: 'alerts', | ||
schedule: { interval: '1m' }, | ||
tags: [], | ||
name: 'test', | ||
enabled: true, | ||
throttle: null, | ||
notifyWhen: 'onActionGroupChange', | ||
rule_type_id: '.index-threshold', | ||
actions: [ | ||
{ | ||
group: 'threshold met', | ||
id: '83d4d860-9316-11eb-a145-93ab369a4461', | ||
params: { | ||
level: 'info', | ||
message: 'test-message', | ||
}, | ||
frequency: { | ||
notify_when: 'onActionGroupChange', | ||
summary: false, | ||
throttle: null, | ||
}, | ||
use_alert_data_for_template: true, | ||
}, | ||
{ id: '.test-system-action', params: {} }, | ||
], | ||
|
||
alert_delay: { active: 10 }, | ||
}); | ||
}); | ||
}); |
Oops, something went wrong.