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

@param createStreamRequest An object conforming to the createStream REST API json
@return StreamConfiguration internal object