Search in sources :

Example 1 with DescribeStreamResult

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);
}
Also used : AWSKinesisVideoClient(com.amazonaws.services.kinesisvideo.AWSKinesisVideoClient) AmazonClientException(com.amazonaws.AmazonClientException) DescribeStreamRequest(com.amazonaws.services.kinesisvideo.model.DescribeStreamRequest) DescribeStreamResult(com.amazonaws.services.kinesisvideo.model.DescribeStreamResult) KinesisVideoException(com.amazonaws.kinesisvideo.common.exception.KinesisVideoException)

Example 2 with 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);
    });
}
Also used : StreamInfo(com.amazonaws.services.kinesisvideo.model.StreamInfo) DescribeStreamResult(com.amazonaws.services.kinesisvideo.model.DescribeStreamResult) Test(org.junit.jupiter.api.Test)

Example 3 with 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 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);
}
Also used : StreamInfo(com.amazonaws.services.kinesisvideo.model.StreamInfo) DescribeStreamResult(com.amazonaws.services.kinesisvideo.model.DescribeStreamResult) Test(org.junit.jupiter.api.Test)

Aggregations

DescribeStreamResult (com.amazonaws.services.kinesisvideo.model.DescribeStreamResult)3 StreamInfo (com.amazonaws.services.kinesisvideo.model.StreamInfo)2 Test (org.junit.jupiter.api.Test)2 AmazonClientException (com.amazonaws.AmazonClientException)1 KinesisVideoException (com.amazonaws.kinesisvideo.common.exception.KinesisVideoException)1 AWSKinesisVideoClient (com.amazonaws.services.kinesisvideo.AWSKinesisVideoClient)1 DescribeStreamRequest (com.amazonaws.services.kinesisvideo.model.DescribeStreamRequest)1