You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
|[SavedObjectsSerializer](./kibana-plugin-server.savedobjectsserializer.md)| A serializer that can be used to manually convert [raw](./kibana-plugin-server.savedobjectsrawdoc.md) or [sanitized](./kibana-plugin-server.savedobjectsanitizeddoc.md) documents to the other kind. |
30
+
|[SavedObjectTypeRegistry](./kibana-plugin-server.savedobjecttyperegistry.md)| Registry holding information about all the registered [saved object types](./kibana-plugin-server.savedobjectstype.md)<!---->. |
30
31
|[ScopedClusterClient](./kibana-plugin-server.scopedclusterclient.md)| Serves the same purpose as "normal" <code>ClusterClient</code> but exposes additional <code>callAsCurrentUser</code> method that doesn't use credentials of the Kibana internal user (as <code>callAsInternalUser</code> does) to request Elasticsearch API, but rather passes HTTP headers extracted from the current user request to the API.<!---->See [ScopedClusterClient](./kibana-plugin-server.scopedclusterclient.md)<!---->. |
31
32
32
33
## Enumerations
@@ -108,6 +109,7 @@ The plugin integrates with the core system via lifecycle events: `setup`<!-- -->
108
109
|[RouteValidatorOptions](./kibana-plugin-server.routevalidatoroptions.md)| Additional options for the RouteValidator class to modify its default behaviour. |
|[SavedObjectAttributes](./kibana-plugin-server.savedobjectattributes.md)| The data for a Saved Object is stored as an object in the <code>attributes</code> property. |
112
+
|[SavedObjectMigrationContext](./kibana-plugin-server.savedobjectmigrationcontext.md)| Migration context provided when invoking a [migration handler](./kibana-plugin-server.savedobjectmigrationfn.md)|
111
113
|[SavedObjectMigrationMap](./kibana-plugin-server.savedobjectmigrationmap.md)| A map of [migration functions](./kibana-plugin-server.savedobjectmigrationfn.md) to be used for a given type. The map's keys must be valid semver versions.<!---->For a given document, only migrations with a higher version number than that of the document will be applied. Migrations are executed in order, starting from the lowest version and ending with the highest one. |
112
114
|[SavedObjectReference](./kibana-plugin-server.savedobjectreference.md)| A reference to another saved object. |
@@ -143,7 +145,7 @@ The plugin integrates with the core system via lifecycle events: `setup`<!-- -->
143
145
|[SavedObjectsRawDoc](./kibana-plugin-server.savedobjectsrawdoc.md)| A raw document as represented directly in the saved object index. |
144
146
|[SavedObjectsRepositoryFactory](./kibana-plugin-server.savedobjectsrepositoryfactory.md)| Factory provided when invoking a [client factory provider](./kibana-plugin-server.savedobjectsclientfactoryprovider.md) See [SavedObjectsServiceSetup.setClientFactoryProvider](./kibana-plugin-server.savedobjectsservicesetup.setclientfactoryprovider.md)|
145
147
|[SavedObjectsResolveImportErrorsOptions](./kibana-plugin-server.savedobjectsresolveimporterrorsoptions.md)| Options to control the "resolve import" operation. |
146
-
|[SavedObjectsServiceSetup](./kibana-plugin-server.savedobjectsservicesetup.md)| Saved Objects is Kibana's data persistence mechanism allowing plugins to use Elasticsearch for storing and querying state. The SavedObjectsServiceSetup API exposes methods for creating and registering Saved Object client wrappers. |
148
+
|[SavedObjectsServiceSetup](./kibana-plugin-server.savedobjectsservicesetup.md)| Saved Objects is Kibana's data persistence mechanism allowing plugins to use Elasticsearch for storing and querying state. The SavedObjectsServiceSetup API exposes methods for registering Saved Object types, creating and registering Saved Object client wrappers and factories. |
147
149
|[SavedObjectsServiceStart](./kibana-plugin-server.savedobjectsservicestart.md)| Saved Objects is Kibana's data persisentence mechanism allowing plugins to use Elasticsearch for storing and querying state. The SavedObjectsServiceStart API provides a scoped Saved Objects client for interacting with Saved Objects. |
|[SavedObjectsTypeMappingDefinition](./kibana-plugin-server.savedobjectstypemappingdefinition.md)| Describe a saved object type mapping. |
@@ -195,6 +197,7 @@ The plugin integrates with the core system via lifecycle events: `setup`<!-- -->
195
197
|[ICustomClusterClient](./kibana-plugin-server.icustomclusterclient.md)| Represents an Elasticsearch cluster API client created by a plugin. It allows to call API on behalf of the internal Kibana user and the actual user that is derived from the request headers (via <code>asScoped(...)</code>).<!---->See [ClusterClient](./kibana-plugin-server.clusterclient.md)<!---->. |
196
198
|[IsAuthenticated](./kibana-plugin-server.isauthenticated.md)| Returns authentication status for a request. |
197
199
|[ISavedObjectsRepository](./kibana-plugin-server.isavedobjectsrepository.md)| See [SavedObjectsRepository](./kibana-plugin-server.savedobjectsrepository.md)|
200
+
|[ISavedObjectTypeRegistry](./kibana-plugin-server.isavedobjecttyperegistry.md)| See [SavedObjectTypeRegistry](./kibana-plugin-server.savedobjecttyperegistry.md) for documentation. |
198
201
|[IScopedClusterClient](./kibana-plugin-server.iscopedclusterclient.md)| Serves the same purpose as "normal" <code>ClusterClient</code> but exposes additional <code>callAsCurrentUser</code> method that doesn't use credentials of the Kibana internal user (as <code>callAsInternalUser</code> does) to request Elasticsearch API, but rather passes HTTP headers extracted from the current user request to the API.<!---->See [ScopedClusterClient](./kibana-plugin-server.scopedclusterclient.md)<!---->. |
199
202
|[KibanaRequestRouteOptions](./kibana-plugin-server.kibanarequestrouteoptions.md)| Route options: If 'GET' or 'OPTIONS' method, body options won't be returned. |
200
203
|[KibanaResponseFactory](./kibana-plugin-server.kibanaresponsefactory.md)| Creates an object containing request response payload, HTTP headers, error details, and other data transmitted to the client. |
@@ -226,7 +229,7 @@ The plugin integrates with the core system via lifecycle events: `setup`<!-- -->
226
229
|[RouteValidatorFullConfig](./kibana-plugin-server.routevalidatorfullconfig.md)| Route validations config and options merged into one object |
227
230
|[SavedObjectAttribute](./kibana-plugin-server.savedobjectattribute.md)| Type definition for a Saved Object attribute value |
228
231
|[SavedObjectAttributeSingle](./kibana-plugin-server.savedobjectattributesingle.md)| Don't use this type, it's simply a helper type for [SavedObjectAttribute](./kibana-plugin-server.savedobjectattribute.md)|
229
-
|[SavedObjectMigrationFn](./kibana-plugin-server.savedobjectmigrationfn.md)| A migration function defined for a [saved objects type](./kibana-plugin-server.savedobjectstype.md) used to migrate it's |
232
+
|[SavedObjectMigrationFn](./kibana-plugin-server.savedobjectmigrationfn.md)| A migration function for a [saved object type](./kibana-plugin-server.savedobjectstype.md) used to migrate it to a given version|
| [SavedObjectsClientContract](./kibana-plugin-server.savedobjectsclientcontract.md) | Saved Objects is Kibana's data persisentence mechanism allowing plugins to use Elasticsearch for storing plugin state.<!-- -->\#\# SavedObjectsClient errors<!-- -->Since the SavedObjectsClient has its hands in everything we are a little paranoid about the way we present errors back to to application code. Ideally, all errors will be either:<!-- -->1. Caused by bad implementation (ie. undefined is not a function) and as such unpredictable 2. An error that has been classified and decorated appropriately by the decorators in [SavedObjectsErrorHelpers](./kibana-plugin-server.savedobjectserrorhelpers.md)<!-- -->Type 1 errors are inevitable, but since all expected/handle-able errors should be Type 2 the <code>isXYZError()</code> helpers exposed at <code>SavedObjectsErrorHelpers</code> should be used to understand and manage error responses from the <code>SavedObjectsClient</code>.<!-- -->Type 2 errors are decorated versions of the source error, so if the elasticsearch client threw an error it will be decorated based on its type. That means that rather than looking for <code>error.body.error.type</code> or doing substring checks on <code>error.body.error.reason</code>, just use the helpers to understand the meaning of the error:<!-- -->\`\`\`<!-- -->js if (SavedObjectsErrorHelpers.isNotFoundError(error)) { // handle 404 }<!-- -->if (SavedObjectsErrorHelpers.isNotAuthorizedError(error)) { // 401 handling should be automatic, but in case you wanted to know }<!-- -->// always rethrow the error unless you handle it throw error; \`\`\`<!-- -->\#\#\# 404s from missing index<!-- -->From the perspective of application code and APIs the SavedObjectsClient is a black box that persists objects. One of the internal details that users have no control over is that we use an elasticsearch index for persistance and that index might be missing.<!-- -->At the time of writing we are in the process of transitioning away from the operating assumption that the SavedObjects index is always available. Part of this transition is handling errors resulting from an index missing. These used to trigger a 500 error in most cases, and in others cause 404s with different error messages.<!-- -->From my (Spencer) perspective, a 404 from the SavedObjectsApi is a 404; The object the request/call was targeting could not be found. This is why \#14141 takes special care to ensure that 404 errors are generic and don't distinguish between index missing or document missing.<!-- -->\#\#\# 503s from missing index<!-- -->Unlike all other methods, create requests are supposed to succeed even when the Kibana index does not exist because it will be automatically created by elasticsearch. When that is not the case it is because Elasticsearch's <code>action.auto_create_index</code> setting prevents it from being created automatically so we throw a special 503 with the intention of informing the user that their Elasticsearch settings need to be updated.<!-- -->See [SavedObjectsClient](./kibana-plugin-server.savedobjectsclient.md) See [SavedObjectsErrorHelpers](./kibana-plugin-server.savedobjectserrorhelpers.md) |
232
235
|[SavedObjectsClientFactory](./kibana-plugin-server.savedobjectsclientfactory.md)| Describes the factory used to create instances of the Saved Objects Client. |
Copy file name to clipboardExpand all lines: docs/development/core/server/kibana-plugin-server.savedobjectsservicesetup.md
+19-5Lines changed: 19 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@
4
4
5
5
## SavedObjectsServiceSetup interface
6
6
7
-
Saved Objects is Kibana's data persistence mechanism allowing plugins to use Elasticsearch for storing and querying state. The SavedObjectsServiceSetup API exposes methods for creating and registering Saved Object client wrappers.
7
+
Saved Objects is Kibana's data persistence mechanism allowing plugins to use Elasticsearch for storing and querying state. The SavedObjectsServiceSetup API exposes methods for registering Saved Object types, creating and registering Saved Object client wrappers and factories.
|[addClientWrapper](./kibana-plugin-server.savedobjectsservicesetup.addclientwrapper.md)| <code>(priority: number, id: string, factory: SavedObjectsClientWrapperFactory) => void</code> | Add a [client wrapper factory](./kibana-plugin-server.savedobjectsclientwrapperfactory.md) with the given priority. |
55
+
|[registerType](./kibana-plugin-server.savedobjectsservicesetup.registertype.md)| <code>(type: SavedObjectsType) => void</code> | Register a [savedObjects type](./kibana-plugin-server.savedobjectstype.md) definition.<!---->See the [mappings format](./kibana-plugin-server.savedobjectstypemappingdefinition.md) and [migration format](./kibana-plugin-server.savedobjectmigrationmap.md) for more details about these. |
42
56
|[setClientFactoryProvider](./kibana-plugin-server.savedobjectsservicesetup.setclientfactoryprovider.md)| <code>(clientFactoryProvider: SavedObjectsClientFactoryProvider) => void</code> | Set the default [factory provider](./kibana-plugin-server.savedobjectsclientfactoryprovider.md) for creating Saved Objects clients. Only one provider can be set, subsequent calls to this method will fail. |
Register a [savedObjects type](./kibana-plugin-server.savedobjectstype.md) definition.
8
+
9
+
See the [mappings format](./kibana-plugin-server.savedobjectstypemappingdefinition.md) and [migration format](./kibana-plugin-server.savedobjectmigrationmap.md) for more details about these.
10
+
11
+
<b>Signature:</b>
12
+
13
+
```typescript
14
+
registerType: (type:SavedObjectsType) =>void;
15
+
```
16
+
17
+
## Remarks
18
+
19
+
The type definition is an aggregation of the legacy savedObjects `schema`<!---->, `mappings` and `migration` concepts. This API is the single entry point to register saved object types in the new platform.
0 commit comments