-
Notifications
You must be signed in to change notification settings - Fork 4
Implementation for Atlas Service Discovery Programmatic Access #267
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
base: next
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR implements MongoDB Atlas Service Discovery functionality by adding programmatic access to Atlas APIs. It introduces a new plugin module for the service-mongo-atlas service that handles both OAuth 2.0 and HTTP Digest authentication methods for Atlas API operations.
Key changes include:
- Addition of Atlas HTTP client for API communication with authentication support
- Credential caching system for Atlas organizations with OAuth token management
- Atlas administration client for managing projects, clusters, database users, and IP access lists
Reviewed Changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| src/plugins/service-mongo-atlas/utils/AtlasHttpClient.ts | HTTP client for Atlas API requests with OAuth and Digest authentication |
| src/plugins/service-mongo-atlas/utils/AtlasCredentialCache.ts | Credential storage and management for Atlas organizations |
| src/plugins/service-mongo-atlas/utils/AtlasAuthManager.ts | Authentication manager for OAuth token handling and credential management |
| src/plugins/service-mongo-atlas/utils/AtlasAdministrationClient.ts | Administration client for Atlas resource management operations |
| package.json | Added digest-fetch dependency for HTTP Digest authentication |
| l10n/bundle.l10n.json | Added localization strings for Atlas-related error messages |
| // eslint-disable-next-line @typescript-eslint/no-unsafe-call | ||
| const client = new DigestClient(publicKey, privateKey) as DigestFetchClient; |
Copilot
AI
Sep 11, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The eslint-disable comment and type assertion suggest potential type safety issues. Consider creating proper type definitions for DigestClient instead of disabling the safety check and using type assertions.
| clientId, | ||
| clientSecret, | ||
| }, | ||
| digest: undefined, // Clear any existing digest credentials |
Copilot
AI
Sep 11, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Explicitly setting digest to undefined when setting OAuth credentials could be simplified by restructuring the credential object or using a more explicit credential switching mechanism to avoid potential confusion.
| value: string; | ||
| }>; | ||
| withDefaultAlertsSettings?: boolean; | ||
| } |
Copilot
AI
Sep 11, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The AtlasProject interface is missing proper return type annotations. According to the coding guidelines, TypeScript interfaces should be used for object shapes and all properties should have explicit types.
|
@tnaum-ms |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 12 out of 14 changed files in this pull request and generated 3 comments.
| } | ||
|
|
||
| // Add 60 second buffer to avoid edge cases | ||
| return Date.now() < oauth.tokenExpiry - 60000; |
Copilot
AI
Sep 14, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The 60-second buffer (60000ms) is a magic number. Consider extracting this as a named constant like TOKEN_EXPIRY_BUFFER_MS = 60000 to improve code readability and maintainability.
Linked Issue: