Java Code Examples for com.amazonaws.services.kinesisvideo.AmazonKinesisVideo#describeStream()

The following examples show how to use com.amazonaws.services.kinesisvideo.AmazonKinesisVideo#describeStream() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DemoAppCachedInfo.java    From amazon-kinesis-video-streams-producer-sdk-java with Apache License 2.0 6 votes vote down vote up
private static void addCachedStreamInfoWithCredentialsProvider(CachedInfoMultiAuthServiceCallbacksImpl serviceCallbacks,
                                                               String streamName,
                                                               AWSCredentialsProvider credentialsProvider,
                                                               String region) {
    // Set up credentials provider for the stream name
    serviceCallbacks.addCredentialsProviderToCache(streamName, credentialsProvider);

    // Set up stream info for the stream name
    AmazonKinesisVideo kvsClient = AmazonKinesisVideoClientBuilder.standard()
            .withRegion(region)
            .withCredentials(credentialsProvider)
            .build();
    DescribeStreamResult streamInfo = kvsClient.describeStream(new DescribeStreamRequest().withStreamName(streamName));
    serviceCallbacks.addStreamInfoToCache(streamName, streamInfo);

    // Set up endpoint for the stream name
    GetDataEndpointResult dataEndpoint =
            kvsClient.getDataEndpoint(new GetDataEndpointRequest().withAPIName(APIName.PUT_MEDIA).withStreamName(streamName));
    serviceCallbacks.addStreamingEndpointToCache(streamName, dataEndpoint.getDataEndpoint());
}
 
Example 2
Source File: JavaKinesisVideoServiceClient.java    From amazon-kinesis-video-streams-producer-sdk-java with Apache License 2.0 5 votes vote down vote up
@Override
public StreamDescription describeStream(@Nonnull final String streamName,
        final long timeoutInMillis,
        @Nullable final KinesisVideoCredentialsProvider credentialsProvider)
        throws KinesisVideoException {
    final AmazonKinesisVideo serviceClient = createAmazonKinesisVideoClient(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);
}