Search in sources :

Example 1 with CreateStreamResult

use of com.amazonaws.services.kinesisvideo.model.CreateStreamResult in project aws-iot-greengrass-edge-connector-for-kinesis-video-stream by awslabs.

the class KvsClientTest method createStream_Success.

@Test
public void createStream_Success() {
    // when
    CreateStreamResult result = new CreateStreamResult();
    when(amazonKinesisVideoClient.createStream(any())).thenReturn(result);
    // then
    kvsClient.createStream(STREAM_NAME);
    // verify
    verify(amazonKinesisVideoClient).createStream(createStreamRequestCaptor.capture());
    assertEquals(createStreamRequestCaptor.getValue().getStreamName(), STREAM_NAME);
}
Also used : CreateStreamResult(com.amazonaws.services.kinesisvideo.model.CreateStreamResult) Test(org.junit.jupiter.api.Test)

Example 2 with CreateStreamResult

use of com.amazonaws.services.kinesisvideo.model.CreateStreamResult 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

CreateStreamResult (com.amazonaws.services.kinesisvideo.model.CreateStreamResult)2 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 Test (org.junit.jupiter.api.Test)1