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
10 changes: 9 additions & 1 deletion __test__/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import test from 'ava'

import { Client } from '../index'

test('smoke test: list deployments', async (t) => {
test('smoke test', async (t) => {
let client: Client | null = null

try {
Expand All @@ -20,8 +20,16 @@ test('smoke test: list deployments', async (t) => {
return
}

// TODO: Implement once createDeployment is added
// let deploymentName = "test_deployment"
// await client.createDeployment(...)

// List deployments
// We don't care about the number, we're just testing that the method doesn't fail
await client.listDeployments()

// TODO: Uncommment when createDeployment is added
// await client.deleteDeployment(deploymentName)

t.pass()
})
10 changes: 6 additions & 4 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@
export declare class Client {
static connect(): Client
listDeployments(): Promise<Array<Deployment>>
deleteDeployment(deploymentName: string): Promise<void>
}

export declare const enum BindingType {
Loopback = 'Loopback',
AnyInterface = 'AnyInterface',
Specific = 'Specific',
Specific = 'Specific'
}

export interface CreationSource {
Expand All @@ -19,7 +20,8 @@ export interface CreationSource {
export declare const enum CreationSourceType {
AtlasCLI = 'AtlasCLI',
Container = 'Container',
Other = 'Other',
MCP = 'MCP',
Other = 'Other'
}

export interface Deployment {
Expand Down Expand Up @@ -50,7 +52,7 @@ export interface MongoDbPortBinding {

export declare const enum MongodbType {
Community = 'Community',
Enterprise = 'Enterprise',
Enterprise = 'Enterprise'
}

export declare const enum State {
Expand All @@ -60,5 +62,5 @@ export declare const enum State {
Paused = 'Paused',
Removing = 'Removing',
Restarting = 'Restarting',
Running = 'Running',
Running = 'Running'
}
9 changes: 9 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,13 @@ impl Client {
.context("list deployments")
.map(|deployments| deployments.into_iter().map(|d| d.into()).collect())
}

#[napi]
pub async fn delete_deployment(&self, deployment_name: String) -> Result<()> {
self
.client
.delete_deployment(&deployment_name)
.await
.context("delete deployments")
}
}
1 change: 1 addition & 0 deletions src/models/list_deployments.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ pub struct CreationSource {
pub enum CreationSourceType {
AtlasCLI,
Container,
MCP,
Other,
}

Expand Down
Loading