Skip to content

Commit

Permalink
Merge branch 'main' into 454/core-web-vitals
Browse files Browse the repository at this point in the history
  • Loading branch information
justinkambic committed Jun 7, 2022
2 parents 1d53388 + 0a730a8 commit 4cc7200
Show file tree
Hide file tree
Showing 31 changed files with 569 additions and 210 deletions.
10 changes: 10 additions & 0 deletions dev_docs/tutorials/advanced_settings.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -286,3 +286,13 @@ export const migrations = {
};
```
[1] Since all `uiSettings` migrations are added to the same migration function, while not required, grouping settings by team is good practice.

### Creating Transforms

If you have need to make a change that isn't possible in a saved object migration function (for example, you need to find other saved
objects), you can create a transform function instead. This will be applied when a `config` saved object is first created, and/or when it is
first upgraded. Note that you might need to add an extra attribute to verify that this transform has already been applied so it doesn't get
applied again in the future.

For example, we needed to transform the `defaultIndex` attribute, and we added an extra `isDefaultIndexMigrated` attribute for this purpose.
See `src/core/server/ui_settings/saved_objects/transforms.ts` and [#13339](https://github.com/elastic/kibana/pull/133339) for an example.
2 changes: 1 addition & 1 deletion docs/api/actions-and-connectors.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ include::actions-and-connectors/delete.asciidoc[leveloffset=+1]
include::actions-and-connectors/get.asciidoc[leveloffset=+1]
include::actions-and-connectors/get_all.asciidoc[leveloffset=+1]
include::actions-and-connectors/list.asciidoc[]
include::actions-and-connectors/update.asciidoc[]
include::actions-and-connectors/update.asciidoc[leveloffset=+1]
include::actions-and-connectors/execute.asciidoc[]
include::actions-and-connectors/legacy/index.asciidoc[]
include::actions-and-connectors/legacy/get.asciidoc[]
Expand Down
14 changes: 11 additions & 3 deletions docs/api/actions-and-connectors/create.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ You must have `all` privileges for the *Actions and Connectors* feature in the
(Required, object) The configuration for the connector. Configuration properties
vary depending on the connector type. For example:
+
--
// tag::connector-config[]
.Index connectors
[%collapsible%open]
====
Expand All @@ -51,7 +53,7 @@ request. The default value is `false`.
For more information, refer to
{kibana-ref}/index-action-type.html[Index connector and action].
====
+

.{jira} connectors
[%collapsible%open]
====
Expand All @@ -65,8 +67,10 @@ For more information, refer to
For more information, refer to
{kibana-ref}/jira-action-type.html[{jira} connector and action].
====
+

For more configuration properties, refer to <<action-types>>.
// end::connector-config[]
--

`connector_type_id`::
(Required, string) The connector type ID for the connector.
Expand All @@ -75,14 +79,16 @@ For more configuration properties, refer to <<action-types>>.
(Required, string) The display name for the connector.

`secrets`::
(Required, object) The secrets configuration for the connector. Secrets
(Required^*^, object) The secrets configuration for the connector. Secrets
configuration properties vary depending on the connector type. For information
about the secrets configuration properties, refer to <<action-types>>.
+
--
WARNING: Remember these values. You must provide them each time you call the <<update-connector-api, update>> API.
--
+
--
// tag::connector-secrets[]
.{jira} connectors
[%collapsible%open]
====
Expand All @@ -93,6 +99,8 @@ authentication.
`email`::
(Required, string) The account email for HTTP Basic authentication.
====
// end::connector-secrets[]
--

[[create-connector-api-request-codes]]
=== {api-response-codes-title}
Expand Down
30 changes: 21 additions & 9 deletions docs/api/actions-and-connectors/execute.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,24 @@
Executes a connector by ID.

[[execute-connector-api-request]]
==== Request
==== {api-request-title}

`POST <kibana host>:<port>/api/actions/connector/<id>/_execute`

`POST <kibana host>:<port>/s/<space_id>/api/actions/connector/<id>/_execute`

[discrete]
=== {api-prereq-title}

You must have `read` privileges for the *Actions and Connectors* feature in the
*Management* section of the
<<kibana-feature-privileges,{kib} feature privileges>>.

If you use an index connector, you must also have `all`, `create`, `index`, or
`write` {ref}/security-privileges.html[indices privileges].

[[execute-connector-api-params]]
==== Path parameters
==== {api-path-parms-title}

`id`::
(Required, string) The ID of the connector.
Expand All @@ -23,24 +33,26 @@ Executes a connector by ID.
(Optional, string) An identifier for the space. If `space_id` is not provided in the URL, the default space is used.

[[execute-connector-api-request-body]]
==== Request body
==== {api-request-body-title}

`params`::
(Required, object) The parameters of the connector. Parameter properties vary depending on
the connector type. For information about the parameter properties, refer to <<action-types,Action and connector types>>.

[[execute-connector-api-codes]]
==== Response code
==== {api-response-codes-title}

`200`::
Indicates a successful call.

[[execute-connector-api-example]]
==== Example
==== {api-examples-title}

Run an index connector:

[source,sh]
--------------------------------------------------
$ curl -X POST api/actions/connector/c55b6eb0-6bad-11eb-9f3b-611eebc6c3ad/_execute -H 'kbn-xsrf: true' -H 'Content-Type: application/json' -d '
POST api/actions/connector/c55b6eb0-6bad-11eb-9f3b-611eebc6c3ad/_execute
{
"params": {
"documents": [
Expand All @@ -51,7 +63,7 @@ $ curl -X POST api/actions/connector/c55b6eb0-6bad-11eb-9f3b-611eebc6c3ad/_execu
}
]
}
}'
}
--------------------------------------------------
// KIBANA

Expand All @@ -62,7 +74,7 @@ The API returns the following:
{
"status": "ok",
"data": {
"took": 197,
"took": 10,
"errors": false,
"items": [
{
Expand All @@ -76,7 +88,7 @@ The API returns the following:
"successful": 1,
"failed": 0
},
"_seq_no": 0,
"_seq_no": 7,
"_primary_term": 1,
"status": 201
}
Expand Down
26 changes: 16 additions & 10 deletions docs/api/actions-and-connectors/list.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -7,30 +7,37 @@
Retrieves a list of all connector types.

[[list-connector-types-api-request]]
==== Request
==== {api-request-title}

`GET <kibana host>:<port>/api/actions/connector_types`

`GET <kibana host>:<port>/s/<space_id>/api/actions/connector_types`


[discrete]
=== {api-prereq-title}

You do not need any <<kibana-feature-privileges,{kib} feature privileges>> to
run this API.

[[list-connector-types-api-path-params]]
==== Path parameters
==== {api-path-parms-title}

`space_id`::
(Optional, string) An identifier for the space. If `space_id` is not provided in the URL, the default space is used.

[[list-connector-types-api-codes]]
==== Response code
==== {api-response-codes-title}

`200`::
Indicates a successful call.

[[list-connector-types-api-example]]
==== Example
==== {api-examples-title}

[source,sh]
--------------------------------------------------
$ curl -X GET api/actions/connector_types
GET api/actions/connector_types
--------------------------------------------------
// KIBANA

Expand All @@ -45,7 +52,7 @@ The API returns the following:
"minimum_license_required": "gold", <3>
"enabled": false, <4>
"enabled_in_config": true, <5>
"enabled_in_license": false <6>
"enabled_in_license": true <6>
},
{
"id": ".index",
Expand All @@ -54,14 +61,13 @@ The API returns the following:
"enabled": true,
"enabled_in_config": true,
"enabled_in_license": true
}
},
...
]
--------------------------------------------------


<1> `id` - The unique ID of the connector type.
<2> `name` - The name of the connector type.
<3> `minimum_license_required` - The license required to use the connector type.
<4> `enabled` - Specifies if the connector type is enabled or disabled in {kib}.
<5> `enabled_in_config` - Specifies if the connector type is enabled or enabled in the {kib} .yml file.
<5> `enabled_in_config` - Specifies if the connector type is enabled or enabled in the {kib} `.yml` file.
<6> `enabled_in_license` - Specifies if the connector type is enabled or disabled in the license.
48 changes: 34 additions & 14 deletions docs/api/actions-and-connectors/update.asciidoc
Original file line number Diff line number Diff line change
@@ -1,57 +1,77 @@
[[update-connector-api]]
=== Update connector API
== Update connector API
++++
<titleabbrev>Update connector</titleabbrev>
++++

Updates the attributes for an existing connector.
Updates the attributes for a connector.

[[update-connector-api-request]]
==== Request
=== {api-request-title}

`PUT <kibana host>:<port>/api/actions/connector/<id>`

`PUT <kibana host>:<port>/s/<space_id>/api/actions/connector/<id>`

[discrete]
=== {api-prereq-title}

You must have `all` privileges for the *Actions and Connectors* feature in the
*Management* section of the
<<kibana-feature-privileges,{kib} feature privileges>>.

[[update-connector-api-params]]
==== Path parameters
=== {api-path-parms-title}

`id`::
(Required, string) The ID of the connector.

`space_id`::
(Optional, string) An identifier for the space. If `space_id` is not provided in the URL, the default space is used.

[role="child_attributes"]
[[update-connector-api-request-body]]
==== Request body

`name`::
(Required, string) The new name of the connector.
=== {api-request-body-title}

`config`::
(Required, object) The new connector configuration. Configuration properties vary depending on the connector type. For information about the configuration properties, refer to <<action-types,Action and connector types>>.
(Required, object) The new connector configuration. Configuration properties
vary depending on the connector type. For example:
+
--
include::create.asciidoc[tag=connector-config]
--

`name`::
(Required, string) The new name of the connector.

`secrets`::
(Required, object) The updated secrets configuration for the connector. Secrets properties vary depending on the connector type. For information about the secrets configuration properties, refer to <<action-types,Action and connector types>>.
(Required^*^, object) The updated secrets configuration for the connector. Secrets
properties vary depending on the connector type. For information about the
secrets configuration properties, refer to
<<action-types,Action and connector types>>.
+
--
include::create.asciidoc[tag=connector-secrets]
--

[[update-connector-api-codes]]
==== Response code
=== {api-response-codes-title}

`200`::
Indicates a successful call.

[[update-connector-api-example]]
==== Example
=== {api-examples-title}

[source,sh]
--------------------------------------------------
$ curl -X PUT api/actions/connector/c55b6eb0-6bad-11eb-9f3b-611eebc6c3ad -H 'kbn-xsrf: true' -H 'Content-Type: application/json' -d '
PUT api/actions/connector/c55b6eb0-6bad-11eb-9f3b-611eebc6c3ad
{
"name": "updated-connector",
"config": {
"index": "updated-index"
}
}'
}
--------------------------------------------------
// KIBANA

Expand Down
Binary file modified docs/management/cases/images/cases-visualization.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/management/cases/images/cases.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions packages/kbn-field-types/src/kbn_field_types_factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export const createKbnFieldTypes = (): KbnFieldType[] => [
esTypes: [
ES_FIELD_TYPES.STRING,
ES_FIELD_TYPES.TEXT,
ES_FIELD_TYPES.MATCH_ONLY_TEXT,
ES_FIELD_TYPES.KEYWORD,
ES_FIELD_TYPES.VERSION,
ES_FIELD_TYPES._TYPE,
Expand Down
1 change: 1 addition & 0 deletions packages/kbn-field-types/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export enum ES_FIELD_TYPES {

STRING = 'string',
TEXT = 'text',
MATCH_ONLY_TEXT = 'match_only_text',
KEYWORD = 'keyword',
VERSION = 'version',

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,17 @@
* Side Public License, v 1.
*/

export const createOrUpgradeSavedConfigMock = jest.fn();
jest.doMock('./create_or_upgrade_saved_config', () => ({
createOrUpgradeSavedConfig: createOrUpgradeSavedConfigMock,
import type { TransformConfigFn } from '../saved_objects';
import type { getUpgradeableConfig } from './get_upgradeable_config';

export const mockTransform = jest.fn() as jest.MockedFunction<TransformConfigFn>;
jest.mock('../saved_objects', () => ({
transforms: [mockTransform],
}));

export const mockGetUpgradeableConfig = jest.fn() as jest.MockedFunction<
typeof getUpgradeableConfig
>;
jest.mock('./get_upgradeable_config', () => ({
getUpgradeableConfig: mockGetUpgradeableConfig,
}));
Loading

0 comments on commit 4cc7200

Please sign in to comment.