use of com.amazonaws.services.kinesisvideo.model.DescribeStreamResult in project aws-sdk-android by aws-amplify.
the class KinesisVideoAndroidServiceClient method describeStream.
@Override
public StreamDescription describeStream(@NonNull final String streamName, long timeoutInMillis, @Nullable final KinesisVideoCredentialsProvider credentialsProvider) throws KinesisVideoException {
final AWSKinesisVideoClient serviceClient = createAwsKinesisVideoClient(credentialsProvider, Region.getRegion(Regions.fromName(configuration.getRegion())), configuration.getEndpoint(), (int) timeoutInMillis);
final DescribeStreamRequest describeStreamRequest = new DescribeStreamRequest().withStreamName(streamName);
log.debug("calling describe stream: " + describeStreamRequest.toString());
final DescribeStreamResult describeStreamResult;
try {
describeStreamResult = serviceClient.describeStream(describeStreamRequest);
} catch (final AmazonClientException e) {
log.exception(e, "Service call failed.");
throw new KinesisVideoException(e);
}
if (null == describeStreamResult) {
log.debug("describe stream returned null");
return null;
}
log.debug("describe stream result: " + describeStreamResult.toString());
return toStreamDescription(describeStreamResult);
}
use of com.amazonaws.services.kinesisvideo.model.DescribeStreamResult in project aws-iot-greengrass-edge-connector-for-kinesis-video-stream by awslabs.
the class KvsClientTest method testRegionOverride.
@Test
public void testRegionOverride() {
// when
this.kvsClient = new KvsClient(awsCredentialsProvider, region);
DescribeStreamResult describeStreamResult = new DescribeStreamResult().withStreamInfo(new StreamInfo().withStreamName(STREAM_NAME));
when(amazonKinesisVideoClient.describeStream(any())).thenReturn(describeStreamResult);
// then and verify
assertThrows(EdgeConnectorForKVSException.class, () -> {
kvsClient.describeStream(STREAM_NAME);
});
}
use of com.amazonaws.services.kinesisvideo.model.DescribeStreamResult in project aws-iot-greengrass-edge-connector-for-kinesis-video-stream by awslabs.
the class KvsClientTest method describeStream_Success.
@Test
public void describeStream_Success() {
// when
DescribeStreamResult describeStreamResult = new DescribeStreamResult().withStreamInfo(new StreamInfo().withStreamName(STREAM_NAME));
when(amazonKinesisVideoClient.describeStream(any())).thenReturn(describeStreamResult);
// then
Optional<StreamInfo> result = kvsClient.describeStream(STREAM_NAME);
// verify
assertEquals(result.get().getStreamName(), STREAM_NAME);
}
Aggregations