Skip to content
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
4 changes: 4 additions & 0 deletions packages/i18n/src/locales/en_US.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.',
},
},
},
},
Expand Down
18 changes: 18 additions & 0 deletions packages/shell-api/src/streams.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
});
});
});
12 changes: 12 additions & 0 deletions packages/shell-api/src/streams.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -162,6 +167,13 @@ export class Streams<
});
}

@returnsPromise
async listWorkspaceDefaults(): Promise<WorkspaceDefaults> {
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
}
Expand Down
Loading