# -*- coding: utf-8 -*-
"""
@Author ： Rocky
@Time ： 2022/10/17 16:57
@File ：AmazonKVSUtil.py
"""
import boto3


class AmazonKVSObject:
    def __init__(self, aws_access_key_id, secret_access_key, region_name):
        self.access_id = aws_access_key_id
        self.access_secret = secret_access_key
        self.region_name = region_name
        self.client_conn = boto3.client(
            'kinesis-video-media',
            aws_access_key_id=aws_access_key_id,
            aws_secret_access_key=secret_access_key,
            region_name=region_name
        )

    def get_media(self, stream_name):
        """
        获取视频流数据保留时间
        @param stream_name: 视频流名称
        @param shard_count: 碎片数量
        @return : boolean
        """
        try:
            self.client_conn.get_media(StreamName=stream_name)
            return True
        except Exception as e:
            print(e)
            return False
