Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into ml-add-annotation…
Browse files Browse the repository at this point in the history
…-markers-in-context-brush-area
  • Loading branch information
qn895 committed Nov 4, 2020
2 parents 3fb8c08 + c3f4024 commit d54048a
Show file tree
Hide file tree
Showing 342 changed files with 9,300 additions and 2,975 deletions.
15 changes: 9 additions & 6 deletions .github/ISSUE_TEMPLATE/v8_breaking_change.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ assignees: ''
****************************************
Please add a "NeededFor:${TeamName}" label to denote the team that is
requesting the breaking change is surfaced in the Upgrade Assistant.
requesting the breaking change to be surfaced in the Upgrade Assistant.
-->

Expand All @@ -27,21 +27,24 @@ requesting the breaking change is surfaced in the Upgrade Assistant.

**How many users will be affected?**

<!-- e.g., Based on telemetry data, roughly 75% of our users will need to make changes to x -->
<!-- e.g., A majority of users will need to make changes to x. -->
<!-- e.g. Based on telemetry data, roughly 75% of our users will need to make changes to x. -->
<!-- e.g. A majority of users will need to make changes to x. -->

**What can users do to address the change manually?**

<!-- If applicable, describe the manual workaround -->
<!-- If applicable, describe the manual migration steps and/or link to available docs. -->

**How could we make migration easier with the Upgrade Assistant?**

<!-- This can be as basic as notifying the user about the deprecation and linking to some
migration docs, or as advanced as a dedicated UI for fixing the problem. -->

**Are there any edge cases?**

## Test Data

Provide test data. We can’t build a solution without data to test it against.
<!-- Provide test data. We can’t build a solution without data to test it against. -->

## Cross links

Cross-link to relevant [Elasticsearch breaking changes](https://www.elastic.co/guide/en/elasticsearch/reference/master/breaking-changes-8.0.html).
<!-- Provide context. Cross-link to relevant [Elasticsearch breaking changes](https://www.elastic.co/guide/en/elasticsearch/reference/master/breaking-changes-8.0.html), PRs that introduced the breaking change, or other related issues. -->
86 changes: 85 additions & 1 deletion docs/api/spaces-management/get_all.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,38 @@ experimental[] Retrieve all {kib} spaces.

`GET <kibana host>:<port>/api/spaces/space`

[[spaces-api-get-all-query-params]]
==== Query parameters

`purpose`::
(Optional, string) Valid options include `any`, `copySavedObjectsIntoSpace`, and `shareSavedObjectsIntoSpace`. This determines what
authorization checks are applied to the API call. If `purpose` is not provided in the URL, the `any` purpose is used.

`include_authorized_purposes`::
(Optional, boolean) When enabled, the API will return any spaces that the user is authorized to access in any capacity, and each space
will contain the purpose(s) for which the user is authorized. This can be useful to determine which spaces a user can read but not take a
specific action in. If the Security plugin is not enabled, this will have no effect, as no authorization checks would take place.
+
NOTE: This option cannot be used in conjunction with `purpose`.

[[spaces-api-get-all-response-codes]]
==== Response code

`200`::
Indicates a successful call.

[[spaces-api-get-all-example]]
==== Example
==== Examples

[[spaces-api-get-all-example-1]]
===== Default options

Retrieve all spaces without specifying any options:

[source,sh]
--------------------------------------------------
$ curl -X GET api/spaces/space
--------------------------------------------------

The API returns the following:

Expand Down Expand Up @@ -51,3 +75,63 @@ The API returns the following:
}
]
--------------------------------------------------

[[spaces-api-get-all-example-2]]
===== Custom options

The user has read-only access to the Sales space. Retrieve all spaces and specify options:

[source,sh]
--------------------------------------------------
$ curl -X GET api/spaces/space?purpose=shareSavedObjectsIntoSpace&include_authorized_purposes=true
--------------------------------------------------

The API returns the following:

[source,sh]
--------------------------------------------------
[
{
"id": "default",
"name": "Default",
"description" : "This is the Default Space",
"disabledFeatures": [],
"imageUrl": "",
"_reserved": true,
"authorizedPurposes": {
"any": true,
"copySavedObjectsIntoSpace": true,
"findSavedObjects": true,
"shareSavedObjectsIntoSpace": true,
}
},
{
"id": "marketing",
"name": "Marketing",
"description" : "This is the Marketing Space",
"color": "#aabbcc",
"disabledFeatures": ["apm"],
"initials": "MK",
"imageUrl": "data:image/png;base64,iVBORw0KGgoAAAANSU",
"authorizedPurposes": {
"any": true,
"copySavedObjectsIntoSpace": true,
"findSavedObjects": true,
"shareSavedObjectsIntoSpace": true,
}
},
{
"id": "sales",
"name": "Sales",
"initials": "MK",
"disabledFeatures": ["discover", "timelion"],
"imageUrl": "",
"authorizedPurposes": {
"any": true,
"copySavedObjectsIntoSpace": false,
"findSavedObjects": true,
"shareSavedObjectsIntoSpace": false,
}
}
]
--------------------------------------------------
2 changes: 1 addition & 1 deletion docs/developer/best-practices/typescript.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Run `node scripts/find_plugins_without_ts_refs.js --id your_plugin_id` to get a

[discrete]
==== Implementation
- Make sure all the plugins listed as dependencies in `kibana.json` file have migrated to TS project references.
- Make sure all the plugins listed as dependencies in *requiredPlugins*, *optionalPlugins* & *requiredBundles* properties of `kibana.json` manifest file have migrated to TS project references.
- Add `tsconfig.json` in the root folder of your plugin.
[source,json]
----
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export interface ExpressionFunctionDefinitions
| [font](./kibana-plugin-plugins-expressions-public.expressionfunctiondefinitions.font.md) | <code>ExpressionFunctionFont</code> | |
| [kibana\_context](./kibana-plugin-plugins-expressions-public.expressionfunctiondefinitions.kibana_context.md) | <code>ExpressionFunctionKibanaContext</code> | |
| [kibana](./kibana-plugin-plugins-expressions-public.expressionfunctiondefinitions.kibana.md) | <code>ExpressionFunctionKibana</code> | |
| [moving\_average](./kibana-plugin-plugins-expressions-public.expressionfunctiondefinitions.moving_average.md) | <code>ExpressionFunctionMovingAverage</code> | |
| [theme](./kibana-plugin-plugins-expressions-public.expressionfunctiondefinitions.theme.md) | <code>ExpressionFunctionTheme</code> | |
| [var\_set](./kibana-plugin-plugins-expressions-public.expressionfunctiondefinitions.var_set.md) | <code>ExpressionFunctionVarSet</code> | |
| [var](./kibana-plugin-plugins-expressions-public.expressionfunctiondefinitions.var.md) | <code>ExpressionFunctionVar</code> | |
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-plugins-expressions-public](./kibana-plugin-plugins-expressions-public.md) &gt; [ExpressionFunctionDefinitions](./kibana-plugin-plugins-expressions-public.expressionfunctiondefinitions.md) &gt; [moving\_average](./kibana-plugin-plugins-expressions-public.expressionfunctiondefinitions.moving_average.md)

## ExpressionFunctionDefinitions.moving\_average property

<b>Signature:</b>

```typescript
moving_average: ExpressionFunctionMovingAverage;
```
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export interface ExpressionFunctionDefinitions
| [font](./kibana-plugin-plugins-expressions-server.expressionfunctiondefinitions.font.md) | <code>ExpressionFunctionFont</code> | |
| [kibana\_context](./kibana-plugin-plugins-expressions-server.expressionfunctiondefinitions.kibana_context.md) | <code>ExpressionFunctionKibanaContext</code> | |
| [kibana](./kibana-plugin-plugins-expressions-server.expressionfunctiondefinitions.kibana.md) | <code>ExpressionFunctionKibana</code> | |
| [moving\_average](./kibana-plugin-plugins-expressions-server.expressionfunctiondefinitions.moving_average.md) | <code>ExpressionFunctionMovingAverage</code> | |
| [theme](./kibana-plugin-plugins-expressions-server.expressionfunctiondefinitions.theme.md) | <code>ExpressionFunctionTheme</code> | |
| [var\_set](./kibana-plugin-plugins-expressions-server.expressionfunctiondefinitions.var_set.md) | <code>ExpressionFunctionVarSet</code> | |
| [var](./kibana-plugin-plugins-expressions-server.expressionfunctiondefinitions.var.md) | <code>ExpressionFunctionVar</code> | |
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-plugins-expressions-server](./kibana-plugin-plugins-expressions-server.md) &gt; [ExpressionFunctionDefinitions](./kibana-plugin-plugins-expressions-server.expressionfunctiondefinitions.md) &gt; [moving\_average](./kibana-plugin-plugins-expressions-server.expressionfunctiondefinitions.moving_average.md)

## ExpressionFunctionDefinitions.moving\_average property

<b>Signature:</b>

```typescript
moving_average: ExpressionFunctionMovingAverage;
```
2 changes: 1 addition & 1 deletion packages/kbn-dev-utils/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export {
KBN_P12_PATH,
KBN_P12_PASSWORD,
} from './certs';
export { KbnClient } from './kbn_client';
export * from './kbn_client';
export * from './run';
export * from './axios';
export * from './stdio';
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-dev-utils/src/kbn_client/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@
* under the License.
*/

export { KbnClient } from './kbn_client';
export * from './kbn_client';
export { uriencode } from './kbn_client_requester';
54 changes: 36 additions & 18 deletions packages/kbn-dev-utils/src/kbn_client/kbn_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,37 +18,55 @@
*/

import { ToolingLog } from '../tooling_log';
import { KibanaConfig, KbnClientRequester, ReqOptions } from './kbn_client_requester';
import { KbnClientRequester, ReqOptions } from './kbn_client_requester';
import { KbnClientStatus } from './kbn_client_status';
import { KbnClientPlugins } from './kbn_client_plugins';
import { KbnClientVersion } from './kbn_client_version';
import { KbnClientSavedObjects } from './kbn_client_saved_objects';
import { KbnClientUiSettings, UiSettingValues } from './kbn_client_ui_settings';

export interface KbnClientOptions {
url: string;
certificateAuthorities?: Buffer[];
log: ToolingLog;
uiSettingDefaults?: UiSettingValues;
}

export class KbnClient {
private readonly requester = new KbnClientRequester(this.log, this.kibanaConfig);
readonly status = new KbnClientStatus(this.requester);
readonly plugins = new KbnClientPlugins(this.status);
readonly version = new KbnClientVersion(this.status);
readonly savedObjects = new KbnClientSavedObjects(this.log, this.requester);
readonly uiSettings = new KbnClientUiSettings(this.log, this.requester, this.uiSettingDefaults);
readonly status: KbnClientStatus;
readonly plugins: KbnClientPlugins;
readonly version: KbnClientVersion;
readonly savedObjects: KbnClientSavedObjects;
readonly uiSettings: KbnClientUiSettings;

private readonly requester: KbnClientRequester;
private readonly log: ToolingLog;
private readonly uiSettingDefaults?: UiSettingValues;

/**
* Basic Kibana server client that implements common behaviors for talking
* to the Kibana server from dev tooling.
*
* @param log ToolingLog
* @param kibanaUrls Array of kibana server urls to send requests to
* @param uiSettingDefaults Map of uiSetting values that will be merged with all uiSetting resets
*/
constructor(
private readonly log: ToolingLog,
private readonly kibanaConfig: KibanaConfig,
private readonly uiSettingDefaults?: UiSettingValues
) {
if (!kibanaConfig.url) {
throw new Error('missing Kibana urls');
constructor(options: KbnClientOptions) {
if (!options.url) {
throw new Error('missing Kibana url');
}
if (!options.log) {
throw new Error('missing ToolingLog');
}

this.log = options.log;
this.uiSettingDefaults = options.uiSettingDefaults;

this.requester = new KbnClientRequester(this.log, {
url: options.url,
certificateAuthorities: options.certificateAuthorities,
});
this.status = new KbnClientStatus(this.requester);
this.plugins = new KbnClientPlugins(this.status);
this.version = new KbnClientVersion(this.status);
this.savedObjects = new KbnClientSavedObjects(this.log, this.requester);
this.uiSettings = new KbnClientUiSettings(this.log, this.requester, this.uiSettingDefaults);
}

/**
Expand Down
24 changes: 10 additions & 14 deletions packages/kbn-dev-utils/src/kbn_client/kbn_client_requester.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,31 +69,27 @@ const delay = (ms: number) =>
setTimeout(resolve, ms);
});

export interface KibanaConfig {
interface Options {
url: string;
ssl?: {
enabled: boolean;
key: string;
certificate: string;
certificateAuthorities: string;
};
certificateAuthorities?: Buffer[];
}

export class KbnClientRequester {
private readonly url: string;
private readonly httpsAgent: Https.Agent | null;
constructor(private readonly log: ToolingLog, private readonly kibanaConfig: KibanaConfig) {

constructor(private readonly log: ToolingLog, options: Options) {
this.url = options.url;
this.httpsAgent =
kibanaConfig.ssl && kibanaConfig.ssl.enabled
Url.parse(options.url).protocol === 'https:'
? new Https.Agent({
cert: kibanaConfig.ssl.certificate,
key: kibanaConfig.ssl.key,
ca: kibanaConfig.ssl.certificateAuthorities,
ca: options.certificateAuthorities,
})
: null;
}

private pickUrl() {
return this.kibanaConfig.url;
return this.url;
}

public resolveUrl(relativeUrl: string = '/') {
Expand Down Expand Up @@ -132,7 +128,7 @@ export class KbnClientRequester {
errorMessage = `Conflict on GET (path=${options.path}, attempt=${attempt}/${maxAttempts})`;
this.log.error(errorMessage);
} else if (requestedRetries || failedToGetResponse) {
errorMessage = `[${description}] request failed (attempt=${attempt}/${maxAttempts})`;
errorMessage = `[${description}] request failed (attempt=${attempt}/${maxAttempts}): ${error.message}`;
this.log.error(errorMessage);
} else {
throw error;
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-es-archiver/src/es_archiver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export class EsArchiver {
this.client = client;
this.dataDir = dataDir;
this.log = log;
this.kbnClient = new KbnClient(log, { url: kibanaUrl });
this.kbnClient = new KbnClient({ log, url: kibanaUrl });
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,7 @@ const urlPartsSchema = () =>
password: Joi.string(),
pathname: Joi.string().regex(/^\//, 'start with a /'),
hash: Joi.string().regex(/^\//, 'start with a /'),
ssl: Joi.object()
.keys({
enabled: Joi.boolean().default(false),
certificate: Joi.string().optional(),
certificateAuthorities: Joi.string().optional(),
key: Joi.string().optional(),
})
.default(),
certificateAuthorities: Joi.array().items(Joi.binary()).optional(),
})
.default();

Expand Down
2 changes: 1 addition & 1 deletion scripts/functional_tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const alwaysImportedTests = [
require.resolve('../test/functional/config.js'),
require.resolve('../test/plugin_functional/config.ts'),
require.resolve('../test/ui_capabilities/newsfeed_err/config.ts'),
require.resolve('../test/new_visualize_flow/config.js'),
require.resolve('../test/new_visualize_flow/config.ts'),
require.resolve('../test/security_functional/config.ts'),
];
// eslint-disable-next-line no-restricted-syntax
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,17 @@ RUN chmod -R g=u /usr/share/kibana
FROM {{{baseOSImage}}}
EXPOSE 5601

{{#ubi}}
# https://github.com/rpm-software-management/microdnf/issues/50
RUN mkdir -p /run/user/$(id -u)

# crypto-policies not currently compatible with libnss :sadpanda:
RUN printf "[main]\nexclude=crypto-policies" > /etc/dnf/dnf.conf
{{/ubi}}

RUN for iter in {1..10}; do \
# update microdnf to have exclusion feature for dnf configuration
{{packageManager}} update microdnf --setopt=tsflags=nodocs -y && \
{{packageManager}} update --setopt=tsflags=nodocs -y && \
{{packageManager}} install --setopt=tsflags=nodocs -y \
fontconfig freetype shadow-utils libnss3.so {{#ubi}}findutils{{/ubi}} && \
Expand Down
Loading

0 comments on commit d54048a

Please sign in to comment.