@@ -22,8 +22,9 @@ export async function makeCurrentIpAccessListEntry(
2222 * If the IP is already present, this is a no-op.
2323 * @param apiClient The Atlas API client instance
2424 * @param projectId The Atlas project ID
25+ * @returns Promise<boolean> - true if a new IP access list entry was created, false if it already existed
2526 */
26- export async function ensureCurrentIpInAccessList ( apiClient : ApiClient , projectId : string ) : Promise < void > {
27+ export async function ensureCurrentIpInAccessList ( apiClient : ApiClient , projectId : string ) : Promise < boolean > {
2728 const entry = await makeCurrentIpAccessListEntry ( apiClient , projectId , DEFAULT_ACCESS_LIST_COMMENT ) ;
2829 try {
2930 await apiClient . createProjectIpAccessList ( {
@@ -35,6 +36,7 @@ export async function ensureCurrentIpInAccessList(apiClient: ApiClient, projectI
3536 context : "accessListUtils" ,
3637 message : `IP access list created: ${ JSON . stringify ( entry ) } ` ,
3738 } ) ;
39+ return true ;
3840 } catch ( err ) {
3941 if ( err instanceof ApiClientError && err . response ?. status === 409 ) {
4042 // 409 Conflict: entry already exists, log info
@@ -43,12 +45,13 @@ export async function ensureCurrentIpInAccessList(apiClient: ApiClient, projectI
4345 context : "accessListUtils" ,
4446 message : `IP address ${ entry . ipAddress } is already present in the access list for project ${ projectId } .` ,
4547 } ) ;
46- return ;
48+ return false ;
4749 }
4850 apiClient . logger . warning ( {
4951 id : LogId . atlasIpAccessListAddFailure ,
5052 context : "accessListUtils" ,
5153 message : `Error adding IP access list: ${ err instanceof Error ? err . message : String ( err ) } ` ,
5254 } ) ;
5355 }
56+ return false ;
5457}
0 commit comments