Search in sources :

Example 1 with CreateStreamRequest

use of com.amazonaws.services.kinesisvideo.model.CreateStreamRequest in project aws-sdk-android by aws-amplify.

the class KinesisVideoAndroidServiceClient method createStream.

@Override
public String createStream(@NonNull final String streamName, @NonNull final String deviceName, @NonNull final String contentType, @Nullable final String kmsKeyId, long retentionPeriodInHours, long timeoutInMillis, @Nullable final KinesisVideoCredentialsProvider credentialsProvider) throws KinesisVideoException {
    final AWSKinesisVideoClient serviceClient = createAwsKinesisVideoClient(credentialsProvider, Region.getRegion(Regions.fromName(configuration.getRegion())), configuration.getEndpoint(), (int) timeoutInMillis);
    final CreateStreamRequest createStreamRequest = new CreateStreamRequest().withStreamName(streamName).withDeviceName(deviceName).withMediaType(contentType).withKmsKeyId(StringUtils.isBlank(kmsKeyId) ? null : kmsKeyId).withDataRetentionInHours((int) retentionPeriodInHours).withTags(null);
    log.debug("calling create stream: " + createStreamRequest.toString());
    final CreateStreamResult createStreamResult;
    try {
        createStreamResult = serviceClient.createStream(createStreamRequest);
    } catch (final AmazonClientException e) {
        // Wrap into an KinesisVideoException object
        log.exception(e, "Service call failed.");
        throw new KinesisVideoException(e);
    }
    log.debug("create stream result: " + createStreamResult.toString());
    return createStreamResult.getStreamARN();
}
Also used : AWSKinesisVideoClient(com.amazonaws.services.kinesisvideo.AWSKinesisVideoClient) CreateStreamResult(com.amazonaws.services.kinesisvideo.model.CreateStreamResult) CreateStreamRequest(com.amazonaws.services.kinesisvideo.model.CreateStreamRequest) AmazonClientException(com.amazonaws.AmazonClientException) KinesisVideoException(com.amazonaws.kinesisvideo.common.exception.KinesisVideoException)

Aggregations

AmazonClientException (com.amazonaws.AmazonClientException)1 KinesisVideoException (com.amazonaws.kinesisvideo.common.exception.KinesisVideoException)1 AWSKinesisVideoClient (com.amazonaws.services.kinesisvideo.AWSKinesisVideoClient)1 CreateStreamRequest (com.amazonaws.services.kinesisvideo.model.CreateStreamRequest)1 CreateStreamResult (com.amazonaws.services.kinesisvideo.model.CreateStreamResult)1