Skip to content

Commit e3be25e

Browse files
committed
docs: updated examples
1 parent 5c813b5 commit e3be25e

37 files changed

Lines changed: 7668 additions & 1172 deletions

.cursor/rules/live-tests.mdc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
---
2+
globs: scripts/*
23
alwaysApply: false
34
---
45
## Live Tests Policy (CLI + YAML)

README.md

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ We love how Terraform plans changes before applying, and how kubectl lets you de
3434
| Feature | Description |
3535
|---------|-------------|
3636
| 🌐 **Atlas** | List/get/create/update/delete projects, clusters, users, network access, peering, and network containers |
37+
| 🔍 **Atlas Search** | Create and manage Atlas Search indexes for full-text and vector search capabilities |
38+
| 🔗 **VPC Endpoints** | Configure VPC endpoints and Private Link connections for secure Atlas connectivity |
3739
| 🗄️ **Databases** | List/create/delete databases, collections, and indexes — either via connection string or Atlas cluster reference |
3840
| 👥 **Database Users** | Create/list/update/delete database-specific users with custom roles — via connection string or Atlas cluster reference |
3941
| 📋 **Infra** | Discover current state, plan/diff/apply/destroy via declarative YAML |
@@ -271,6 +273,17 @@ matlas atlas users create --project-id <id> --username testuser --show-password
271273

272274
# List network access rules
273275
matlas atlas network list --project-id <id>
276+
277+
# List Atlas Search indexes
278+
matlas atlas search list --project-id <id> --cluster <name>
279+
280+
# Create a basic search index
281+
matlas atlas search create --project-id <id> --cluster <name> \
282+
--database <db> --collection <coll> --name <index-name> --type search
283+
284+
# Create VPC endpoint
285+
matlas atlas vpc-endpoints create --project-id <id> --provider AWS \
286+
--region us-east-1 --service-name com.amazonaws.vpce.us-east-1.vpce-svc-123
274287
```
275288

276289
### 🗄️ Database Operations
@@ -334,7 +347,10 @@ matlas infra destroy --discovery-only --project-id <id> # Discovery only
334347
Matlas looks for credentials in this order:
335348
1. Command flags/YAML config
336349
2. Environment variables (`ATLAS_API_KEY`, `ATLAS_PUB_KEY`)
337-
3. macOS Keychain (fallback)
350+
3. Platform-specific secure storage:
351+
- **macOS**: Keychain (`security` command)
352+
- **Windows**: Credential Manager (PowerShell)
353+
- **Linux**: secret-service (`secret-tool` or GNOME Keyring)
338354

339355
## 🐚 Shell Completion
340356
Enable auto-completion for your shell:
@@ -385,8 +401,7 @@ cp features/TEMPLATE.md features/$(date +%F)-<short-slug>.md
385401
```
386402

387403
## ⚠️ Current Limitations
388-
- 🔍 **Atlas Search**: Commands exist but return unsupported errors
389-
- 🔗 **VPC Endpoints**: Hidden in current build
404+
- 🔧 **Advanced Configuration**: Some complex cluster configurations (ReplicationSpecs, AutoScaling) require manual Atlas console setup
390405

391406
## 📄 License
392407
**MIT License** - see [`LICENSE`](LICENSE) for details.

cmd/atlas/search/search.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ func NewSearchCmd() *cobra.Command {
2626
Short: "Manage Atlas Search indexes",
2727
Long: "Atlas Search index management commands for full-text and vector search capabilities.",
2828
Aliases: []string{"search-index", "search-indexes"},
29-
Hidden: true, // Hide command as it's still in development
3029
}
3130

3231
// Keep subcommands registered but keep parent hidden; each command returns a clear, consistent message.
@@ -125,7 +124,7 @@ func newCreateCmd() *cobra.Command {
125124

126125
cmd := &cobra.Command{
127126
Use: "create",
128-
Short: "Create an Atlas Search index (unsupported)",
127+
Short: "Create an Atlas Search index",
129128
Long: `Create a new Atlas Search index for full-text search or vector search.
130129
131130
This command creates a new MongoDB Atlas Search index on a collection.
@@ -169,7 +168,7 @@ func newUpdateCmd() *cobra.Command {
169168

170169
cmd := &cobra.Command{
171170
Use: "update",
172-
Short: "Update an Atlas Search index (unsupported)",
171+
Short: "Update an Atlas Search index",
173172
Long: `Update an existing Atlas Search index configuration.
174173
175174
This command updates the configuration of an existing MongoDB Atlas Search index.

cmd/atlas/search/search_test.go

Lines changed: 32 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,46 @@ import (
44
"testing"
55
)
66

7-
// Ensure the command is hidden and returns a consistent unsupported message when executed without required flags.
8-
func TestNewSearchCmd_HiddenAndSubcommands(t *testing.T) {
7+
// Ensure the command is visible and has all expected subcommands available.
8+
func TestNewSearchCmd_VisibleAndSubcommands(t *testing.T) {
99
cmd := NewSearchCmd()
1010
if cmd == nil {
1111
t.Fatalf("expected command, got nil")
1212
}
13-
if !cmd.Hidden {
14-
t.Fatalf("expected search command to be hidden")
13+
if cmd.Hidden {
14+
t.Fatalf("expected search command to be visible, but it was hidden")
1515
}
16-
// Ensure common subcommands are present
16+
17+
// Verify command properties
18+
if cmd.Use != "search" {
19+
t.Errorf("expected Use to be 'search', got '%s'", cmd.Use)
20+
}
21+
if cmd.Short == "" {
22+
t.Error("expected Short description to be non-empty")
23+
}
24+
if cmd.Long == "" {
25+
t.Error("expected Long description to be non-empty")
26+
}
27+
28+
// Verify aliases are present
29+
expectedAliases := []string{"search-index", "search-indexes"}
30+
if len(cmd.Aliases) != len(expectedAliases) {
31+
t.Errorf("expected %d aliases, got %d", len(expectedAliases), len(cmd.Aliases))
32+
}
33+
34+
// Ensure all expected subcommands are present
1735
found := map[string]bool{}
1836
for _, c := range cmd.Commands() {
1937
found[c.Use] = true
2038
}
21-
if !found["list"] || !found["get"] || !found["create"] || !found["update"] || !found["delete"] {
22-
t.Fatalf("expected standard subcommands to be present, got: %+v", found)
39+
expectedCommands := []string{"list", "get", "create", "update", "delete"}
40+
for _, expectedCmd := range expectedCommands {
41+
if !found[expectedCmd] {
42+
t.Errorf("expected subcommand '%s' to be present", expectedCmd)
43+
}
44+
}
45+
46+
if len(found) != len(expectedCommands) {
47+
t.Errorf("expected exactly %d subcommands, got %d: %+v", len(expectedCommands), len(found), found)
2348
}
2449
}

0 commit comments

Comments
 (0)