Search in sources :

Example 1 with AWSKinesisVideoClient

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

the class KinesisVideoAndroidServiceClient method tagStream.

@Override
public void tagStream(@NonNull final String streamArn, @Nullable final Map<String, String> tags, long timeoutInMillis, @Nullable final KinesisVideoCredentialsProvider credentialsProvider) throws KinesisVideoException {
    final AWSKinesisVideoClient serviceClient = createAwsKinesisVideoClient(credentialsProvider, Region.getRegion(Regions.fromName(configuration.getRegion())), configuration.getEndpoint(), (int) timeoutInMillis);
    final TagStreamRequest tagStreamRequest = new TagStreamRequest().withStreamARN(streamArn).withTags(tags);
    log.debug("calling tag resource: " + tagStreamRequest.toString());
    final TagStreamResult tagStreamResult;
    try {
        tagStreamResult = serviceClient.tagStream(tagStreamRequest);
    } catch (final AmazonClientException e) {
        log.exception(e, "Service call failed.");
        throw new KinesisVideoException(e);
    }
    log.debug("tag resource result: " + tagStreamResult.toString());
}
Also used : AWSKinesisVideoClient(com.amazonaws.services.kinesisvideo.AWSKinesisVideoClient) AmazonClientException(com.amazonaws.AmazonClientException) TagStreamRequest(com.amazonaws.services.kinesisvideo.model.TagStreamRequest) KinesisVideoException(com.amazonaws.kinesisvideo.common.exception.KinesisVideoException) TagStreamResult(com.amazonaws.services.kinesisvideo.model.TagStreamResult)

Example 2 with AWSKinesisVideoClient

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

the class KinesisVideoAndroidServiceClient method createAwsKinesisVideoClient.

private static AWSKinesisVideoClient createAwsKinesisVideoClient(final AWSCredentials credentials, final Region region, final String endpoint, final int timeoutInMillis) throws KinesisVideoException {
    final ClientConfiguration clientConfiguration = createClientConfiguration(timeoutInMillis);
    final AWSKinesisVideoClient awsKinesisVideoClient = new AWSKinesisVideoClient(credentials, clientConfiguration);
    awsKinesisVideoClient.setRegion(region);
    awsKinesisVideoClient.setSignerRegionOverride(region.getName());
    awsKinesisVideoClient.setServiceNameIntern("kinesisvideo");
    awsKinesisVideoClient.setEndpoint(endpoint);
    return awsKinesisVideoClient;
}
Also used : AWSKinesisVideoClient(com.amazonaws.services.kinesisvideo.AWSKinesisVideoClient) KinesisVideoClientConfiguration(com.amazonaws.kinesisvideo.client.KinesisVideoClientConfiguration) ClientConfiguration(com.amazonaws.ClientConfiguration)

Example 3 with AWSKinesisVideoClient

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

the class KinesisVideoAndroidServiceClient method deleteStream.

@Override
public void deleteStream(@NonNull final String streamName, @NonNull final String version, final Date creationTime, long timeoutInMillis, @Nullable final KinesisVideoCredentialsProvider credentialsProvider) throws KinesisVideoException {
    final AWSKinesisVideoClient serviceClient = createAwsKinesisVideoClient(credentialsProvider, Region.getRegion(Regions.fromName(configuration.getRegion())), configuration.getEndpoint(), (int) timeoutInMillis);
    final StreamDescription streamDescription = describeStream(streamName, timeoutInMillis, credentialsProvider);
    final DeleteStreamRequest deleteStreamRequest = new DeleteStreamRequest().withStreamARN(streamDescription.getStreamArn()).withCurrentVersion(streamDescription.getUpdateVersion());
    log.debug("calling delete stream: " + deleteStreamRequest.toString());
    final DeleteStreamResult deleteStreamResult;
    try {
        deleteStreamResult = serviceClient.deleteStream(deleteStreamRequest);
    } catch (final AmazonClientException e) {
        log.exception(e, "Service call failed.");
        throw new KinesisVideoException(e);
    }
    log.debug("delete stream result: " + deleteStreamResult.toString());
}
Also used : DeleteStreamRequest(com.amazonaws.services.kinesisvideo.model.DeleteStreamRequest) DeleteStreamResult(com.amazonaws.services.kinesisvideo.model.DeleteStreamResult) AWSKinesisVideoClient(com.amazonaws.services.kinesisvideo.AWSKinesisVideoClient) StreamDescription(com.amazonaws.kinesisvideo.producer.StreamDescription) AmazonClientException(com.amazonaws.AmazonClientException) KinesisVideoException(com.amazonaws.kinesisvideo.common.exception.KinesisVideoException)

Example 4 with AWSKinesisVideoClient

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

the class KinesisVideoAndroidServiceClient method getDataEndpoint.

@Override
public String getDataEndpoint(@NonNull final String streamName, @NonNull final String apiName, long timeoutInMillis, @Nullable final KinesisVideoCredentialsProvider credentialsProvider) throws KinesisVideoException {
    final AWSKinesisVideoClient serviceClient = createAwsKinesisVideoClient(credentialsProvider, Region.getRegion(Regions.fromName(configuration.getRegion())), configuration.getEndpoint(), (int) timeoutInMillis);
    final GetDataEndpointRequest getDataEndpointRequest = new GetDataEndpointRequest().withStreamName(streamName).withAPIName(apiName);
    log.debug("calling get data endpoint: " + getDataEndpointRequest.toString());
    final GetDataEndpointResult getDataEndpointResult;
    try {
        getDataEndpointResult = serviceClient.getDataEndpoint(getDataEndpointRequest);
    } catch (final AmazonClientException e) {
        log.exception(e, "Service call failed.");
        throw new KinesisVideoException(e);
    }
    log.debug("get data endpoint result: " + getDataEndpointResult.toString());
    return getDataEndpointResult.getDataEndpoint();
}
Also used : AWSKinesisVideoClient(com.amazonaws.services.kinesisvideo.AWSKinesisVideoClient) AmazonClientException(com.amazonaws.AmazonClientException) GetDataEndpointRequest(com.amazonaws.services.kinesisvideo.model.GetDataEndpointRequest) GetDataEndpointResult(com.amazonaws.services.kinesisvideo.model.GetDataEndpointResult) KinesisVideoException(com.amazonaws.kinesisvideo.common.exception.KinesisVideoException)

Example 5 with AWSKinesisVideoClient

use of com.amazonaws.services.kinesisvideo.AWSKinesisVideoClient 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)

Aggregations

AWSKinesisVideoClient (com.amazonaws.services.kinesisvideo.AWSKinesisVideoClient)6 AmazonClientException (com.amazonaws.AmazonClientException)5 KinesisVideoException (com.amazonaws.kinesisvideo.common.exception.KinesisVideoException)5 ClientConfiguration (com.amazonaws.ClientConfiguration)1 KinesisVideoClientConfiguration (com.amazonaws.kinesisvideo.client.KinesisVideoClientConfiguration)1 StreamDescription (com.amazonaws.kinesisvideo.producer.StreamDescription)1 CreateStreamRequest (com.amazonaws.services.kinesisvideo.model.CreateStreamRequest)1 CreateStreamResult (com.amazonaws.services.kinesisvideo.model.CreateStreamResult)1 DeleteStreamRequest (com.amazonaws.services.kinesisvideo.model.DeleteStreamRequest)1 DeleteStreamResult (com.amazonaws.services.kinesisvideo.model.DeleteStreamResult)1 DescribeStreamRequest (com.amazonaws.services.kinesisvideo.model.DescribeStreamRequest)1 DescribeStreamResult (com.amazonaws.services.kinesisvideo.model.DescribeStreamResult)1 GetDataEndpointRequest (com.amazonaws.services.kinesisvideo.model.GetDataEndpointRequest)1 GetDataEndpointResult (com.amazonaws.services.kinesisvideo.model.GetDataEndpointResult)1 TagStreamRequest (com.amazonaws.services.kinesisvideo.model.TagStreamRequest)1 TagStreamResult (com.amazonaws.services.kinesisvideo.model.TagStreamResult)1