use std::error::Error;
use std::fmt;
#[allow(warnings)]
use futures::future;
use futures::Future;
use rusoto_core::credential::ProvideAwsCredentials;
use rusoto_core::region;
use rusoto_core::request::{BufferedHttpResponse, DispatchSignedRequest};
use rusoto_core::{Client, RusotoError, RusotoFuture};
use rusoto_core::proto;
use rusoto_core::signature::SignedRequest;
use serde_json;
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct CreateStreamInput {
#[serde(rename = "DataRetentionInHours")]
#[serde(skip_serializing_if = "Option::is_none")]
pub data_retention_in_hours: Option<i64>,
#[serde(rename = "DeviceName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub device_name: Option<String>,
#[serde(rename = "KmsKeyId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub kms_key_id: Option<String>,
#[serde(rename = "MediaType")]
#[serde(skip_serializing_if = "Option::is_none")]
pub media_type: Option<String>,
#[serde(rename = "StreamName")]
pub stream_name: String,
#[serde(rename = "Tags")]
#[serde(skip_serializing_if = "Option::is_none")]
pub tags: Option<::std::collections::HashMap<String, String>>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct CreateStreamOutput {
#[serde(rename = "StreamARN")]
#[serde(skip_serializing_if = "Option::is_none")]
pub stream_arn: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DeleteStreamInput {
#[serde(rename = "CurrentVersion")]
#[serde(skip_serializing_if = "Option::is_none")]
pub current_version: Option<String>,
#[serde(rename = "StreamARN")]
pub stream_arn: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DeleteStreamOutput {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DescribeStreamInput {
#[serde(rename = "StreamARN")]
#[serde(skip_serializing_if = "Option::is_none")]
pub stream_arn: Option<String>,
#[serde(rename = "StreamName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub stream_name: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DescribeStreamOutput {
#[serde(rename = "StreamInfo")]
#[serde(skip_serializing_if = "Option::is_none")]
pub stream_info: Option<StreamInfo>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetDataEndpointInput {
#[serde(rename = "APIName")]
pub api_name: String,
#[serde(rename = "StreamARN")]
#[serde(skip_serializing_if = "Option::is_none")]
pub stream_arn: Option<String>,
#[serde(rename = "StreamName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub stream_name: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct GetDataEndpointOutput {
#[serde(rename = "DataEndpoint")]
#[serde(skip_serializing_if = "Option::is_none")]
pub data_endpoint: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ListStreamsInput {
#[serde(rename = "MaxResults")]
#[serde(skip_serializing_if = "Option::is_none")]
pub max_results: Option<i64>,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "StreamNameCondition")]
#[serde(skip_serializing_if = "Option::is_none")]
pub stream_name_condition: Option<StreamNameCondition>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ListStreamsOutput {
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "StreamInfoList")]
#[serde(skip_serializing_if = "Option::is_none")]
pub stream_info_list: Option<Vec<StreamInfo>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ListTagsForStreamInput {
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "StreamARN")]
#[serde(skip_serializing_if = "Option::is_none")]
pub stream_arn: Option<String>,
#[serde(rename = "StreamName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub stream_name: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ListTagsForStreamOutput {
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "Tags")]
#[serde(skip_serializing_if = "Option::is_none")]
pub tags: Option<::std::collections::HashMap<String, String>>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct StreamInfo {
#[serde(rename = "CreationTime")]
#[serde(skip_serializing_if = "Option::is_none")]
pub creation_time: Option<f64>,
#[serde(rename = "DataRetentionInHours")]
#[serde(skip_serializing_if = "Option::is_none")]
pub data_retention_in_hours: Option<i64>,
#[serde(rename = "DeviceName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub device_name: Option<String>,
#[serde(rename = "KmsKeyId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub kms_key_id: Option<String>,
#[serde(rename = "MediaType")]
#[serde(skip_serializing_if = "Option::is_none")]
pub media_type: Option<String>,
#[serde(rename = "Status")]
#[serde(skip_serializing_if = "Option::is_none")]
pub status: Option<String>,
#[serde(rename = "StreamARN")]
#[serde(skip_serializing_if = "Option::is_none")]
pub stream_arn: Option<String>,
#[serde(rename = "StreamName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub stream_name: Option<String>,
#[serde(rename = "Version")]
#[serde(skip_serializing_if = "Option::is_none")]
pub version: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct StreamNameCondition {
#[serde(rename = "ComparisonOperator")]
#[serde(skip_serializing_if = "Option::is_none")]
pub comparison_operator: Option<String>,
#[serde(rename = "ComparisonValue")]
#[serde(skip_serializing_if = "Option::is_none")]
pub comparison_value: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct TagStreamInput {
#[serde(rename = "StreamARN")]
#[serde(skip_serializing_if = "Option::is_none")]
pub stream_arn: Option<String>,
#[serde(rename = "StreamName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub stream_name: Option<String>,
#[serde(rename = "Tags")]
pub tags: ::std::collections::HashMap<String, String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct TagStreamOutput {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct UntagStreamInput {
#[serde(rename = "StreamARN")]
#[serde(skip_serializing_if = "Option::is_none")]
pub stream_arn: Option<String>,
#[serde(rename = "StreamName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub stream_name: Option<String>,
#[serde(rename = "TagKeyList")]
pub tag_key_list: Vec<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct UntagStreamOutput {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct UpdateDataRetentionInput {
#[serde(rename = "CurrentVersion")]
pub current_version: String,
#[serde(rename = "DataRetentionChangeInHours")]
pub data_retention_change_in_hours: i64,
#[serde(rename = "Operation")]
pub operation: String,
#[serde(rename = "StreamARN")]
#[serde(skip_serializing_if = "Option::is_none")]
pub stream_arn: Option<String>,
#[serde(rename = "StreamName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub stream_name: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct UpdateDataRetentionOutput {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct UpdateStreamInput {
#[serde(rename = "CurrentVersion")]
pub current_version: String,
#[serde(rename = "DeviceName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub device_name: Option<String>,
#[serde(rename = "MediaType")]
#[serde(skip_serializing_if = "Option::is_none")]
pub media_type: Option<String>,
#[serde(rename = "StreamARN")]
#[serde(skip_serializing_if = "Option::is_none")]
pub stream_arn: Option<String>,
#[serde(rename = "StreamName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub stream_name: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct UpdateStreamOutput {}
#[derive(Debug, PartialEq)]
pub enum CreateStreamError {
AccountStreamLimitExceeded(String),
ClientLimitExceeded(String),
DeviceStreamLimitExceeded(String),
InvalidArgument(String),
InvalidDevice(String),
ResourceInUse(String),
TagsPerResourceExceededLimit(String),
}
impl CreateStreamError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<CreateStreamError> {
if let Some(err) = proto::json::Error::parse_rest(&res) {
match err.typ.as_str() {
"AccountStreamLimitExceededException" => {
return RusotoError::Service(CreateStreamError::AccountStreamLimitExceeded(
err.msg,
))
}
"ClientLimitExceededException" => {
return RusotoError::Service(CreateStreamError::ClientLimitExceeded(err.msg))
}
"DeviceStreamLimitExceededException" => {
return RusotoError::Service(CreateStreamError::DeviceStreamLimitExceeded(
err.msg,
))
}
"InvalidArgumentException" => {
return RusotoError::Service(CreateStreamError::InvalidArgument(err.msg))
}
"InvalidDeviceException" => {
return RusotoError::Service(CreateStreamError::InvalidDevice(err.msg))
}
"ResourceInUseException" => {
return RusotoError::Service(CreateStreamError::ResourceInUse(err.msg))
}
"TagsPerResourceExceededLimitException" => {
return RusotoError::Service(CreateStreamError::TagsPerResourceExceededLimit(
err.msg,
))
}
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
return RusotoError::Unknown(res);
}
}
impl fmt::Display for CreateStreamError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for CreateStreamError {
fn description(&self) -> &str {
match *self {
CreateStreamError::AccountStreamLimitExceeded(ref cause) => cause,
CreateStreamError::ClientLimitExceeded(ref cause) => cause,
CreateStreamError::DeviceStreamLimitExceeded(ref cause) => cause,
CreateStreamError::InvalidArgument(ref cause) => cause,
CreateStreamError::InvalidDevice(ref cause) => cause,
CreateStreamError::ResourceInUse(ref cause) => cause,
CreateStreamError::TagsPerResourceExceededLimit(ref cause) => cause,
}
}
}
#[derive(Debug, PartialEq)]
pub enum DeleteStreamError {
ClientLimitExceeded(String),
InvalidArgument(String),
NotAuthorized(String),
ResourceNotFound(String),
VersionMismatch(String),
}
impl DeleteStreamError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<DeleteStreamError> {
if let Some(err) = proto::json::Error::parse_rest(&res) {
match err.typ.as_str() {
"ClientLimitExceededException" => {
return RusotoError::Service(DeleteStreamError::ClientLimitExceeded(err.msg))
}
"InvalidArgumentException" => {
return RusotoError::Service(DeleteStreamError::InvalidArgument(err.msg))
}
"NotAuthorizedException" => {
return RusotoError::Service(DeleteStreamError::NotAuthorized(err.msg))
}
"ResourceNotFoundException" => {
return RusotoError::Service(DeleteStreamError::ResourceNotFound(err.msg))
}
"VersionMismatchException" => {
return RusotoError::Service(DeleteStreamError::VersionMismatch(err.msg))
}
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
return RusotoError::Unknown(res);
}
}
impl fmt::Display for DeleteStreamError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DeleteStreamError {
fn description(&self) -> &str {
match *self {
DeleteStreamError::ClientLimitExceeded(ref cause) => cause,
DeleteStreamError::InvalidArgument(ref cause) => cause,
DeleteStreamError::NotAuthorized(ref cause) => cause,
DeleteStreamError::ResourceNotFound(ref cause) => cause,
DeleteStreamError::VersionMismatch(ref cause) => cause,
}
}
}
#[derive(Debug, PartialEq)]
pub enum DescribeStreamError {
ClientLimitExceeded(String),
InvalidArgument(String),
NotAuthorized(String),
ResourceNotFound(String),
}
impl DescribeStreamError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<DescribeStreamError> {
if let Some(err) = proto::json::Error::parse_rest(&res) {
match err.typ.as_str() {
"ClientLimitExceededException" => {
return RusotoError::Service(DescribeStreamError::ClientLimitExceeded(err.msg))
}
"InvalidArgumentException" => {
return RusotoError::Service(DescribeStreamError::InvalidArgument(err.msg))
}
"NotAuthorizedException" => {
return RusotoError::Service(DescribeStreamError::NotAuthorized(err.msg))
}
"ResourceNotFoundException" => {
return RusotoError::Service(DescribeStreamError::ResourceNotFound(err.msg))
}
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
return RusotoError::Unknown(res);
}
}
impl fmt::Display for DescribeStreamError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DescribeStreamError {
fn description(&self) -> &str {
match *self {
DescribeStreamError::ClientLimitExceeded(ref cause) => cause,
DescribeStreamError::InvalidArgument(ref cause) => cause,
DescribeStreamError::NotAuthorized(ref cause) => cause,
DescribeStreamError::ResourceNotFound(ref cause) => cause,
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetDataEndpointError {
ClientLimitExceeded(String),
InvalidArgument(String),
NotAuthorized(String),
ResourceNotFound(String),
}
impl GetDataEndpointError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<GetDataEndpointError> {
if let Some(err) = proto::json::Error::parse_rest(&res) {
match err.typ.as_str() {
"ClientLimitExceededException" => {
return RusotoError::Service(GetDataEndpointError::ClientLimitExceeded(err.msg))
}
"InvalidArgumentException" => {
return RusotoError::Service(GetDataEndpointError::InvalidArgument(err.msg))
}
"NotAuthorizedException" => {
return RusotoError::Service(GetDataEndpointError::NotAuthorized(err.msg))
}
"ResourceNotFoundException" => {
return RusotoError::Service(GetDataEndpointError::ResourceNotFound(err.msg))
}
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
return RusotoError::Unknown(res);
}
}
impl fmt::Display for GetDataEndpointError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetDataEndpointError {
fn description(&self) -> &str {
match *self {
GetDataEndpointError::ClientLimitExceeded(ref cause) => cause,
GetDataEndpointError::InvalidArgument(ref cause) => cause,
GetDataEndpointError::NotAuthorized(ref cause) => cause,
GetDataEndpointError::ResourceNotFound(ref cause) => cause,
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListStreamsError {
ClientLimitExceeded(String),
InvalidArgument(String),
}
impl ListStreamsError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<ListStreamsError> {
if let Some(err) = proto::json::Error::parse_rest(&res) {
match err.typ.as_str() {
"ClientLimitExceededException" => {
return RusotoError::Service(ListStreamsError::ClientLimitExceeded(err.msg))
}
"InvalidArgumentException" => {
return RusotoError::Service(ListStreamsError::InvalidArgument(err.msg))
}
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
return RusotoError::Unknown(res);
}
}
impl fmt::Display for ListStreamsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListStreamsError {
fn description(&self) -> &str {
match *self {
ListStreamsError::ClientLimitExceeded(ref cause) => cause,
ListStreamsError::InvalidArgument(ref cause) => cause,
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListTagsForStreamError {
ClientLimitExceeded(String),
InvalidArgument(String),
InvalidResourceFormat(String),
NotAuthorized(String),
ResourceNotFound(String),
}
impl ListTagsForStreamError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<ListTagsForStreamError> {
if let Some(err) = proto::json::Error::parse_rest(&res) {
match err.typ.as_str() {
"ClientLimitExceededException" => {
return RusotoError::Service(ListTagsForStreamError::ClientLimitExceeded(
err.msg,
))
}
"InvalidArgumentException" => {
return RusotoError::Service(ListTagsForStreamError::InvalidArgument(err.msg))
}
"InvalidResourceFormatException" => {
return RusotoError::Service(ListTagsForStreamError::InvalidResourceFormat(
err.msg,
))
}
"NotAuthorizedException" => {
return RusotoError::Service(ListTagsForStreamError::NotAuthorized(err.msg))
}
"ResourceNotFoundException" => {
return RusotoError::Service(ListTagsForStreamError::ResourceNotFound(err.msg))
}
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
return RusotoError::Unknown(res);
}
}
impl fmt::Display for ListTagsForStreamError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListTagsForStreamError {
fn description(&self) -> &str {
match *self {
ListTagsForStreamError::ClientLimitExceeded(ref cause) => cause,
ListTagsForStreamError::InvalidArgument(ref cause) => cause,
ListTagsForStreamError::InvalidResourceFormat(ref cause) => cause,
ListTagsForStreamError::NotAuthorized(ref cause) => cause,
ListTagsForStreamError::ResourceNotFound(ref cause) => cause,
}
}
}
#[derive(Debug, PartialEq)]
pub enum TagStreamError {
ClientLimitExceeded(String),
InvalidArgument(String),
InvalidResourceFormat(String),
NotAuthorized(String),
ResourceNotFound(String),
TagsPerResourceExceededLimit(String),
}
impl TagStreamError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<TagStreamError> {
if let Some(err) = proto::json::Error::parse_rest(&res) {
match err.typ.as_str() {
"ClientLimitExceededException" => {
return RusotoError::Service(TagStreamError::ClientLimitExceeded(err.msg))
}
"InvalidArgumentException" => {
return RusotoError::Service(TagStreamError::InvalidArgument(err.msg))
}
"InvalidResourceFormatException" => {
return RusotoError::Service(TagStreamError::InvalidResourceFormat(err.msg))
}
"NotAuthorizedException" => {
return RusotoError::Service(TagStreamError::NotAuthorized(err.msg))
}
"ResourceNotFoundException" => {
return RusotoError::Service(TagStreamError::ResourceNotFound(err.msg))
}
"TagsPerResourceExceededLimitException" => {
return RusotoError::Service(TagStreamError::TagsPerResourceExceededLimit(
err.msg,
))
}
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
return RusotoError::Unknown(res);
}
}
impl fmt::Display for TagStreamError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for TagStreamError {
fn description(&self) -> &str {
match *self {
TagStreamError::ClientLimitExceeded(ref cause) => cause,
TagStreamError::InvalidArgument(ref cause) => cause,
TagStreamError::InvalidResourceFormat(ref cause) => cause,
TagStreamError::NotAuthorized(ref cause) => cause,
TagStreamError::ResourceNotFound(ref cause) => cause,
TagStreamError::TagsPerResourceExceededLimit(ref cause) => cause,
}
}
}
#[derive(Debug, PartialEq)]
pub enum UntagStreamError {
ClientLimitExceeded(String),
InvalidArgument(String),
InvalidResourceFormat(String),
NotAuthorized(String),
ResourceNotFound(String),
}
impl UntagStreamError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<UntagStreamError> {
if let Some(err) = proto::json::Error::parse_rest(&res) {
match err.typ.as_str() {
"ClientLimitExceededException" => {
return RusotoError::Service(UntagStreamError::ClientLimitExceeded(err.msg))
}
"InvalidArgumentException" => {
return RusotoError::Service(UntagStreamError::InvalidArgument(err.msg))
}
"InvalidResourceFormatException" => {
return RusotoError::Service(UntagStreamError::InvalidResourceFormat(err.msg))
}
"NotAuthorizedException" => {
return RusotoError::Service(UntagStreamError::NotAuthorized(err.msg))
}
"ResourceNotFoundException" => {
return RusotoError::Service(UntagStreamError::ResourceNotFound(err.msg))
}
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
return RusotoError::Unknown(res);
}
}
impl fmt::Display for UntagStreamError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for UntagStreamError {
fn description(&self) -> &str {
match *self {
UntagStreamError::ClientLimitExceeded(ref cause) => cause,
UntagStreamError::InvalidArgument(ref cause) => cause,
UntagStreamError::InvalidResourceFormat(ref cause) => cause,
UntagStreamError::NotAuthorized(ref cause) => cause,
UntagStreamError::ResourceNotFound(ref cause) => cause,
}
}
}
#[derive(Debug, PartialEq)]
pub enum UpdateDataRetentionError {
ClientLimitExceeded(String),
InvalidArgument(String),
NotAuthorized(String),
ResourceInUse(String),
ResourceNotFound(String),
VersionMismatch(String),
}
impl UpdateDataRetentionError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<UpdateDataRetentionError> {
if let Some(err) = proto::json::Error::parse_rest(&res) {
match err.typ.as_str() {
"ClientLimitExceededException" => {
return RusotoError::Service(UpdateDataRetentionError::ClientLimitExceeded(
err.msg,
))
}
"InvalidArgumentException" => {
return RusotoError::Service(UpdateDataRetentionError::InvalidArgument(err.msg))
}
"NotAuthorizedException" => {
return RusotoError::Service(UpdateDataRetentionError::NotAuthorized(err.msg))
}
"ResourceInUseException" => {
return RusotoError::Service(UpdateDataRetentionError::ResourceInUse(err.msg))
}
"ResourceNotFoundException" => {
return RusotoError::Service(UpdateDataRetentionError::ResourceNotFound(
err.msg,
))
}
"VersionMismatchException" => {
return RusotoError::Service(UpdateDataRetentionError::VersionMismatch(err.msg))
}
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
return RusotoError::Unknown(res);
}
}
impl fmt::Display for UpdateDataRetentionError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for UpdateDataRetentionError {
fn description(&self) -> &str {
match *self {
UpdateDataRetentionError::ClientLimitExceeded(ref cause) => cause,
UpdateDataRetentionError::InvalidArgument(ref cause) => cause,
UpdateDataRetentionError::NotAuthorized(ref cause) => cause,
UpdateDataRetentionError::ResourceInUse(ref cause) => cause,
UpdateDataRetentionError::ResourceNotFound(ref cause) => cause,
UpdateDataRetentionError::VersionMismatch(ref cause) => cause,
}
}
}
#[derive(Debug, PartialEq)]
pub enum UpdateStreamError {
ClientLimitExceeded(String),
InvalidArgument(String),
NotAuthorized(String),
ResourceInUse(String),
ResourceNotFound(String),
VersionMismatch(String),
}
impl UpdateStreamError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<UpdateStreamError> {
if let Some(err) = proto::json::Error::parse_rest(&res) {
match err.typ.as_str() {
"ClientLimitExceededException" => {
return RusotoError::Service(UpdateStreamError::ClientLimitExceeded(err.msg))
}
"InvalidArgumentException" => {
return RusotoError::Service(UpdateStreamError::InvalidArgument(err.msg))
}
"NotAuthorizedException" => {
return RusotoError::Service(UpdateStreamError::NotAuthorized(err.msg))
}
"ResourceInUseException" => {
return RusotoError::Service(UpdateStreamError::ResourceInUse(err.msg))
}
"ResourceNotFoundException" => {
return RusotoError::Service(UpdateStreamError::ResourceNotFound(err.msg))
}
"VersionMismatchException" => {
return RusotoError::Service(UpdateStreamError::VersionMismatch(err.msg))
}
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
return RusotoError::Unknown(res);
}
}
impl fmt::Display for UpdateStreamError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for UpdateStreamError {
fn description(&self) -> &str {
match *self {
UpdateStreamError::ClientLimitExceeded(ref cause) => cause,
UpdateStreamError::InvalidArgument(ref cause) => cause,
UpdateStreamError::NotAuthorized(ref cause) => cause,
UpdateStreamError::ResourceInUse(ref cause) => cause,
UpdateStreamError::ResourceNotFound(ref cause) => cause,
UpdateStreamError::VersionMismatch(ref cause) => cause,
}
}
}
pub trait KinesisVideo {
fn create_stream(
&self,
input: CreateStreamInput,
) -> RusotoFuture<CreateStreamOutput, CreateStreamError>;
fn delete_stream(
&self,
input: DeleteStreamInput,
) -> RusotoFuture<DeleteStreamOutput, DeleteStreamError>;
fn describe_stream(
&self,
input: DescribeStreamInput,
) -> RusotoFuture<DescribeStreamOutput, DescribeStreamError>;
fn get_data_endpoint(
&self,
input: GetDataEndpointInput,
) -> RusotoFuture<GetDataEndpointOutput, GetDataEndpointError>;
fn list_streams(
&self,
input: ListStreamsInput,
) -> RusotoFuture<ListStreamsOutput, ListStreamsError>;
fn list_tags_for_stream(
&self,
input: ListTagsForStreamInput,
) -> RusotoFuture<ListTagsForStreamOutput, ListTagsForStreamError>;
fn tag_stream(&self, input: TagStreamInput) -> RusotoFuture<TagStreamOutput, TagStreamError>;
fn untag_stream(
&self,
input: UntagStreamInput,
) -> RusotoFuture<UntagStreamOutput, UntagStreamError>;
fn update_data_retention(
&self,
input: UpdateDataRetentionInput,
) -> RusotoFuture<UpdateDataRetentionOutput, UpdateDataRetentionError>;
fn update_stream(
&self,
input: UpdateStreamInput,
) -> RusotoFuture<UpdateStreamOutput, UpdateStreamError>;
}
#[derive(Clone)]
pub struct KinesisVideoClient {
client: Client,
region: region::Region,
}
impl KinesisVideoClient {
pub fn new(region: region::Region) -> KinesisVideoClient {
KinesisVideoClient {
client: Client::shared(),
region,
}
}
pub fn new_with<P, D>(
request_dispatcher: D,
credentials_provider: P,
region: region::Region,
) -> KinesisVideoClient
where
P: ProvideAwsCredentials + Send + Sync + 'static,
P::Future: Send,
D: DispatchSignedRequest + Send + Sync + 'static,
D::Future: Send,
{
KinesisVideoClient {
client: Client::new_with(credentials_provider, request_dispatcher),
region,
}
}
}
impl KinesisVideo for KinesisVideoClient {
fn create_stream(
&self,
input: CreateStreamInput,
) -> RusotoFuture<CreateStreamOutput, CreateStreamError> {
let request_uri = "/createStream";
let mut request = SignedRequest::new("POST", "kinesisvideo", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().and_then(|response| {
let result = proto::json::ResponsePayload::new(&response)
.deserialize::<CreateStreamOutput, _>()?;
Ok(result)
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(CreateStreamError::from_response(response))),
)
}
})
}
fn delete_stream(
&self,
input: DeleteStreamInput,
) -> RusotoFuture<DeleteStreamOutput, DeleteStreamError> {
let request_uri = "/deleteStream";
let mut request = SignedRequest::new("POST", "kinesisvideo", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().and_then(|response| {
let result = proto::json::ResponsePayload::new(&response)
.deserialize::<DeleteStreamOutput, _>()?;
Ok(result)
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(DeleteStreamError::from_response(response))),
)
}
})
}
fn describe_stream(
&self,
input: DescribeStreamInput,
) -> RusotoFuture<DescribeStreamOutput, DescribeStreamError> {
let request_uri = "/describeStream";
let mut request = SignedRequest::new("POST", "kinesisvideo", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().and_then(|response| {
let result = proto::json::ResponsePayload::new(&response)
.deserialize::<DescribeStreamOutput, _>()?;
Ok(result)
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(DescribeStreamError::from_response(response))),
)
}
})
}
fn get_data_endpoint(
&self,
input: GetDataEndpointInput,
) -> RusotoFuture<GetDataEndpointOutput, GetDataEndpointError> {
let request_uri = "/getDataEndpoint";
let mut request = SignedRequest::new("POST", "kinesisvideo", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().and_then(|response| {
let result = proto::json::ResponsePayload::new(&response)
.deserialize::<GetDataEndpointOutput, _>()?;
Ok(result)
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(GetDataEndpointError::from_response(response))),
)
}
})
}
fn list_streams(
&self,
input: ListStreamsInput,
) -> RusotoFuture<ListStreamsOutput, ListStreamsError> {
let request_uri = "/listStreams";
let mut request = SignedRequest::new("POST", "kinesisvideo", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().and_then(|response| {
let result = proto::json::ResponsePayload::new(&response)
.deserialize::<ListStreamsOutput, _>()?;
Ok(result)
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(ListStreamsError::from_response(response))),
)
}
})
}
fn list_tags_for_stream(
&self,
input: ListTagsForStreamInput,
) -> RusotoFuture<ListTagsForStreamOutput, ListTagsForStreamError> {
let request_uri = "/listTagsForStream";
let mut request = SignedRequest::new("POST", "kinesisvideo", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().and_then(|response| {
let result = proto::json::ResponsePayload::new(&response)
.deserialize::<ListTagsForStreamOutput, _>()?;
Ok(result)
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(ListTagsForStreamError::from_response(response))),
)
}
})
}
fn tag_stream(&self, input: TagStreamInput) -> RusotoFuture<TagStreamOutput, TagStreamError> {
let request_uri = "/tagStream";
let mut request = SignedRequest::new("POST", "kinesisvideo", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().and_then(|response| {
let result = proto::json::ResponsePayload::new(&response)
.deserialize::<TagStreamOutput, _>()?;
Ok(result)
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(TagStreamError::from_response(response))),
)
}
})
}
fn untag_stream(
&self,
input: UntagStreamInput,
) -> RusotoFuture<UntagStreamOutput, UntagStreamError> {
let request_uri = "/untagStream";
let mut request = SignedRequest::new("POST", "kinesisvideo", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().and_then(|response| {
let result = proto::json::ResponsePayload::new(&response)
.deserialize::<UntagStreamOutput, _>()?;
Ok(result)
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(UntagStreamError::from_response(response))),
)
}
})
}
fn update_data_retention(
&self,
input: UpdateDataRetentionInput,
) -> RusotoFuture<UpdateDataRetentionOutput, UpdateDataRetentionError> {
let request_uri = "/updateDataRetention";
let mut request = SignedRequest::new("POST", "kinesisvideo", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().and_then(|response| {
let result = proto::json::ResponsePayload::new(&response)
.deserialize::<UpdateDataRetentionOutput, _>()?;
Ok(result)
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(UpdateDataRetentionError::from_response(response))
}),
)
}
})
}
fn update_stream(
&self,
input: UpdateStreamInput,
) -> RusotoFuture<UpdateStreamOutput, UpdateStreamError> {
let request_uri = "/updateStream";
let mut request = SignedRequest::new("POST", "kinesisvideo", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().and_then(|response| {
let result = proto::json::ResponsePayload::new(&response)
.deserialize::<UpdateStreamOutput, _>()?;
Ok(result)
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(UpdateStreamError::from_response(response))),
)
}
})
}
}