diff --git a/packages/i18n/src/locales/en_US.ts b/packages/i18n/src/locales/en_US.ts index 9d186d5d0..0016b5421 100644 --- a/packages/i18n/src/locales/en_US.ts +++ b/packages/i18n/src/locales/en_US.ts @@ -2894,6 +2894,10 @@ const translations: Catalog = { description: 'Show a list of all the named connections for this instance from the Connection Registry.', }, + listWorkspaceDefaults: { + description: + 'Show the default tier and maxTierSize for the stream processor workspace.', + }, }, }, }, diff --git a/packages/shell-api/src/streams.spec.ts b/packages/shell-api/src/streams.spec.ts index 538045b10..68995d790 100644 --- a/packages/shell-api/src/streams.spec.ts +++ b/packages/shell-api/src/streams.spec.ts @@ -312,4 +312,22 @@ describe('Streams', function () { ).to.be.true; }); }); + + describe('listWorkspaceDefaults', function () { + it('returns tier and maxTierSize', async function () { + const runCmdStub = sinon + .stub(mongo._serviceProvider, 'runCommand') + .resolves({ ok: 1, defaultTierSize: 'SP2', maxTierSize: 'SP30' }); + + const result = await streams.listWorkspaceDefaults(); + expect(result).to.eql({ + ok: 1, + defaultTierSize: 'SP2', + maxTierSize: 'SP30', + }); + + const cmd = { listWorkspaceDefaults: 1 }; + expect(runCmdStub.calledOnceWithExactly('admin', cmd, {})).to.be.true; + }); + }); }); diff --git a/packages/shell-api/src/streams.ts b/packages/shell-api/src/streams.ts index 1a1797909..f2c2047e2 100644 --- a/packages/shell-api/src/streams.ts +++ b/packages/shell-api/src/streams.ts @@ -13,6 +13,11 @@ import type Mongo from './mongo'; import type { GenericDatabaseSchema, GenericServerSideSchema } from './helpers'; import type { MQLPipeline } from './mql-types'; +type WorkspaceDefaults = { + defaultTierSize: string; + maxTierSize: string; +}; + @shellApiClassDefault export class Streams< M extends GenericServerSideSchema = GenericServerSideSchema, @@ -162,6 +167,13 @@ export class Streams< }); } + @returnsPromise + async listWorkspaceDefaults(): Promise { + return (await this._runStreamCommand({ + listWorkspaceDefaults: 1, + })) as WorkspaceDefaults; + } + async _runStreamCommand(cmd: Document, options: Document = {}) { return this._mongo._serviceProvider.runCommand(ADMIN_DB, cmd, options); // run cmd }