Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Increase the maximum number of saved objects that could be installed with a Fleet package #148441

Merged
merged 1 commit into from
Jan 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -335,11 +335,11 @@ export class SavedObjectsService
exportSizeLimit: this.config!.maxImportExportSize,
logger: this.logger.get('exporter'),
}),
createImporter: (savedObjectsClient) =>
createImporter: (savedObjectsClient, options) =>
new SavedObjectsImporter({
savedObjectsClient,
typeRegistry: this.typeRegistry,
importSizeLimit: this.config!.maxImportExportSize,
importSizeLimit: options?.importSizeLimit ?? this.config!.maxImportExportSize,
}),
getTypeRegistry: () => this.typeRegistry,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import type {
import type { SavedObjectsType } from './saved_objects_type';
import type { ISavedObjectTypeRegistry } from './type_registry';
import type { ISavedObjectsExporter } from './export';
import type { ISavedObjectsImporter } from './import';
import type { ISavedObjectsImporter, SavedObjectsImporterOptions } from './import';
import type { SavedObjectsExtensions } from './extensions/extensions';

/**
Expand Down Expand Up @@ -200,7 +200,10 @@ export interface SavedObjectsServiceStart {
/**
* Creates an {@link ISavedObjectsImporter | importer} bound to given client.
*/
createImporter: (client: SavedObjectsClientContract) => ISavedObjectsImporter;
createImporter: (
client: SavedObjectsClientContract,
options?: SavedObjectsImporterOptions
) => ISavedObjectsImporter;
/**
* Returns the {@link ISavedObjectTypeRegistry | registry} containing all registered
* {@link SavedObjectsType | saved object types}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,16 @@ export interface ISavedObjectsImporter {
): Promise<SavedObjectsImportResponse>;
}

/**
* Options to control the importer
*
* @public
*/
export interface SavedObjectsImporterOptions {
/** Overwrites the maximum number of saved objects that could be imported */
importSizeLimit?: number;
}

/**
* Options to control the import operation.
* @public
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ async function installPackageFromRegistry({

const savedObjectsImporter = appContextService
.getSavedObjects()
.createImporter(savedObjectsClient);
.createImporter(savedObjectsClient, { importSizeLimit: 15_000 });

const savedObjectTagAssignmentService = appContextService
.getSavedObjectsTagging()
Expand Down