import { checkExceptions , createWaiter , WaiterConfiguration , WaiterResult , WaiterState } from "@aws-sdk/util-waiter" ; import { DescribeReplicationTasksCommand , DescribeReplicationTasksCommandInput , } from "../commands/DescribeReplicationTasksCommand" ; import { DatabaseMigrationServiceClient } from "../DatabaseMigrationServiceClient" ; const checkState = async ( client , input ) : Promise < WaiterResult > => { let reason ; try { const result = await client . send ( new DescribeReplicationTasksCommand ( input ) ) ; reason = result ; try { const returnComparator = ( ) => { const flat_1 = [ ] . concat ( ... result . ReplicationTasks ) ; const projection_3 = flat_1 . map ( ( element_2 ) => { return element_2 . Status ; } ) ; return projection_3 ; } ; let allStringEq_5 = returnComparator ( ) . length > 0 ; for ( const element_4 of returnComparator ( ) ) { allStringEq_5 = allStringEq_5 && element_4 == "ready" ; } if ( allStringEq_5 ) { return { state : WaiterState . SUCCESS , reason } ; } } catch ( e ) { } try { const returnComparator = ( ) => { const flat_1 = [ ] . concat ( ... result . ReplicationTasks ) ; const projection_3 = flat_1 . map ( ( element_2 ) => { return element_2 . Status ; } ) ; return projection_3 ; } ; for ( const anyStringEq_4 of returnComparator ( ) ) { if ( anyStringEq_4 == "starting" ) { return { state : WaiterState . FAILURE , reason } ; } } } catch ( e ) { } try { const returnComparator = ( ) => { const flat_1 = [ ] . concat ( ... result . ReplicationTasks ) ; const projection_3 = flat_1 . map ( ( element_2 ) => { return element_2 . Status ; } ) ; return projection_3 ; } ; for ( const anyStringEq_4 of returnComparator ( ) ) { if ( anyStringEq_4 == "running" ) { return { state : WaiterState . FAILURE , reason } ; } } } catch ( e ) { } try { const returnComparator = ( ) => { const flat_1 = [ ] . concat ( ... result . ReplicationTasks ) ; const projection_3 = flat_1 . map ( ( element_2 ) => { return element_2 . Status ; } ) ; return projection_3 ; } ; for ( const anyStringEq_4 of returnComparator ( ) ) { if ( anyStringEq_4 == "stopping" ) { return { state : WaiterState . FAILURE , reason } ; } } } catch ( e ) { } try { const returnComparator = ( ) => { const flat_1 = [ ] . concat ( ... result . ReplicationTasks ) ; const projection_3 = flat_1 . map ( ( element_2 ) => { return element_2 . Status ; } ) ; return projection_3 ; } ; for ( const anyStringEq_4 of returnComparator ( ) ) { if ( anyStringEq_4 == "stopped" ) { return { state : WaiterState . FAILURE , reason } ; } } } catch ( e ) { } try { const returnComparator = ( ) => { const flat_1 = [ ] . concat ( ... result . ReplicationTasks ) ; const projection_3 = flat_1 . map ( ( element_2 ) => { return element_2 . Status ; } ) ; return projection_3 ; } ; for ( const anyStringEq_4 of returnComparator ( ) ) { if ( anyStringEq_4 == "failed" ) { return { state : WaiterState . FAILURE , reason } ; } } } catch ( e ) { } try { const returnComparator = ( ) => { const flat_1 = [ ] . concat ( ... result . ReplicationTasks ) ; const projection_3 = flat_1 . map ( ( element_2 ) => { return element_2 . Status ; } ) ; return projection_3 ; } ; for ( const anyStringEq_4 of returnComparator ( ) ) { if ( anyStringEq_4 == "modifying" ) { return { state : WaiterState . FAILURE , reason } ; } } } catch ( e ) { } try { const returnComparator = ( ) => { const flat_1 = [ ] . concat ( ... result . ReplicationTasks ) ; const projection_3 = flat_1 . map ( ( element_2 ) => { return element_2 . Status ; } ) ; return projection_3 ; } ; for ( const anyStringEq_4 of returnComparator ( ) ) { if ( anyStringEq_4 == "testing" ) { return { state : WaiterState . FAILURE , reason } ; } } } catch ( e ) { } try { const returnComparator = ( ) => { const flat_1 = [ ] . concat ( ... result . ReplicationTasks ) ; const projection_3 = flat_1 . map ( ( element_2 ) => { return element_2 . Status ; } ) ; return projection_3 ; } ; for ( const anyStringEq_4 of returnComparator ( ) ) { if ( anyStringEq_4 == "deleting" ) { return { state : WaiterState . FAILURE , reason } ; } } } catch ( e ) { } } catch ( exception ) { reason = exception ; } return { state : WaiterState . RETRY , reason } ; } ; deprecated export const waitForReplicationTaskReady = async ( params , input ) : Promise < WaiterResult > => { const serviceDefaults = { minDelay : 15 , maxDelay : 120 } ; return createWaiter ( { ... serviceDefaults , ... params } , input , checkState ) ; } ; param params param input export const waitUntilReplicationTaskReady = async ( params , input ) : Promise < WaiterResult > => { const serviceDefaults = { minDelay : 15 , maxDelay : 120 } ; const result = await createWaiter ( { ... serviceDefaults , ... params } , input , checkState ) ; return checkExceptions ( result ) ; } ;