public static final StreamConfiguration getUpdateStreamConfig ( final UpdateStreamRequest updateStreamRequest ) { ScalingPolicy scalingPolicy ; if ( updateStreamRequest . getScalingPolicy ( ) . getType ( ) == ScalingConfig . TypeEnum . FIXED_NUM_SEGMENTS ) { scalingPolicy = ScalingPolicy . fixed ( updateStreamRequest . getScalingPolicy ( ) . getMinSegments ( ) ) ; } else if ( updateStreamRequest . getScalingPolicy ( ) . getType ( ) == ScalingConfig . TypeEnum . BY_RATE_IN_EVENTS_PER_SEC ) { scalingPolicy = ScalingPolicy . byEventRate ( updateStreamRequest . getScalingPolicy ( ) . getTargetRate ( ) , updateStreamRequest . getScalingPolicy ( ) . getScaleFactor ( ) , updateStreamRequest . getScalingPolicy ( ) . getMinSegments ( ) ) ; } else { scalingPolicy = ScalingPolicy . byDataRate ( updateStreamRequest . getScalingPolicy ( ) . getTargetRate ( ) , updateStreamRequest . getScalingPolicy ( ) . getScaleFactor ( ) , updateStreamRequest . getScalingPolicy ( ) . getMinSegments ( ) ) ; } RetentionPolicy retentionPolicy = null ; if ( updateStreamRequest . getRetentionPolicy ( ) != null ) { switch ( updateStreamRequest . getRetentionPolicy ( ) . getType ( ) ) { case LIMITED_SIZE_MB : retentionPolicy = RetentionPolicy . bySizeBytes ( updateStreamRequest . getRetentionPolicy ( ) . getValue ( ) * 1024 * 1024 ) ; break ; case LIMITED_DAYS : retentionPolicy = RetentionPolicy . byTime ( Duration . ofDays ( updateStreamRequest . getRetentionPolicy ( ) . getValue ( ) ) ) ; break ; } } return StreamConfiguration . builder ( ) . scalingPolicy ( scalingPolicy ) . retentionPolicy ( retentionPolicy ) . build ( ) ; }
This method translates the REST request object UpdateStreamRequest into internal object StreamConfiguration .