use std::error::Error;
use std::fmt;
use std::io;
#[allow(warnings)]
use futures::future;
use futures::Future;
use rusoto_core::region;
use rusoto_core::request::{BufferedHttpResponse, DispatchSignedRequest};
use rusoto_core::{Client, RusotoFuture};
use rusoto_core::credential::{CredentialsError, ProvideAwsCredentials};
use rusoto_core::request::HttpDispatchError;
use rusoto_core::signature::SignedRequest;
use serde_json;
use serde_json::from_slice;
use serde_json::Value as SerdeJsonValue;
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct AgeRange {
#[serde(rename = "High")]
#[serde(skip_serializing_if = "Option::is_none")]
pub high: Option<i64>,
#[serde(rename = "Low")]
#[serde(skip_serializing_if = "Option::is_none")]
pub low: Option<i64>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct Beard {
#[serde(rename = "Confidence")]
#[serde(skip_serializing_if = "Option::is_none")]
pub confidence: Option<f32>,
#[serde(rename = "Value")]
#[serde(skip_serializing_if = "Option::is_none")]
pub value: Option<bool>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct BoundingBox {
#[serde(rename = "Height")]
#[serde(skip_serializing_if = "Option::is_none")]
pub height: Option<f32>,
#[serde(rename = "Left")]
#[serde(skip_serializing_if = "Option::is_none")]
pub left: Option<f32>,
#[serde(rename = "Top")]
#[serde(skip_serializing_if = "Option::is_none")]
pub top: Option<f32>,
#[serde(rename = "Width")]
#[serde(skip_serializing_if = "Option::is_none")]
pub width: Option<f32>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct Celebrity {
#[serde(rename = "Face")]
#[serde(skip_serializing_if = "Option::is_none")]
pub face: Option<ComparedFace>,
#[serde(rename = "Id")]
#[serde(skip_serializing_if = "Option::is_none")]
pub id: Option<String>,
#[serde(rename = "MatchConfidence")]
#[serde(skip_serializing_if = "Option::is_none")]
pub match_confidence: Option<f32>,
#[serde(rename = "Name")]
#[serde(skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
#[serde(rename = "Urls")]
#[serde(skip_serializing_if = "Option::is_none")]
pub urls: Option<Vec<String>>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct CelebrityDetail {
#[serde(rename = "BoundingBox")]
#[serde(skip_serializing_if = "Option::is_none")]
pub bounding_box: Option<BoundingBox>,
#[serde(rename = "Confidence")]
#[serde(skip_serializing_if = "Option::is_none")]
pub confidence: Option<f32>,
#[serde(rename = "Face")]
#[serde(skip_serializing_if = "Option::is_none")]
pub face: Option<FaceDetail>,
#[serde(rename = "Id")]
#[serde(skip_serializing_if = "Option::is_none")]
pub id: Option<String>,
#[serde(rename = "Name")]
#[serde(skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
#[serde(rename = "Urls")]
#[serde(skip_serializing_if = "Option::is_none")]
pub urls: Option<Vec<String>>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct CelebrityRecognition {
#[serde(rename = "Celebrity")]
#[serde(skip_serializing_if = "Option::is_none")]
pub celebrity: Option<CelebrityDetail>,
#[serde(rename = "Timestamp")]
#[serde(skip_serializing_if = "Option::is_none")]
pub timestamp: Option<i64>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct CompareFacesMatch {
#[serde(rename = "Face")]
#[serde(skip_serializing_if = "Option::is_none")]
pub face: Option<ComparedFace>,
#[serde(rename = "Similarity")]
#[serde(skip_serializing_if = "Option::is_none")]
pub similarity: Option<f32>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct CompareFacesRequest {
#[serde(rename = "SimilarityThreshold")]
#[serde(skip_serializing_if = "Option::is_none")]
pub similarity_threshold: Option<f32>,
#[serde(rename = "SourceImage")]
pub source_image: Image,
#[serde(rename = "TargetImage")]
pub target_image: Image,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct CompareFacesResponse {
#[serde(rename = "FaceMatches")]
#[serde(skip_serializing_if = "Option::is_none")]
pub face_matches: Option<Vec<CompareFacesMatch>>,
#[serde(rename = "SourceImageFace")]
#[serde(skip_serializing_if = "Option::is_none")]
pub source_image_face: Option<ComparedSourceImageFace>,
#[serde(rename = "SourceImageOrientationCorrection")]
#[serde(skip_serializing_if = "Option::is_none")]
pub source_image_orientation_correction: Option<String>,
#[serde(rename = "TargetImageOrientationCorrection")]
#[serde(skip_serializing_if = "Option::is_none")]
pub target_image_orientation_correction: Option<String>,
#[serde(rename = "UnmatchedFaces")]
#[serde(skip_serializing_if = "Option::is_none")]
pub unmatched_faces: Option<Vec<ComparedFace>>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ComparedFace {
#[serde(rename = "BoundingBox")]
#[serde(skip_serializing_if = "Option::is_none")]
pub bounding_box: Option<BoundingBox>,
#[serde(rename = "Confidence")]
#[serde(skip_serializing_if = "Option::is_none")]
pub confidence: Option<f32>,
#[serde(rename = "Landmarks")]
#[serde(skip_serializing_if = "Option::is_none")]
pub landmarks: Option<Vec<Landmark>>,
#[serde(rename = "Pose")]
#[serde(skip_serializing_if = "Option::is_none")]
pub pose: Option<Pose>,
#[serde(rename = "Quality")]
#[serde(skip_serializing_if = "Option::is_none")]
pub quality: Option<ImageQuality>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ComparedSourceImageFace {
#[serde(rename = "BoundingBox")]
#[serde(skip_serializing_if = "Option::is_none")]
pub bounding_box: Option<BoundingBox>,
#[serde(rename = "Confidence")]
#[serde(skip_serializing_if = "Option::is_none")]
pub confidence: Option<f32>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ContentModerationDetection {
#[serde(rename = "ModerationLabel")]
#[serde(skip_serializing_if = "Option::is_none")]
pub moderation_label: Option<ModerationLabel>,
#[serde(rename = "Timestamp")]
#[serde(skip_serializing_if = "Option::is_none")]
pub timestamp: Option<i64>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct CreateCollectionRequest {
#[serde(rename = "CollectionId")]
pub collection_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct CreateCollectionResponse {
#[serde(rename = "CollectionArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub collection_arn: Option<String>,
#[serde(rename = "FaceModelVersion")]
#[serde(skip_serializing_if = "Option::is_none")]
pub face_model_version: Option<String>,
#[serde(rename = "StatusCode")]
#[serde(skip_serializing_if = "Option::is_none")]
pub status_code: Option<i64>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct CreateStreamProcessorRequest {
#[serde(rename = "Input")]
pub input: StreamProcessorInput,
#[serde(rename = "Name")]
pub name: String,
#[serde(rename = "Output")]
pub output: StreamProcessorOutput,
#[serde(rename = "RoleArn")]
pub role_arn: String,
#[serde(rename = "Settings")]
pub settings: StreamProcessorSettings,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct CreateStreamProcessorResponse {
#[serde(rename = "StreamProcessorArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub stream_processor_arn: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DeleteCollectionRequest {
#[serde(rename = "CollectionId")]
pub collection_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DeleteCollectionResponse {
#[serde(rename = "StatusCode")]
#[serde(skip_serializing_if = "Option::is_none")]
pub status_code: Option<i64>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DeleteFacesRequest {
#[serde(rename = "CollectionId")]
pub collection_id: String,
#[serde(rename = "FaceIds")]
pub face_ids: Vec<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DeleteFacesResponse {
#[serde(rename = "DeletedFaces")]
#[serde(skip_serializing_if = "Option::is_none")]
pub deleted_faces: Option<Vec<String>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DeleteStreamProcessorRequest {
#[serde(rename = "Name")]
pub name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DeleteStreamProcessorResponse {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DescribeStreamProcessorRequest {
#[serde(rename = "Name")]
pub name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DescribeStreamProcessorResponse {
#[serde(rename = "CreationTimestamp")]
#[serde(skip_serializing_if = "Option::is_none")]
pub creation_timestamp: Option<f64>,
#[serde(rename = "Input")]
#[serde(skip_serializing_if = "Option::is_none")]
pub input: Option<StreamProcessorInput>,
#[serde(rename = "LastUpdateTimestamp")]
#[serde(skip_serializing_if = "Option::is_none")]
pub last_update_timestamp: Option<f64>,
#[serde(rename = "Name")]
#[serde(skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
#[serde(rename = "Output")]
#[serde(skip_serializing_if = "Option::is_none")]
pub output: Option<StreamProcessorOutput>,
#[serde(rename = "RoleArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub role_arn: Option<String>,
#[serde(rename = "Settings")]
#[serde(skip_serializing_if = "Option::is_none")]
pub settings: Option<StreamProcessorSettings>,
#[serde(rename = "Status")]
#[serde(skip_serializing_if = "Option::is_none")]
pub status: Option<String>,
#[serde(rename = "StatusMessage")]
#[serde(skip_serializing_if = "Option::is_none")]
pub status_message: Option<String>,
#[serde(rename = "StreamProcessorArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub stream_processor_arn: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DetectFacesRequest {
#[serde(rename = "Attributes")]
#[serde(skip_serializing_if = "Option::is_none")]
pub attributes: Option<Vec<String>>,
#[serde(rename = "Image")]
pub image: Image,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DetectFacesResponse {
#[serde(rename = "FaceDetails")]
#[serde(skip_serializing_if = "Option::is_none")]
pub face_details: Option<Vec<FaceDetail>>,
#[serde(rename = "OrientationCorrection")]
#[serde(skip_serializing_if = "Option::is_none")]
pub orientation_correction: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DetectLabelsRequest {
#[serde(rename = "Image")]
pub image: Image,
#[serde(rename = "MaxLabels")]
#[serde(skip_serializing_if = "Option::is_none")]
pub max_labels: Option<i64>,
#[serde(rename = "MinConfidence")]
#[serde(skip_serializing_if = "Option::is_none")]
pub min_confidence: Option<f32>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DetectLabelsResponse {
#[serde(rename = "Labels")]
#[serde(skip_serializing_if = "Option::is_none")]
pub labels: Option<Vec<Label>>,
#[serde(rename = "OrientationCorrection")]
#[serde(skip_serializing_if = "Option::is_none")]
pub orientation_correction: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DetectModerationLabelsRequest {
#[serde(rename = "Image")]
pub image: Image,
#[serde(rename = "MinConfidence")]
#[serde(skip_serializing_if = "Option::is_none")]
pub min_confidence: Option<f32>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DetectModerationLabelsResponse {
#[serde(rename = "ModerationLabels")]
#[serde(skip_serializing_if = "Option::is_none")]
pub moderation_labels: Option<Vec<ModerationLabel>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DetectTextRequest {
#[serde(rename = "Image")]
pub image: Image,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DetectTextResponse {
#[serde(rename = "TextDetections")]
#[serde(skip_serializing_if = "Option::is_none")]
pub text_detections: Option<Vec<TextDetection>>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct Emotion {
#[serde(rename = "Confidence")]
#[serde(skip_serializing_if = "Option::is_none")]
pub confidence: Option<f32>,
#[serde(rename = "Type")]
#[serde(skip_serializing_if = "Option::is_none")]
pub type_: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct EyeOpen {
#[serde(rename = "Confidence")]
#[serde(skip_serializing_if = "Option::is_none")]
pub confidence: Option<f32>,
#[serde(rename = "Value")]
#[serde(skip_serializing_if = "Option::is_none")]
pub value: Option<bool>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct Eyeglasses {
#[serde(rename = "Confidence")]
#[serde(skip_serializing_if = "Option::is_none")]
pub confidence: Option<f32>,
#[serde(rename = "Value")]
#[serde(skip_serializing_if = "Option::is_none")]
pub value: Option<bool>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct Face {
#[serde(rename = "BoundingBox")]
#[serde(skip_serializing_if = "Option::is_none")]
pub bounding_box: Option<BoundingBox>,
#[serde(rename = "Confidence")]
#[serde(skip_serializing_if = "Option::is_none")]
pub confidence: Option<f32>,
#[serde(rename = "ExternalImageId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub external_image_id: Option<String>,
#[serde(rename = "FaceId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub face_id: Option<String>,
#[serde(rename = "ImageId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub image_id: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct FaceDetail {
#[serde(rename = "AgeRange")]
#[serde(skip_serializing_if = "Option::is_none")]
pub age_range: Option<AgeRange>,
#[serde(rename = "Beard")]
#[serde(skip_serializing_if = "Option::is_none")]
pub beard: Option<Beard>,
#[serde(rename = "BoundingBox")]
#[serde(skip_serializing_if = "Option::is_none")]
pub bounding_box: Option<BoundingBox>,
#[serde(rename = "Confidence")]
#[serde(skip_serializing_if = "Option::is_none")]
pub confidence: Option<f32>,
#[serde(rename = "Emotions")]
#[serde(skip_serializing_if = "Option::is_none")]
pub emotions: Option<Vec<Emotion>>,
#[serde(rename = "Eyeglasses")]
#[serde(skip_serializing_if = "Option::is_none")]
pub eyeglasses: Option<Eyeglasses>,
#[serde(rename = "EyesOpen")]
#[serde(skip_serializing_if = "Option::is_none")]
pub eyes_open: Option<EyeOpen>,
#[serde(rename = "Gender")]
#[serde(skip_serializing_if = "Option::is_none")]
pub gender: Option<Gender>,
#[serde(rename = "Landmarks")]
#[serde(skip_serializing_if = "Option::is_none")]
pub landmarks: Option<Vec<Landmark>>,
#[serde(rename = "MouthOpen")]
#[serde(skip_serializing_if = "Option::is_none")]
pub mouth_open: Option<MouthOpen>,
#[serde(rename = "Mustache")]
#[serde(skip_serializing_if = "Option::is_none")]
pub mustache: Option<Mustache>,
#[serde(rename = "Pose")]
#[serde(skip_serializing_if = "Option::is_none")]
pub pose: Option<Pose>,
#[serde(rename = "Quality")]
#[serde(skip_serializing_if = "Option::is_none")]
pub quality: Option<ImageQuality>,
#[serde(rename = "Smile")]
#[serde(skip_serializing_if = "Option::is_none")]
pub smile: Option<Smile>,
#[serde(rename = "Sunglasses")]
#[serde(skip_serializing_if = "Option::is_none")]
pub sunglasses: Option<Sunglasses>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct FaceDetection {
#[serde(rename = "Face")]
#[serde(skip_serializing_if = "Option::is_none")]
pub face: Option<FaceDetail>,
#[serde(rename = "Timestamp")]
#[serde(skip_serializing_if = "Option::is_none")]
pub timestamp: Option<i64>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct FaceMatch {
#[serde(rename = "Face")]
#[serde(skip_serializing_if = "Option::is_none")]
pub face: Option<Face>,
#[serde(rename = "Similarity")]
#[serde(skip_serializing_if = "Option::is_none")]
pub similarity: Option<f32>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct FaceRecord {
#[serde(rename = "Face")]
#[serde(skip_serializing_if = "Option::is_none")]
pub face: Option<Face>,
#[serde(rename = "FaceDetail")]
#[serde(skip_serializing_if = "Option::is_none")]
pub face_detail: Option<FaceDetail>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct FaceSearchSettings {
#[serde(rename = "CollectionId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub collection_id: Option<String>,
#[serde(rename = "FaceMatchThreshold")]
#[serde(skip_serializing_if = "Option::is_none")]
pub face_match_threshold: Option<f32>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct Gender {
#[serde(rename = "Confidence")]
#[serde(skip_serializing_if = "Option::is_none")]
pub confidence: Option<f32>,
#[serde(rename = "Value")]
#[serde(skip_serializing_if = "Option::is_none")]
pub value: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct Geometry {
#[serde(rename = "BoundingBox")]
#[serde(skip_serializing_if = "Option::is_none")]
pub bounding_box: Option<BoundingBox>,
#[serde(rename = "Polygon")]
#[serde(skip_serializing_if = "Option::is_none")]
pub polygon: Option<Vec<Point>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetCelebrityInfoRequest {
#[serde(rename = "Id")]
pub id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct GetCelebrityInfoResponse {
#[serde(rename = "Name")]
#[serde(skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
#[serde(rename = "Urls")]
#[serde(skip_serializing_if = "Option::is_none")]
pub urls: Option<Vec<String>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetCelebrityRecognitionRequest {
#[serde(rename = "JobId")]
pub job_id: String,
#[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 = "SortBy")]
#[serde(skip_serializing_if = "Option::is_none")]
pub sort_by: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct GetCelebrityRecognitionResponse {
#[serde(rename = "Celebrities")]
#[serde(skip_serializing_if = "Option::is_none")]
pub celebrities: Option<Vec<CelebrityRecognition>>,
#[serde(rename = "JobStatus")]
#[serde(skip_serializing_if = "Option::is_none")]
pub job_status: Option<String>,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "StatusMessage")]
#[serde(skip_serializing_if = "Option::is_none")]
pub status_message: Option<String>,
#[serde(rename = "VideoMetadata")]
#[serde(skip_serializing_if = "Option::is_none")]
pub video_metadata: Option<VideoMetadata>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetContentModerationRequest {
#[serde(rename = "JobId")]
pub job_id: String,
#[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 = "SortBy")]
#[serde(skip_serializing_if = "Option::is_none")]
pub sort_by: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct GetContentModerationResponse {
#[serde(rename = "JobStatus")]
#[serde(skip_serializing_if = "Option::is_none")]
pub job_status: Option<String>,
#[serde(rename = "ModerationLabels")]
#[serde(skip_serializing_if = "Option::is_none")]
pub moderation_labels: Option<Vec<ContentModerationDetection>>,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "StatusMessage")]
#[serde(skip_serializing_if = "Option::is_none")]
pub status_message: Option<String>,
#[serde(rename = "VideoMetadata")]
#[serde(skip_serializing_if = "Option::is_none")]
pub video_metadata: Option<VideoMetadata>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetFaceDetectionRequest {
#[serde(rename = "JobId")]
pub job_id: String,
#[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>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct GetFaceDetectionResponse {
#[serde(rename = "Faces")]
#[serde(skip_serializing_if = "Option::is_none")]
pub faces: Option<Vec<FaceDetection>>,
#[serde(rename = "JobStatus")]
#[serde(skip_serializing_if = "Option::is_none")]
pub job_status: Option<String>,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "StatusMessage")]
#[serde(skip_serializing_if = "Option::is_none")]
pub status_message: Option<String>,
#[serde(rename = "VideoMetadata")]
#[serde(skip_serializing_if = "Option::is_none")]
pub video_metadata: Option<VideoMetadata>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetFaceSearchRequest {
#[serde(rename = "JobId")]
pub job_id: String,
#[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 = "SortBy")]
#[serde(skip_serializing_if = "Option::is_none")]
pub sort_by: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct GetFaceSearchResponse {
#[serde(rename = "JobStatus")]
#[serde(skip_serializing_if = "Option::is_none")]
pub job_status: Option<String>,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "Persons")]
#[serde(skip_serializing_if = "Option::is_none")]
pub persons: Option<Vec<PersonMatch>>,
#[serde(rename = "StatusMessage")]
#[serde(skip_serializing_if = "Option::is_none")]
pub status_message: Option<String>,
#[serde(rename = "VideoMetadata")]
#[serde(skip_serializing_if = "Option::is_none")]
pub video_metadata: Option<VideoMetadata>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetLabelDetectionRequest {
#[serde(rename = "JobId")]
pub job_id: String,
#[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 = "SortBy")]
#[serde(skip_serializing_if = "Option::is_none")]
pub sort_by: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct GetLabelDetectionResponse {
#[serde(rename = "JobStatus")]
#[serde(skip_serializing_if = "Option::is_none")]
pub job_status: Option<String>,
#[serde(rename = "Labels")]
#[serde(skip_serializing_if = "Option::is_none")]
pub labels: Option<Vec<LabelDetection>>,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "StatusMessage")]
#[serde(skip_serializing_if = "Option::is_none")]
pub status_message: Option<String>,
#[serde(rename = "VideoMetadata")]
#[serde(skip_serializing_if = "Option::is_none")]
pub video_metadata: Option<VideoMetadata>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetPersonTrackingRequest {
#[serde(rename = "JobId")]
pub job_id: String,
#[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 = "SortBy")]
#[serde(skip_serializing_if = "Option::is_none")]
pub sort_by: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct GetPersonTrackingResponse {
#[serde(rename = "JobStatus")]
#[serde(skip_serializing_if = "Option::is_none")]
pub job_status: Option<String>,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "Persons")]
#[serde(skip_serializing_if = "Option::is_none")]
pub persons: Option<Vec<PersonDetection>>,
#[serde(rename = "StatusMessage")]
#[serde(skip_serializing_if = "Option::is_none")]
pub status_message: Option<String>,
#[serde(rename = "VideoMetadata")]
#[serde(skip_serializing_if = "Option::is_none")]
pub video_metadata: Option<VideoMetadata>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct Image {
#[serde(rename = "Bytes")]
#[serde(
deserialize_with = "::rusoto_core::serialization::SerdeBlob::deserialize_blob",
serialize_with = "::rusoto_core::serialization::SerdeBlob::serialize_blob",
default
)]
#[serde(skip_serializing_if = "Option::is_none")]
pub bytes: Option<Vec<u8>>,
#[serde(rename = "S3Object")]
#[serde(skip_serializing_if = "Option::is_none")]
pub s3_object: Option<S3Object>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ImageQuality {
#[serde(rename = "Brightness")]
#[serde(skip_serializing_if = "Option::is_none")]
pub brightness: Option<f32>,
#[serde(rename = "Sharpness")]
#[serde(skip_serializing_if = "Option::is_none")]
pub sharpness: Option<f32>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct IndexFacesRequest {
#[serde(rename = "CollectionId")]
pub collection_id: String,
#[serde(rename = "DetectionAttributes")]
#[serde(skip_serializing_if = "Option::is_none")]
pub detection_attributes: Option<Vec<String>>,
#[serde(rename = "ExternalImageId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub external_image_id: Option<String>,
#[serde(rename = "Image")]
pub image: Image,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct IndexFacesResponse {
#[serde(rename = "FaceModelVersion")]
#[serde(skip_serializing_if = "Option::is_none")]
pub face_model_version: Option<String>,
#[serde(rename = "FaceRecords")]
#[serde(skip_serializing_if = "Option::is_none")]
pub face_records: Option<Vec<FaceRecord>>,
#[serde(rename = "OrientationCorrection")]
#[serde(skip_serializing_if = "Option::is_none")]
pub orientation_correction: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct KinesisDataStream {
#[serde(rename = "Arn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub arn: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct KinesisVideoStream {
#[serde(rename = "Arn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub arn: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct Label {
#[serde(rename = "Confidence")]
#[serde(skip_serializing_if = "Option::is_none")]
pub confidence: Option<f32>,
#[serde(rename = "Name")]
#[serde(skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct LabelDetection {
#[serde(rename = "Label")]
#[serde(skip_serializing_if = "Option::is_none")]
pub label: Option<Label>,
#[serde(rename = "Timestamp")]
#[serde(skip_serializing_if = "Option::is_none")]
pub timestamp: Option<i64>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct Landmark {
#[serde(rename = "Type")]
#[serde(skip_serializing_if = "Option::is_none")]
pub type_: Option<String>,
#[serde(rename = "X")]
#[serde(skip_serializing_if = "Option::is_none")]
pub x: Option<f32>,
#[serde(rename = "Y")]
#[serde(skip_serializing_if = "Option::is_none")]
pub y: Option<f32>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ListCollectionsRequest {
#[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>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ListCollectionsResponse {
#[serde(rename = "CollectionIds")]
#[serde(skip_serializing_if = "Option::is_none")]
pub collection_ids: Option<Vec<String>>,
#[serde(rename = "FaceModelVersions")]
#[serde(skip_serializing_if = "Option::is_none")]
pub face_model_versions: Option<Vec<String>>,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ListFacesRequest {
#[serde(rename = "CollectionId")]
pub collection_id: String,
#[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>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ListFacesResponse {
#[serde(rename = "FaceModelVersion")]
#[serde(skip_serializing_if = "Option::is_none")]
pub face_model_version: Option<String>,
#[serde(rename = "Faces")]
#[serde(skip_serializing_if = "Option::is_none")]
pub faces: Option<Vec<Face>>,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ListStreamProcessorsRequest {
#[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>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ListStreamProcessorsResponse {
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "StreamProcessors")]
#[serde(skip_serializing_if = "Option::is_none")]
pub stream_processors: Option<Vec<StreamProcessor>>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ModerationLabel {
#[serde(rename = "Confidence")]
#[serde(skip_serializing_if = "Option::is_none")]
pub confidence: Option<f32>,
#[serde(rename = "Name")]
#[serde(skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
#[serde(rename = "ParentName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub parent_name: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct MouthOpen {
#[serde(rename = "Confidence")]
#[serde(skip_serializing_if = "Option::is_none")]
pub confidence: Option<f32>,
#[serde(rename = "Value")]
#[serde(skip_serializing_if = "Option::is_none")]
pub value: Option<bool>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct Mustache {
#[serde(rename = "Confidence")]
#[serde(skip_serializing_if = "Option::is_none")]
pub confidence: Option<f32>,
#[serde(rename = "Value")]
#[serde(skip_serializing_if = "Option::is_none")]
pub value: Option<bool>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct NotificationChannel {
#[serde(rename = "RoleArn")]
pub role_arn: String,
#[serde(rename = "SNSTopicArn")]
pub sns_topic_arn: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct PersonDetail {
#[serde(rename = "BoundingBox")]
#[serde(skip_serializing_if = "Option::is_none")]
pub bounding_box: Option<BoundingBox>,
#[serde(rename = "Face")]
#[serde(skip_serializing_if = "Option::is_none")]
pub face: Option<FaceDetail>,
#[serde(rename = "Index")]
#[serde(skip_serializing_if = "Option::is_none")]
pub index: Option<i64>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct PersonDetection {
#[serde(rename = "Person")]
#[serde(skip_serializing_if = "Option::is_none")]
pub person: Option<PersonDetail>,
#[serde(rename = "Timestamp")]
#[serde(skip_serializing_if = "Option::is_none")]
pub timestamp: Option<i64>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct PersonMatch {
#[serde(rename = "FaceMatches")]
#[serde(skip_serializing_if = "Option::is_none")]
pub face_matches: Option<Vec<FaceMatch>>,
#[serde(rename = "Person")]
#[serde(skip_serializing_if = "Option::is_none")]
pub person: Option<PersonDetail>,
#[serde(rename = "Timestamp")]
#[serde(skip_serializing_if = "Option::is_none")]
pub timestamp: Option<i64>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct Point {
#[serde(rename = "X")]
#[serde(skip_serializing_if = "Option::is_none")]
pub x: Option<f32>,
#[serde(rename = "Y")]
#[serde(skip_serializing_if = "Option::is_none")]
pub y: Option<f32>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct Pose {
#[serde(rename = "Pitch")]
#[serde(skip_serializing_if = "Option::is_none")]
pub pitch: Option<f32>,
#[serde(rename = "Roll")]
#[serde(skip_serializing_if = "Option::is_none")]
pub roll: Option<f32>,
#[serde(rename = "Yaw")]
#[serde(skip_serializing_if = "Option::is_none")]
pub yaw: Option<f32>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct RecognizeCelebritiesRequest {
#[serde(rename = "Image")]
pub image: Image,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct RecognizeCelebritiesResponse {
#[serde(rename = "CelebrityFaces")]
#[serde(skip_serializing_if = "Option::is_none")]
pub celebrity_faces: Option<Vec<Celebrity>>,
#[serde(rename = "OrientationCorrection")]
#[serde(skip_serializing_if = "Option::is_none")]
pub orientation_correction: Option<String>,
#[serde(rename = "UnrecognizedFaces")]
#[serde(skip_serializing_if = "Option::is_none")]
pub unrecognized_faces: Option<Vec<ComparedFace>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct S3Object {
#[serde(rename = "Bucket")]
#[serde(skip_serializing_if = "Option::is_none")]
pub bucket: Option<String>,
#[serde(rename = "Name")]
#[serde(skip_serializing_if = "Option::is_none")]
pub 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 SearchFacesByImageRequest {
#[serde(rename = "CollectionId")]
pub collection_id: String,
#[serde(rename = "FaceMatchThreshold")]
#[serde(skip_serializing_if = "Option::is_none")]
pub face_match_threshold: Option<f32>,
#[serde(rename = "Image")]
pub image: Image,
#[serde(rename = "MaxFaces")]
#[serde(skip_serializing_if = "Option::is_none")]
pub max_faces: Option<i64>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct SearchFacesByImageResponse {
#[serde(rename = "FaceMatches")]
#[serde(skip_serializing_if = "Option::is_none")]
pub face_matches: Option<Vec<FaceMatch>>,
#[serde(rename = "FaceModelVersion")]
#[serde(skip_serializing_if = "Option::is_none")]
pub face_model_version: Option<String>,
#[serde(rename = "SearchedFaceBoundingBox")]
#[serde(skip_serializing_if = "Option::is_none")]
pub searched_face_bounding_box: Option<BoundingBox>,
#[serde(rename = "SearchedFaceConfidence")]
#[serde(skip_serializing_if = "Option::is_none")]
pub searched_face_confidence: Option<f32>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct SearchFacesRequest {
#[serde(rename = "CollectionId")]
pub collection_id: String,
#[serde(rename = "FaceId")]
pub face_id: String,
#[serde(rename = "FaceMatchThreshold")]
#[serde(skip_serializing_if = "Option::is_none")]
pub face_match_threshold: Option<f32>,
#[serde(rename = "MaxFaces")]
#[serde(skip_serializing_if = "Option::is_none")]
pub max_faces: Option<i64>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct SearchFacesResponse {
#[serde(rename = "FaceMatches")]
#[serde(skip_serializing_if = "Option::is_none")]
pub face_matches: Option<Vec<FaceMatch>>,
#[serde(rename = "FaceModelVersion")]
#[serde(skip_serializing_if = "Option::is_none")]
pub face_model_version: Option<String>,
#[serde(rename = "SearchedFaceId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub searched_face_id: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct Smile {
#[serde(rename = "Confidence")]
#[serde(skip_serializing_if = "Option::is_none")]
pub confidence: Option<f32>,
#[serde(rename = "Value")]
#[serde(skip_serializing_if = "Option::is_none")]
pub value: Option<bool>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct StartCelebrityRecognitionRequest {
#[serde(rename = "ClientRequestToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub client_request_token: Option<String>,
#[serde(rename = "JobTag")]
#[serde(skip_serializing_if = "Option::is_none")]
pub job_tag: Option<String>,
#[serde(rename = "NotificationChannel")]
#[serde(skip_serializing_if = "Option::is_none")]
pub notification_channel: Option<NotificationChannel>,
#[serde(rename = "Video")]
pub video: Video,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct StartCelebrityRecognitionResponse {
#[serde(rename = "JobId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub job_id: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct StartContentModerationRequest {
#[serde(rename = "ClientRequestToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub client_request_token: Option<String>,
#[serde(rename = "JobTag")]
#[serde(skip_serializing_if = "Option::is_none")]
pub job_tag: Option<String>,
#[serde(rename = "MinConfidence")]
#[serde(skip_serializing_if = "Option::is_none")]
pub min_confidence: Option<f32>,
#[serde(rename = "NotificationChannel")]
#[serde(skip_serializing_if = "Option::is_none")]
pub notification_channel: Option<NotificationChannel>,
#[serde(rename = "Video")]
pub video: Video,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct StartContentModerationResponse {
#[serde(rename = "JobId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub job_id: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct StartFaceDetectionRequest {
#[serde(rename = "ClientRequestToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub client_request_token: Option<String>,
#[serde(rename = "FaceAttributes")]
#[serde(skip_serializing_if = "Option::is_none")]
pub face_attributes: Option<String>,
#[serde(rename = "JobTag")]
#[serde(skip_serializing_if = "Option::is_none")]
pub job_tag: Option<String>,
#[serde(rename = "NotificationChannel")]
#[serde(skip_serializing_if = "Option::is_none")]
pub notification_channel: Option<NotificationChannel>,
#[serde(rename = "Video")]
pub video: Video,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct StartFaceDetectionResponse {
#[serde(rename = "JobId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub job_id: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct StartFaceSearchRequest {
#[serde(rename = "ClientRequestToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub client_request_token: Option<String>,
#[serde(rename = "CollectionId")]
pub collection_id: String,
#[serde(rename = "FaceMatchThreshold")]
#[serde(skip_serializing_if = "Option::is_none")]
pub face_match_threshold: Option<f32>,
#[serde(rename = "JobTag")]
#[serde(skip_serializing_if = "Option::is_none")]
pub job_tag: Option<String>,
#[serde(rename = "NotificationChannel")]
#[serde(skip_serializing_if = "Option::is_none")]
pub notification_channel: Option<NotificationChannel>,
#[serde(rename = "Video")]
pub video: Video,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct StartFaceSearchResponse {
#[serde(rename = "JobId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub job_id: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct StartLabelDetectionRequest {
#[serde(rename = "ClientRequestToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub client_request_token: Option<String>,
#[serde(rename = "JobTag")]
#[serde(skip_serializing_if = "Option::is_none")]
pub job_tag: Option<String>,
#[serde(rename = "MinConfidence")]
#[serde(skip_serializing_if = "Option::is_none")]
pub min_confidence: Option<f32>,
#[serde(rename = "NotificationChannel")]
#[serde(skip_serializing_if = "Option::is_none")]
pub notification_channel: Option<NotificationChannel>,
#[serde(rename = "Video")]
pub video: Video,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct StartLabelDetectionResponse {
#[serde(rename = "JobId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub job_id: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct StartPersonTrackingRequest {
#[serde(rename = "ClientRequestToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub client_request_token: Option<String>,
#[serde(rename = "JobTag")]
#[serde(skip_serializing_if = "Option::is_none")]
pub job_tag: Option<String>,
#[serde(rename = "NotificationChannel")]
#[serde(skip_serializing_if = "Option::is_none")]
pub notification_channel: Option<NotificationChannel>,
#[serde(rename = "Video")]
pub video: Video,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct StartPersonTrackingResponse {
#[serde(rename = "JobId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub job_id: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct StartStreamProcessorRequest {
#[serde(rename = "Name")]
pub name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct StartStreamProcessorResponse {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct StopStreamProcessorRequest {
#[serde(rename = "Name")]
pub name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct StopStreamProcessorResponse {}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct StreamProcessor {
#[serde(rename = "Name")]
#[serde(skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
#[serde(rename = "Status")]
#[serde(skip_serializing_if = "Option::is_none")]
pub status: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct StreamProcessorInput {
#[serde(rename = "KinesisVideoStream")]
#[serde(skip_serializing_if = "Option::is_none")]
pub kinesis_video_stream: Option<KinesisVideoStream>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct StreamProcessorOutput {
#[serde(rename = "KinesisDataStream")]
#[serde(skip_serializing_if = "Option::is_none")]
pub kinesis_data_stream: Option<KinesisDataStream>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct StreamProcessorSettings {
#[serde(rename = "FaceSearch")]
#[serde(skip_serializing_if = "Option::is_none")]
pub face_search: Option<FaceSearchSettings>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct Sunglasses {
#[serde(rename = "Confidence")]
#[serde(skip_serializing_if = "Option::is_none")]
pub confidence: Option<f32>,
#[serde(rename = "Value")]
#[serde(skip_serializing_if = "Option::is_none")]
pub value: Option<bool>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct TextDetection {
#[serde(rename = "Confidence")]
#[serde(skip_serializing_if = "Option::is_none")]
pub confidence: Option<f32>,
#[serde(rename = "DetectedText")]
#[serde(skip_serializing_if = "Option::is_none")]
pub detected_text: Option<String>,
#[serde(rename = "Geometry")]
#[serde(skip_serializing_if = "Option::is_none")]
pub geometry: Option<Geometry>,
#[serde(rename = "Id")]
#[serde(skip_serializing_if = "Option::is_none")]
pub id: Option<i64>,
#[serde(rename = "ParentId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub parent_id: Option<i64>,
#[serde(rename = "Type")]
#[serde(skip_serializing_if = "Option::is_none")]
pub type_: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct Video {
#[serde(rename = "S3Object")]
#[serde(skip_serializing_if = "Option::is_none")]
pub s3_object: Option<S3Object>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct VideoMetadata {
#[serde(rename = "Codec")]
#[serde(skip_serializing_if = "Option::is_none")]
pub codec: Option<String>,
#[serde(rename = "DurationMillis")]
#[serde(skip_serializing_if = "Option::is_none")]
pub duration_millis: Option<i64>,
#[serde(rename = "Format")]
#[serde(skip_serializing_if = "Option::is_none")]
pub format: Option<String>,
#[serde(rename = "FrameHeight")]
#[serde(skip_serializing_if = "Option::is_none")]
pub frame_height: Option<i64>,
#[serde(rename = "FrameRate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub frame_rate: Option<f32>,
#[serde(rename = "FrameWidth")]
#[serde(skip_serializing_if = "Option::is_none")]
pub frame_width: Option<i64>,
}
#[derive(Debug, PartialEq)]
pub enum CompareFacesError {
AccessDenied(String),
ImageTooLarge(String),
InternalServerError(String),
InvalidImageFormat(String),
InvalidParameter(String),
InvalidS3Object(String),
ProvisionedThroughputExceeded(String),
Throttling(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl CompareFacesError {
pub fn from_response(res: BufferedHttpResponse) -> CompareFacesError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"AccessDeniedException" => {
return CompareFacesError::AccessDenied(String::from(error_message))
}
"ImageTooLargeException" => {
return CompareFacesError::ImageTooLarge(String::from(error_message))
}
"InternalServerError" => {
return CompareFacesError::InternalServerError(String::from(error_message))
}
"InvalidImageFormatException" => {
return CompareFacesError::InvalidImageFormat(String::from(error_message))
}
"InvalidParameterException" => {
return CompareFacesError::InvalidParameter(String::from(error_message))
}
"InvalidS3ObjectException" => {
return CompareFacesError::InvalidS3Object(String::from(error_message))
}
"ProvisionedThroughputExceededException" => {
return CompareFacesError::ProvisionedThroughputExceeded(String::from(
error_message,
))
}
"ThrottlingException" => {
return CompareFacesError::Throttling(String::from(error_message))
}
"ValidationException" => {
return CompareFacesError::Validation(error_message.to_string())
}
_ => {}
}
}
return CompareFacesError::Unknown(res);
}
}
impl From<serde_json::error::Error> for CompareFacesError {
fn from(err: serde_json::error::Error) -> CompareFacesError {
CompareFacesError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for CompareFacesError {
fn from(err: CredentialsError) -> CompareFacesError {
CompareFacesError::Credentials(err)
}
}
impl From<HttpDispatchError> for CompareFacesError {
fn from(err: HttpDispatchError) -> CompareFacesError {
CompareFacesError::HttpDispatch(err)
}
}
impl From<io::Error> for CompareFacesError {
fn from(err: io::Error) -> CompareFacesError {
CompareFacesError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for CompareFacesError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for CompareFacesError {
fn description(&self) -> &str {
match *self {
CompareFacesError::AccessDenied(ref cause) => cause,
CompareFacesError::ImageTooLarge(ref cause) => cause,
CompareFacesError::InternalServerError(ref cause) => cause,
CompareFacesError::InvalidImageFormat(ref cause) => cause,
CompareFacesError::InvalidParameter(ref cause) => cause,
CompareFacesError::InvalidS3Object(ref cause) => cause,
CompareFacesError::ProvisionedThroughputExceeded(ref cause) => cause,
CompareFacesError::Throttling(ref cause) => cause,
CompareFacesError::Validation(ref cause) => cause,
CompareFacesError::Credentials(ref err) => err.description(),
CompareFacesError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
CompareFacesError::ParseError(ref cause) => cause,
CompareFacesError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum CreateCollectionError {
AccessDenied(String),
InternalServerError(String),
InvalidParameter(String),
ProvisionedThroughputExceeded(String),
ResourceAlreadyExists(String),
Throttling(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl CreateCollectionError {
pub fn from_response(res: BufferedHttpResponse) -> CreateCollectionError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"AccessDeniedException" => {
return CreateCollectionError::AccessDenied(String::from(error_message))
}
"InternalServerError" => {
return CreateCollectionError::InternalServerError(String::from(error_message))
}
"InvalidParameterException" => {
return CreateCollectionError::InvalidParameter(String::from(error_message))
}
"ProvisionedThroughputExceededException" => {
return CreateCollectionError::ProvisionedThroughputExceeded(String::from(
error_message,
))
}
"ResourceAlreadyExistsException" => {
return CreateCollectionError::ResourceAlreadyExists(String::from(error_message))
}
"ThrottlingException" => {
return CreateCollectionError::Throttling(String::from(error_message))
}
"ValidationException" => {
return CreateCollectionError::Validation(error_message.to_string())
}
_ => {}
}
}
return CreateCollectionError::Unknown(res);
}
}
impl From<serde_json::error::Error> for CreateCollectionError {
fn from(err: serde_json::error::Error) -> CreateCollectionError {
CreateCollectionError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for CreateCollectionError {
fn from(err: CredentialsError) -> CreateCollectionError {
CreateCollectionError::Credentials(err)
}
}
impl From<HttpDispatchError> for CreateCollectionError {
fn from(err: HttpDispatchError) -> CreateCollectionError {
CreateCollectionError::HttpDispatch(err)
}
}
impl From<io::Error> for CreateCollectionError {
fn from(err: io::Error) -> CreateCollectionError {
CreateCollectionError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for CreateCollectionError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for CreateCollectionError {
fn description(&self) -> &str {
match *self {
CreateCollectionError::AccessDenied(ref cause) => cause,
CreateCollectionError::InternalServerError(ref cause) => cause,
CreateCollectionError::InvalidParameter(ref cause) => cause,
CreateCollectionError::ProvisionedThroughputExceeded(ref cause) => cause,
CreateCollectionError::ResourceAlreadyExists(ref cause) => cause,
CreateCollectionError::Throttling(ref cause) => cause,
CreateCollectionError::Validation(ref cause) => cause,
CreateCollectionError::Credentials(ref err) => err.description(),
CreateCollectionError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
CreateCollectionError::ParseError(ref cause) => cause,
CreateCollectionError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum CreateStreamProcessorError {
AccessDenied(String),
InternalServerError(String),
InvalidParameter(String),
LimitExceeded(String),
ProvisionedThroughputExceeded(String),
ResourceInUse(String),
Throttling(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl CreateStreamProcessorError {
pub fn from_response(res: BufferedHttpResponse) -> CreateStreamProcessorError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"AccessDeniedException" => {
return CreateStreamProcessorError::AccessDenied(String::from(error_message))
}
"InternalServerError" => {
return CreateStreamProcessorError::InternalServerError(String::from(
error_message,
))
}
"InvalidParameterException" => {
return CreateStreamProcessorError::InvalidParameter(String::from(error_message))
}
"LimitExceededException" => {
return CreateStreamProcessorError::LimitExceeded(String::from(error_message))
}
"ProvisionedThroughputExceededException" => {
return CreateStreamProcessorError::ProvisionedThroughputExceeded(String::from(
error_message,
))
}
"ResourceInUseException" => {
return CreateStreamProcessorError::ResourceInUse(String::from(error_message))
}
"ThrottlingException" => {
return CreateStreamProcessorError::Throttling(String::from(error_message))
}
"ValidationException" => {
return CreateStreamProcessorError::Validation(error_message.to_string())
}
_ => {}
}
}
return CreateStreamProcessorError::Unknown(res);
}
}
impl From<serde_json::error::Error> for CreateStreamProcessorError {
fn from(err: serde_json::error::Error) -> CreateStreamProcessorError {
CreateStreamProcessorError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for CreateStreamProcessorError {
fn from(err: CredentialsError) -> CreateStreamProcessorError {
CreateStreamProcessorError::Credentials(err)
}
}
impl From<HttpDispatchError> for CreateStreamProcessorError {
fn from(err: HttpDispatchError) -> CreateStreamProcessorError {
CreateStreamProcessorError::HttpDispatch(err)
}
}
impl From<io::Error> for CreateStreamProcessorError {
fn from(err: io::Error) -> CreateStreamProcessorError {
CreateStreamProcessorError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for CreateStreamProcessorError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for CreateStreamProcessorError {
fn description(&self) -> &str {
match *self {
CreateStreamProcessorError::AccessDenied(ref cause) => cause,
CreateStreamProcessorError::InternalServerError(ref cause) => cause,
CreateStreamProcessorError::InvalidParameter(ref cause) => cause,
CreateStreamProcessorError::LimitExceeded(ref cause) => cause,
CreateStreamProcessorError::ProvisionedThroughputExceeded(ref cause) => cause,
CreateStreamProcessorError::ResourceInUse(ref cause) => cause,
CreateStreamProcessorError::Throttling(ref cause) => cause,
CreateStreamProcessorError::Validation(ref cause) => cause,
CreateStreamProcessorError::Credentials(ref err) => err.description(),
CreateStreamProcessorError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
CreateStreamProcessorError::ParseError(ref cause) => cause,
CreateStreamProcessorError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DeleteCollectionError {
AccessDenied(String),
InternalServerError(String),
InvalidParameter(String),
ProvisionedThroughputExceeded(String),
ResourceNotFound(String),
Throttling(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DeleteCollectionError {
pub fn from_response(res: BufferedHttpResponse) -> DeleteCollectionError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"AccessDeniedException" => {
return DeleteCollectionError::AccessDenied(String::from(error_message))
}
"InternalServerError" => {
return DeleteCollectionError::InternalServerError(String::from(error_message))
}
"InvalidParameterException" => {
return DeleteCollectionError::InvalidParameter(String::from(error_message))
}
"ProvisionedThroughputExceededException" => {
return DeleteCollectionError::ProvisionedThroughputExceeded(String::from(
error_message,
))
}
"ResourceNotFoundException" => {
return DeleteCollectionError::ResourceNotFound(String::from(error_message))
}
"ThrottlingException" => {
return DeleteCollectionError::Throttling(String::from(error_message))
}
"ValidationException" => {
return DeleteCollectionError::Validation(error_message.to_string())
}
_ => {}
}
}
return DeleteCollectionError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DeleteCollectionError {
fn from(err: serde_json::error::Error) -> DeleteCollectionError {
DeleteCollectionError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DeleteCollectionError {
fn from(err: CredentialsError) -> DeleteCollectionError {
DeleteCollectionError::Credentials(err)
}
}
impl From<HttpDispatchError> for DeleteCollectionError {
fn from(err: HttpDispatchError) -> DeleteCollectionError {
DeleteCollectionError::HttpDispatch(err)
}
}
impl From<io::Error> for DeleteCollectionError {
fn from(err: io::Error) -> DeleteCollectionError {
DeleteCollectionError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DeleteCollectionError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DeleteCollectionError {
fn description(&self) -> &str {
match *self {
DeleteCollectionError::AccessDenied(ref cause) => cause,
DeleteCollectionError::InternalServerError(ref cause) => cause,
DeleteCollectionError::InvalidParameter(ref cause) => cause,
DeleteCollectionError::ProvisionedThroughputExceeded(ref cause) => cause,
DeleteCollectionError::ResourceNotFound(ref cause) => cause,
DeleteCollectionError::Throttling(ref cause) => cause,
DeleteCollectionError::Validation(ref cause) => cause,
DeleteCollectionError::Credentials(ref err) => err.description(),
DeleteCollectionError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
DeleteCollectionError::ParseError(ref cause) => cause,
DeleteCollectionError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DeleteFacesError {
AccessDenied(String),
InternalServerError(String),
InvalidParameter(String),
ProvisionedThroughputExceeded(String),
ResourceNotFound(String),
Throttling(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DeleteFacesError {
pub fn from_response(res: BufferedHttpResponse) -> DeleteFacesError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"AccessDeniedException" => {
return DeleteFacesError::AccessDenied(String::from(error_message))
}
"InternalServerError" => {
return DeleteFacesError::InternalServerError(String::from(error_message))
}
"InvalidParameterException" => {
return DeleteFacesError::InvalidParameter(String::from(error_message))
}
"ProvisionedThroughputExceededException" => {
return DeleteFacesError::ProvisionedThroughputExceeded(String::from(
error_message,
))
}
"ResourceNotFoundException" => {
return DeleteFacesError::ResourceNotFound(String::from(error_message))
}
"ThrottlingException" => {
return DeleteFacesError::Throttling(String::from(error_message))
}
"ValidationException" => {
return DeleteFacesError::Validation(error_message.to_string())
}
_ => {}
}
}
return DeleteFacesError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DeleteFacesError {
fn from(err: serde_json::error::Error) -> DeleteFacesError {
DeleteFacesError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DeleteFacesError {
fn from(err: CredentialsError) -> DeleteFacesError {
DeleteFacesError::Credentials(err)
}
}
impl From<HttpDispatchError> for DeleteFacesError {
fn from(err: HttpDispatchError) -> DeleteFacesError {
DeleteFacesError::HttpDispatch(err)
}
}
impl From<io::Error> for DeleteFacesError {
fn from(err: io::Error) -> DeleteFacesError {
DeleteFacesError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DeleteFacesError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DeleteFacesError {
fn description(&self) -> &str {
match *self {
DeleteFacesError::AccessDenied(ref cause) => cause,
DeleteFacesError::InternalServerError(ref cause) => cause,
DeleteFacesError::InvalidParameter(ref cause) => cause,
DeleteFacesError::ProvisionedThroughputExceeded(ref cause) => cause,
DeleteFacesError::ResourceNotFound(ref cause) => cause,
DeleteFacesError::Throttling(ref cause) => cause,
DeleteFacesError::Validation(ref cause) => cause,
DeleteFacesError::Credentials(ref err) => err.description(),
DeleteFacesError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
DeleteFacesError::ParseError(ref cause) => cause,
DeleteFacesError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DeleteStreamProcessorError {
AccessDenied(String),
InternalServerError(String),
InvalidParameter(String),
ProvisionedThroughputExceeded(String),
ResourceInUse(String),
ResourceNotFound(String),
Throttling(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DeleteStreamProcessorError {
pub fn from_response(res: BufferedHttpResponse) -> DeleteStreamProcessorError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"AccessDeniedException" => {
return DeleteStreamProcessorError::AccessDenied(String::from(error_message))
}
"InternalServerError" => {
return DeleteStreamProcessorError::InternalServerError(String::from(
error_message,
))
}
"InvalidParameterException" => {
return DeleteStreamProcessorError::InvalidParameter(String::from(error_message))
}
"ProvisionedThroughputExceededException" => {
return DeleteStreamProcessorError::ProvisionedThroughputExceeded(String::from(
error_message,
))
}
"ResourceInUseException" => {
return DeleteStreamProcessorError::ResourceInUse(String::from(error_message))
}
"ResourceNotFoundException" => {
return DeleteStreamProcessorError::ResourceNotFound(String::from(error_message))
}
"ThrottlingException" => {
return DeleteStreamProcessorError::Throttling(String::from(error_message))
}
"ValidationException" => {
return DeleteStreamProcessorError::Validation(error_message.to_string())
}
_ => {}
}
}
return DeleteStreamProcessorError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DeleteStreamProcessorError {
fn from(err: serde_json::error::Error) -> DeleteStreamProcessorError {
DeleteStreamProcessorError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DeleteStreamProcessorError {
fn from(err: CredentialsError) -> DeleteStreamProcessorError {
DeleteStreamProcessorError::Credentials(err)
}
}
impl From<HttpDispatchError> for DeleteStreamProcessorError {
fn from(err: HttpDispatchError) -> DeleteStreamProcessorError {
DeleteStreamProcessorError::HttpDispatch(err)
}
}
impl From<io::Error> for DeleteStreamProcessorError {
fn from(err: io::Error) -> DeleteStreamProcessorError {
DeleteStreamProcessorError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DeleteStreamProcessorError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DeleteStreamProcessorError {
fn description(&self) -> &str {
match *self {
DeleteStreamProcessorError::AccessDenied(ref cause) => cause,
DeleteStreamProcessorError::InternalServerError(ref cause) => cause,
DeleteStreamProcessorError::InvalidParameter(ref cause) => cause,
DeleteStreamProcessorError::ProvisionedThroughputExceeded(ref cause) => cause,
DeleteStreamProcessorError::ResourceInUse(ref cause) => cause,
DeleteStreamProcessorError::ResourceNotFound(ref cause) => cause,
DeleteStreamProcessorError::Throttling(ref cause) => cause,
DeleteStreamProcessorError::Validation(ref cause) => cause,
DeleteStreamProcessorError::Credentials(ref err) => err.description(),
DeleteStreamProcessorError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
DeleteStreamProcessorError::ParseError(ref cause) => cause,
DeleteStreamProcessorError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DescribeStreamProcessorError {
AccessDenied(String),
InternalServerError(String),
InvalidParameter(String),
ProvisionedThroughputExceeded(String),
ResourceNotFound(String),
Throttling(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DescribeStreamProcessorError {
pub fn from_response(res: BufferedHttpResponse) -> DescribeStreamProcessorError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"AccessDeniedException" => {
return DescribeStreamProcessorError::AccessDenied(String::from(error_message))
}
"InternalServerError" => {
return DescribeStreamProcessorError::InternalServerError(String::from(
error_message,
))
}
"InvalidParameterException" => {
return DescribeStreamProcessorError::InvalidParameter(String::from(
error_message,
))
}
"ProvisionedThroughputExceededException" => {
return DescribeStreamProcessorError::ProvisionedThroughputExceeded(
String::from(error_message),
)
}
"ResourceNotFoundException" => {
return DescribeStreamProcessorError::ResourceNotFound(String::from(
error_message,
))
}
"ThrottlingException" => {
return DescribeStreamProcessorError::Throttling(String::from(error_message))
}
"ValidationException" => {
return DescribeStreamProcessorError::Validation(error_message.to_string())
}
_ => {}
}
}
return DescribeStreamProcessorError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DescribeStreamProcessorError {
fn from(err: serde_json::error::Error) -> DescribeStreamProcessorError {
DescribeStreamProcessorError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DescribeStreamProcessorError {
fn from(err: CredentialsError) -> DescribeStreamProcessorError {
DescribeStreamProcessorError::Credentials(err)
}
}
impl From<HttpDispatchError> for DescribeStreamProcessorError {
fn from(err: HttpDispatchError) -> DescribeStreamProcessorError {
DescribeStreamProcessorError::HttpDispatch(err)
}
}
impl From<io::Error> for DescribeStreamProcessorError {
fn from(err: io::Error) -> DescribeStreamProcessorError {
DescribeStreamProcessorError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DescribeStreamProcessorError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DescribeStreamProcessorError {
fn description(&self) -> &str {
match *self {
DescribeStreamProcessorError::AccessDenied(ref cause) => cause,
DescribeStreamProcessorError::InternalServerError(ref cause) => cause,
DescribeStreamProcessorError::InvalidParameter(ref cause) => cause,
DescribeStreamProcessorError::ProvisionedThroughputExceeded(ref cause) => cause,
DescribeStreamProcessorError::ResourceNotFound(ref cause) => cause,
DescribeStreamProcessorError::Throttling(ref cause) => cause,
DescribeStreamProcessorError::Validation(ref cause) => cause,
DescribeStreamProcessorError::Credentials(ref err) => err.description(),
DescribeStreamProcessorError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
DescribeStreamProcessorError::ParseError(ref cause) => cause,
DescribeStreamProcessorError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DetectFacesError {
AccessDenied(String),
ImageTooLarge(String),
InternalServerError(String),
InvalidImageFormat(String),
InvalidParameter(String),
InvalidS3Object(String),
ProvisionedThroughputExceeded(String),
Throttling(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DetectFacesError {
pub fn from_response(res: BufferedHttpResponse) -> DetectFacesError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"AccessDeniedException" => {
return DetectFacesError::AccessDenied(String::from(error_message))
}
"ImageTooLargeException" => {
return DetectFacesError::ImageTooLarge(String::from(error_message))
}
"InternalServerError" => {
return DetectFacesError::InternalServerError(String::from(error_message))
}
"InvalidImageFormatException" => {
return DetectFacesError::InvalidImageFormat(String::from(error_message))
}
"InvalidParameterException" => {
return DetectFacesError::InvalidParameter(String::from(error_message))
}
"InvalidS3ObjectException" => {
return DetectFacesError::InvalidS3Object(String::from(error_message))
}
"ProvisionedThroughputExceededException" => {
return DetectFacesError::ProvisionedThroughputExceeded(String::from(
error_message,
))
}
"ThrottlingException" => {
return DetectFacesError::Throttling(String::from(error_message))
}
"ValidationException" => {
return DetectFacesError::Validation(error_message.to_string())
}
_ => {}
}
}
return DetectFacesError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DetectFacesError {
fn from(err: serde_json::error::Error) -> DetectFacesError {
DetectFacesError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DetectFacesError {
fn from(err: CredentialsError) -> DetectFacesError {
DetectFacesError::Credentials(err)
}
}
impl From<HttpDispatchError> for DetectFacesError {
fn from(err: HttpDispatchError) -> DetectFacesError {
DetectFacesError::HttpDispatch(err)
}
}
impl From<io::Error> for DetectFacesError {
fn from(err: io::Error) -> DetectFacesError {
DetectFacesError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DetectFacesError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DetectFacesError {
fn description(&self) -> &str {
match *self {
DetectFacesError::AccessDenied(ref cause) => cause,
DetectFacesError::ImageTooLarge(ref cause) => cause,
DetectFacesError::InternalServerError(ref cause) => cause,
DetectFacesError::InvalidImageFormat(ref cause) => cause,
DetectFacesError::InvalidParameter(ref cause) => cause,
DetectFacesError::InvalidS3Object(ref cause) => cause,
DetectFacesError::ProvisionedThroughputExceeded(ref cause) => cause,
DetectFacesError::Throttling(ref cause) => cause,
DetectFacesError::Validation(ref cause) => cause,
DetectFacesError::Credentials(ref err) => err.description(),
DetectFacesError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
DetectFacesError::ParseError(ref cause) => cause,
DetectFacesError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DetectLabelsError {
AccessDenied(String),
ImageTooLarge(String),
InternalServerError(String),
InvalidImageFormat(String),
InvalidParameter(String),
InvalidS3Object(String),
ProvisionedThroughputExceeded(String),
Throttling(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DetectLabelsError {
pub fn from_response(res: BufferedHttpResponse) -> DetectLabelsError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"AccessDeniedException" => {
return DetectLabelsError::AccessDenied(String::from(error_message))
}
"ImageTooLargeException" => {
return DetectLabelsError::ImageTooLarge(String::from(error_message))
}
"InternalServerError" => {
return DetectLabelsError::InternalServerError(String::from(error_message))
}
"InvalidImageFormatException" => {
return DetectLabelsError::InvalidImageFormat(String::from(error_message))
}
"InvalidParameterException" => {
return DetectLabelsError::InvalidParameter(String::from(error_message))
}
"InvalidS3ObjectException" => {
return DetectLabelsError::InvalidS3Object(String::from(error_message))
}
"ProvisionedThroughputExceededException" => {
return DetectLabelsError::ProvisionedThroughputExceeded(String::from(
error_message,
))
}
"ThrottlingException" => {
return DetectLabelsError::Throttling(String::from(error_message))
}
"ValidationException" => {
return DetectLabelsError::Validation(error_message.to_string())
}
_ => {}
}
}
return DetectLabelsError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DetectLabelsError {
fn from(err: serde_json::error::Error) -> DetectLabelsError {
DetectLabelsError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DetectLabelsError {
fn from(err: CredentialsError) -> DetectLabelsError {
DetectLabelsError::Credentials(err)
}
}
impl From<HttpDispatchError> for DetectLabelsError {
fn from(err: HttpDispatchError) -> DetectLabelsError {
DetectLabelsError::HttpDispatch(err)
}
}
impl From<io::Error> for DetectLabelsError {
fn from(err: io::Error) -> DetectLabelsError {
DetectLabelsError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DetectLabelsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DetectLabelsError {
fn description(&self) -> &str {
match *self {
DetectLabelsError::AccessDenied(ref cause) => cause,
DetectLabelsError::ImageTooLarge(ref cause) => cause,
DetectLabelsError::InternalServerError(ref cause) => cause,
DetectLabelsError::InvalidImageFormat(ref cause) => cause,
DetectLabelsError::InvalidParameter(ref cause) => cause,
DetectLabelsError::InvalidS3Object(ref cause) => cause,
DetectLabelsError::ProvisionedThroughputExceeded(ref cause) => cause,
DetectLabelsError::Throttling(ref cause) => cause,
DetectLabelsError::Validation(ref cause) => cause,
DetectLabelsError::Credentials(ref err) => err.description(),
DetectLabelsError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
DetectLabelsError::ParseError(ref cause) => cause,
DetectLabelsError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DetectModerationLabelsError {
AccessDenied(String),
ImageTooLarge(String),
InternalServerError(String),
InvalidImageFormat(String),
InvalidParameter(String),
InvalidS3Object(String),
ProvisionedThroughputExceeded(String),
Throttling(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DetectModerationLabelsError {
pub fn from_response(res: BufferedHttpResponse) -> DetectModerationLabelsError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"AccessDeniedException" => {
return DetectModerationLabelsError::AccessDenied(String::from(error_message))
}
"ImageTooLargeException" => {
return DetectModerationLabelsError::ImageTooLarge(String::from(error_message))
}
"InternalServerError" => {
return DetectModerationLabelsError::InternalServerError(String::from(
error_message,
))
}
"InvalidImageFormatException" => {
return DetectModerationLabelsError::InvalidImageFormat(String::from(
error_message,
))
}
"InvalidParameterException" => {
return DetectModerationLabelsError::InvalidParameter(String::from(
error_message,
))
}
"InvalidS3ObjectException" => {
return DetectModerationLabelsError::InvalidS3Object(String::from(error_message))
}
"ProvisionedThroughputExceededException" => {
return DetectModerationLabelsError::ProvisionedThroughputExceeded(String::from(
error_message,
))
}
"ThrottlingException" => {
return DetectModerationLabelsError::Throttling(String::from(error_message))
}
"ValidationException" => {
return DetectModerationLabelsError::Validation(error_message.to_string())
}
_ => {}
}
}
return DetectModerationLabelsError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DetectModerationLabelsError {
fn from(err: serde_json::error::Error) -> DetectModerationLabelsError {
DetectModerationLabelsError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DetectModerationLabelsError {
fn from(err: CredentialsError) -> DetectModerationLabelsError {
DetectModerationLabelsError::Credentials(err)
}
}
impl From<HttpDispatchError> for DetectModerationLabelsError {
fn from(err: HttpDispatchError) -> DetectModerationLabelsError {
DetectModerationLabelsError::HttpDispatch(err)
}
}
impl From<io::Error> for DetectModerationLabelsError {
fn from(err: io::Error) -> DetectModerationLabelsError {
DetectModerationLabelsError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DetectModerationLabelsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DetectModerationLabelsError {
fn description(&self) -> &str {
match *self {
DetectModerationLabelsError::AccessDenied(ref cause) => cause,
DetectModerationLabelsError::ImageTooLarge(ref cause) => cause,
DetectModerationLabelsError::InternalServerError(ref cause) => cause,
DetectModerationLabelsError::InvalidImageFormat(ref cause) => cause,
DetectModerationLabelsError::InvalidParameter(ref cause) => cause,
DetectModerationLabelsError::InvalidS3Object(ref cause) => cause,
DetectModerationLabelsError::ProvisionedThroughputExceeded(ref cause) => cause,
DetectModerationLabelsError::Throttling(ref cause) => cause,
DetectModerationLabelsError::Validation(ref cause) => cause,
DetectModerationLabelsError::Credentials(ref err) => err.description(),
DetectModerationLabelsError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
DetectModerationLabelsError::ParseError(ref cause) => cause,
DetectModerationLabelsError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DetectTextError {
AccessDenied(String),
ImageTooLarge(String),
InternalServerError(String),
InvalidImageFormat(String),
InvalidParameter(String),
InvalidS3Object(String),
ProvisionedThroughputExceeded(String),
Throttling(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DetectTextError {
pub fn from_response(res: BufferedHttpResponse) -> DetectTextError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"AccessDeniedException" => {
return DetectTextError::AccessDenied(String::from(error_message))
}
"ImageTooLargeException" => {
return DetectTextError::ImageTooLarge(String::from(error_message))
}
"InternalServerError" => {
return DetectTextError::InternalServerError(String::from(error_message))
}
"InvalidImageFormatException" => {
return DetectTextError::InvalidImageFormat(String::from(error_message))
}
"InvalidParameterException" => {
return DetectTextError::InvalidParameter(String::from(error_message))
}
"InvalidS3ObjectException" => {
return DetectTextError::InvalidS3Object(String::from(error_message))
}
"ProvisionedThroughputExceededException" => {
return DetectTextError::ProvisionedThroughputExceeded(String::from(
error_message,
))
}
"ThrottlingException" => {
return DetectTextError::Throttling(String::from(error_message))
}
"ValidationException" => {
return DetectTextError::Validation(error_message.to_string())
}
_ => {}
}
}
return DetectTextError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DetectTextError {
fn from(err: serde_json::error::Error) -> DetectTextError {
DetectTextError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DetectTextError {
fn from(err: CredentialsError) -> DetectTextError {
DetectTextError::Credentials(err)
}
}
impl From<HttpDispatchError> for DetectTextError {
fn from(err: HttpDispatchError) -> DetectTextError {
DetectTextError::HttpDispatch(err)
}
}
impl From<io::Error> for DetectTextError {
fn from(err: io::Error) -> DetectTextError {
DetectTextError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DetectTextError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DetectTextError {
fn description(&self) -> &str {
match *self {
DetectTextError::AccessDenied(ref cause) => cause,
DetectTextError::ImageTooLarge(ref cause) => cause,
DetectTextError::InternalServerError(ref cause) => cause,
DetectTextError::InvalidImageFormat(ref cause) => cause,
DetectTextError::InvalidParameter(ref cause) => cause,
DetectTextError::InvalidS3Object(ref cause) => cause,
DetectTextError::ProvisionedThroughputExceeded(ref cause) => cause,
DetectTextError::Throttling(ref cause) => cause,
DetectTextError::Validation(ref cause) => cause,
DetectTextError::Credentials(ref err) => err.description(),
DetectTextError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
DetectTextError::ParseError(ref cause) => cause,
DetectTextError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetCelebrityInfoError {
AccessDenied(String),
InternalServerError(String),
InvalidParameter(String),
ProvisionedThroughputExceeded(String),
ResourceNotFound(String),
Throttling(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetCelebrityInfoError {
pub fn from_response(res: BufferedHttpResponse) -> GetCelebrityInfoError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"AccessDeniedException" => {
return GetCelebrityInfoError::AccessDenied(String::from(error_message))
}
"InternalServerError" => {
return GetCelebrityInfoError::InternalServerError(String::from(error_message))
}
"InvalidParameterException" => {
return GetCelebrityInfoError::InvalidParameter(String::from(error_message))
}
"ProvisionedThroughputExceededException" => {
return GetCelebrityInfoError::ProvisionedThroughputExceeded(String::from(
error_message,
))
}
"ResourceNotFoundException" => {
return GetCelebrityInfoError::ResourceNotFound(String::from(error_message))
}
"ThrottlingException" => {
return GetCelebrityInfoError::Throttling(String::from(error_message))
}
"ValidationException" => {
return GetCelebrityInfoError::Validation(error_message.to_string())
}
_ => {}
}
}
return GetCelebrityInfoError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetCelebrityInfoError {
fn from(err: serde_json::error::Error) -> GetCelebrityInfoError {
GetCelebrityInfoError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetCelebrityInfoError {
fn from(err: CredentialsError) -> GetCelebrityInfoError {
GetCelebrityInfoError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetCelebrityInfoError {
fn from(err: HttpDispatchError) -> GetCelebrityInfoError {
GetCelebrityInfoError::HttpDispatch(err)
}
}
impl From<io::Error> for GetCelebrityInfoError {
fn from(err: io::Error) -> GetCelebrityInfoError {
GetCelebrityInfoError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetCelebrityInfoError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetCelebrityInfoError {
fn description(&self) -> &str {
match *self {
GetCelebrityInfoError::AccessDenied(ref cause) => cause,
GetCelebrityInfoError::InternalServerError(ref cause) => cause,
GetCelebrityInfoError::InvalidParameter(ref cause) => cause,
GetCelebrityInfoError::ProvisionedThroughputExceeded(ref cause) => cause,
GetCelebrityInfoError::ResourceNotFound(ref cause) => cause,
GetCelebrityInfoError::Throttling(ref cause) => cause,
GetCelebrityInfoError::Validation(ref cause) => cause,
GetCelebrityInfoError::Credentials(ref err) => err.description(),
GetCelebrityInfoError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
GetCelebrityInfoError::ParseError(ref cause) => cause,
GetCelebrityInfoError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetCelebrityRecognitionError {
AccessDenied(String),
InternalServerError(String),
InvalidPaginationToken(String),
InvalidParameter(String),
ProvisionedThroughputExceeded(String),
ResourceNotFound(String),
Throttling(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetCelebrityRecognitionError {
pub fn from_response(res: BufferedHttpResponse) -> GetCelebrityRecognitionError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"AccessDeniedException" => {
return GetCelebrityRecognitionError::AccessDenied(String::from(error_message))
}
"InternalServerError" => {
return GetCelebrityRecognitionError::InternalServerError(String::from(
error_message,
))
}
"InvalidPaginationTokenException" => {
return GetCelebrityRecognitionError::InvalidPaginationToken(String::from(
error_message,
))
}
"InvalidParameterException" => {
return GetCelebrityRecognitionError::InvalidParameter(String::from(
error_message,
))
}
"ProvisionedThroughputExceededException" => {
return GetCelebrityRecognitionError::ProvisionedThroughputExceeded(
String::from(error_message),
)
}
"ResourceNotFoundException" => {
return GetCelebrityRecognitionError::ResourceNotFound(String::from(
error_message,
))
}
"ThrottlingException" => {
return GetCelebrityRecognitionError::Throttling(String::from(error_message))
}
"ValidationException" => {
return GetCelebrityRecognitionError::Validation(error_message.to_string())
}
_ => {}
}
}
return GetCelebrityRecognitionError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetCelebrityRecognitionError {
fn from(err: serde_json::error::Error) -> GetCelebrityRecognitionError {
GetCelebrityRecognitionError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetCelebrityRecognitionError {
fn from(err: CredentialsError) -> GetCelebrityRecognitionError {
GetCelebrityRecognitionError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetCelebrityRecognitionError {
fn from(err: HttpDispatchError) -> GetCelebrityRecognitionError {
GetCelebrityRecognitionError::HttpDispatch(err)
}
}
impl From<io::Error> for GetCelebrityRecognitionError {
fn from(err: io::Error) -> GetCelebrityRecognitionError {
GetCelebrityRecognitionError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetCelebrityRecognitionError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetCelebrityRecognitionError {
fn description(&self) -> &str {
match *self {
GetCelebrityRecognitionError::AccessDenied(ref cause) => cause,
GetCelebrityRecognitionError::InternalServerError(ref cause) => cause,
GetCelebrityRecognitionError::InvalidPaginationToken(ref cause) => cause,
GetCelebrityRecognitionError::InvalidParameter(ref cause) => cause,
GetCelebrityRecognitionError::ProvisionedThroughputExceeded(ref cause) => cause,
GetCelebrityRecognitionError::ResourceNotFound(ref cause) => cause,
GetCelebrityRecognitionError::Throttling(ref cause) => cause,
GetCelebrityRecognitionError::Validation(ref cause) => cause,
GetCelebrityRecognitionError::Credentials(ref err) => err.description(),
GetCelebrityRecognitionError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
GetCelebrityRecognitionError::ParseError(ref cause) => cause,
GetCelebrityRecognitionError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetContentModerationError {
AccessDenied(String),
InternalServerError(String),
InvalidPaginationToken(String),
InvalidParameter(String),
ProvisionedThroughputExceeded(String),
ResourceNotFound(String),
Throttling(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetContentModerationError {
pub fn from_response(res: BufferedHttpResponse) -> GetContentModerationError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"AccessDeniedException" => {
return GetContentModerationError::AccessDenied(String::from(error_message))
}
"InternalServerError" => {
return GetContentModerationError::InternalServerError(String::from(
error_message,
))
}
"InvalidPaginationTokenException" => {
return GetContentModerationError::InvalidPaginationToken(String::from(
error_message,
))
}
"InvalidParameterException" => {
return GetContentModerationError::InvalidParameter(String::from(error_message))
}
"ProvisionedThroughputExceededException" => {
return GetContentModerationError::ProvisionedThroughputExceeded(String::from(
error_message,
))
}
"ResourceNotFoundException" => {
return GetContentModerationError::ResourceNotFound(String::from(error_message))
}
"ThrottlingException" => {
return GetContentModerationError::Throttling(String::from(error_message))
}
"ValidationException" => {
return GetContentModerationError::Validation(error_message.to_string())
}
_ => {}
}
}
return GetContentModerationError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetContentModerationError {
fn from(err: serde_json::error::Error) -> GetContentModerationError {
GetContentModerationError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetContentModerationError {
fn from(err: CredentialsError) -> GetContentModerationError {
GetContentModerationError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetContentModerationError {
fn from(err: HttpDispatchError) -> GetContentModerationError {
GetContentModerationError::HttpDispatch(err)
}
}
impl From<io::Error> for GetContentModerationError {
fn from(err: io::Error) -> GetContentModerationError {
GetContentModerationError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetContentModerationError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetContentModerationError {
fn description(&self) -> &str {
match *self {
GetContentModerationError::AccessDenied(ref cause) => cause,
GetContentModerationError::InternalServerError(ref cause) => cause,
GetContentModerationError::InvalidPaginationToken(ref cause) => cause,
GetContentModerationError::InvalidParameter(ref cause) => cause,
GetContentModerationError::ProvisionedThroughputExceeded(ref cause) => cause,
GetContentModerationError::ResourceNotFound(ref cause) => cause,
GetContentModerationError::Throttling(ref cause) => cause,
GetContentModerationError::Validation(ref cause) => cause,
GetContentModerationError::Credentials(ref err) => err.description(),
GetContentModerationError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
GetContentModerationError::ParseError(ref cause) => cause,
GetContentModerationError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetFaceDetectionError {
AccessDenied(String),
InternalServerError(String),
InvalidPaginationToken(String),
InvalidParameter(String),
ProvisionedThroughputExceeded(String),
ResourceNotFound(String),
Throttling(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetFaceDetectionError {
pub fn from_response(res: BufferedHttpResponse) -> GetFaceDetectionError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"AccessDeniedException" => {
return GetFaceDetectionError::AccessDenied(String::from(error_message))
}
"InternalServerError" => {
return GetFaceDetectionError::InternalServerError(String::from(error_message))
}
"InvalidPaginationTokenException" => {
return GetFaceDetectionError::InvalidPaginationToken(String::from(
error_message,
))
}
"InvalidParameterException" => {
return GetFaceDetectionError::InvalidParameter(String::from(error_message))
}
"ProvisionedThroughputExceededException" => {
return GetFaceDetectionError::ProvisionedThroughputExceeded(String::from(
error_message,
))
}
"ResourceNotFoundException" => {
return GetFaceDetectionError::ResourceNotFound(String::from(error_message))
}
"ThrottlingException" => {
return GetFaceDetectionError::Throttling(String::from(error_message))
}
"ValidationException" => {
return GetFaceDetectionError::Validation(error_message.to_string())
}
_ => {}
}
}
return GetFaceDetectionError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetFaceDetectionError {
fn from(err: serde_json::error::Error) -> GetFaceDetectionError {
GetFaceDetectionError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetFaceDetectionError {
fn from(err: CredentialsError) -> GetFaceDetectionError {
GetFaceDetectionError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetFaceDetectionError {
fn from(err: HttpDispatchError) -> GetFaceDetectionError {
GetFaceDetectionError::HttpDispatch(err)
}
}
impl From<io::Error> for GetFaceDetectionError {
fn from(err: io::Error) -> GetFaceDetectionError {
GetFaceDetectionError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetFaceDetectionError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetFaceDetectionError {
fn description(&self) -> &str {
match *self {
GetFaceDetectionError::AccessDenied(ref cause) => cause,
GetFaceDetectionError::InternalServerError(ref cause) => cause,
GetFaceDetectionError::InvalidPaginationToken(ref cause) => cause,
GetFaceDetectionError::InvalidParameter(ref cause) => cause,
GetFaceDetectionError::ProvisionedThroughputExceeded(ref cause) => cause,
GetFaceDetectionError::ResourceNotFound(ref cause) => cause,
GetFaceDetectionError::Throttling(ref cause) => cause,
GetFaceDetectionError::Validation(ref cause) => cause,
GetFaceDetectionError::Credentials(ref err) => err.description(),
GetFaceDetectionError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
GetFaceDetectionError::ParseError(ref cause) => cause,
GetFaceDetectionError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetFaceSearchError {
AccessDenied(String),
InternalServerError(String),
InvalidPaginationToken(String),
InvalidParameter(String),
ProvisionedThroughputExceeded(String),
ResourceNotFound(String),
Throttling(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetFaceSearchError {
pub fn from_response(res: BufferedHttpResponse) -> GetFaceSearchError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"AccessDeniedException" => {
return GetFaceSearchError::AccessDenied(String::from(error_message))
}
"InternalServerError" => {
return GetFaceSearchError::InternalServerError(String::from(error_message))
}
"InvalidPaginationTokenException" => {
return GetFaceSearchError::InvalidPaginationToken(String::from(error_message))
}
"InvalidParameterException" => {
return GetFaceSearchError::InvalidParameter(String::from(error_message))
}
"ProvisionedThroughputExceededException" => {
return GetFaceSearchError::ProvisionedThroughputExceeded(String::from(
error_message,
))
}
"ResourceNotFoundException" => {
return GetFaceSearchError::ResourceNotFound(String::from(error_message))
}
"ThrottlingException" => {
return GetFaceSearchError::Throttling(String::from(error_message))
}
"ValidationException" => {
return GetFaceSearchError::Validation(error_message.to_string())
}
_ => {}
}
}
return GetFaceSearchError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetFaceSearchError {
fn from(err: serde_json::error::Error) -> GetFaceSearchError {
GetFaceSearchError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetFaceSearchError {
fn from(err: CredentialsError) -> GetFaceSearchError {
GetFaceSearchError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetFaceSearchError {
fn from(err: HttpDispatchError) -> GetFaceSearchError {
GetFaceSearchError::HttpDispatch(err)
}
}
impl From<io::Error> for GetFaceSearchError {
fn from(err: io::Error) -> GetFaceSearchError {
GetFaceSearchError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetFaceSearchError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetFaceSearchError {
fn description(&self) -> &str {
match *self {
GetFaceSearchError::AccessDenied(ref cause) => cause,
GetFaceSearchError::InternalServerError(ref cause) => cause,
GetFaceSearchError::InvalidPaginationToken(ref cause) => cause,
GetFaceSearchError::InvalidParameter(ref cause) => cause,
GetFaceSearchError::ProvisionedThroughputExceeded(ref cause) => cause,
GetFaceSearchError::ResourceNotFound(ref cause) => cause,
GetFaceSearchError::Throttling(ref cause) => cause,
GetFaceSearchError::Validation(ref cause) => cause,
GetFaceSearchError::Credentials(ref err) => err.description(),
GetFaceSearchError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
GetFaceSearchError::ParseError(ref cause) => cause,
GetFaceSearchError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetLabelDetectionError {
AccessDenied(String),
InternalServerError(String),
InvalidPaginationToken(String),
InvalidParameter(String),
ProvisionedThroughputExceeded(String),
ResourceNotFound(String),
Throttling(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetLabelDetectionError {
pub fn from_response(res: BufferedHttpResponse) -> GetLabelDetectionError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"AccessDeniedException" => {
return GetLabelDetectionError::AccessDenied(String::from(error_message))
}
"InternalServerError" => {
return GetLabelDetectionError::InternalServerError(String::from(error_message))
}
"InvalidPaginationTokenException" => {
return GetLabelDetectionError::InvalidPaginationToken(String::from(
error_message,
))
}
"InvalidParameterException" => {
return GetLabelDetectionError::InvalidParameter(String::from(error_message))
}
"ProvisionedThroughputExceededException" => {
return GetLabelDetectionError::ProvisionedThroughputExceeded(String::from(
error_message,
))
}
"ResourceNotFoundException" => {
return GetLabelDetectionError::ResourceNotFound(String::from(error_message))
}
"ThrottlingException" => {
return GetLabelDetectionError::Throttling(String::from(error_message))
}
"ValidationException" => {
return GetLabelDetectionError::Validation(error_message.to_string())
}
_ => {}
}
}
return GetLabelDetectionError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetLabelDetectionError {
fn from(err: serde_json::error::Error) -> GetLabelDetectionError {
GetLabelDetectionError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetLabelDetectionError {
fn from(err: CredentialsError) -> GetLabelDetectionError {
GetLabelDetectionError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetLabelDetectionError {
fn from(err: HttpDispatchError) -> GetLabelDetectionError {
GetLabelDetectionError::HttpDispatch(err)
}
}
impl From<io::Error> for GetLabelDetectionError {
fn from(err: io::Error) -> GetLabelDetectionError {
GetLabelDetectionError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetLabelDetectionError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetLabelDetectionError {
fn description(&self) -> &str {
match *self {
GetLabelDetectionError::AccessDenied(ref cause) => cause,
GetLabelDetectionError::InternalServerError(ref cause) => cause,
GetLabelDetectionError::InvalidPaginationToken(ref cause) => cause,
GetLabelDetectionError::InvalidParameter(ref cause) => cause,
GetLabelDetectionError::ProvisionedThroughputExceeded(ref cause) => cause,
GetLabelDetectionError::ResourceNotFound(ref cause) => cause,
GetLabelDetectionError::Throttling(ref cause) => cause,
GetLabelDetectionError::Validation(ref cause) => cause,
GetLabelDetectionError::Credentials(ref err) => err.description(),
GetLabelDetectionError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
GetLabelDetectionError::ParseError(ref cause) => cause,
GetLabelDetectionError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetPersonTrackingError {
AccessDenied(String),
InternalServerError(String),
InvalidPaginationToken(String),
InvalidParameter(String),
ProvisionedThroughputExceeded(String),
ResourceNotFound(String),
Throttling(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetPersonTrackingError {
pub fn from_response(res: BufferedHttpResponse) -> GetPersonTrackingError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"AccessDeniedException" => {
return GetPersonTrackingError::AccessDenied(String::from(error_message))
}
"InternalServerError" => {
return GetPersonTrackingError::InternalServerError(String::from(error_message))
}
"InvalidPaginationTokenException" => {
return GetPersonTrackingError::InvalidPaginationToken(String::from(
error_message,
))
}
"InvalidParameterException" => {
return GetPersonTrackingError::InvalidParameter(String::from(error_message))
}
"ProvisionedThroughputExceededException" => {
return GetPersonTrackingError::ProvisionedThroughputExceeded(String::from(
error_message,
))
}
"ResourceNotFoundException" => {
return GetPersonTrackingError::ResourceNotFound(String::from(error_message))
}
"ThrottlingException" => {
return GetPersonTrackingError::Throttling(String::from(error_message))
}
"ValidationException" => {
return GetPersonTrackingError::Validation(error_message.to_string())
}
_ => {}
}
}
return GetPersonTrackingError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetPersonTrackingError {
fn from(err: serde_json::error::Error) -> GetPersonTrackingError {
GetPersonTrackingError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetPersonTrackingError {
fn from(err: CredentialsError) -> GetPersonTrackingError {
GetPersonTrackingError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetPersonTrackingError {
fn from(err: HttpDispatchError) -> GetPersonTrackingError {
GetPersonTrackingError::HttpDispatch(err)
}
}
impl From<io::Error> for GetPersonTrackingError {
fn from(err: io::Error) -> GetPersonTrackingError {
GetPersonTrackingError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetPersonTrackingError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetPersonTrackingError {
fn description(&self) -> &str {
match *self {
GetPersonTrackingError::AccessDenied(ref cause) => cause,
GetPersonTrackingError::InternalServerError(ref cause) => cause,
GetPersonTrackingError::InvalidPaginationToken(ref cause) => cause,
GetPersonTrackingError::InvalidParameter(ref cause) => cause,
GetPersonTrackingError::ProvisionedThroughputExceeded(ref cause) => cause,
GetPersonTrackingError::ResourceNotFound(ref cause) => cause,
GetPersonTrackingError::Throttling(ref cause) => cause,
GetPersonTrackingError::Validation(ref cause) => cause,
GetPersonTrackingError::Credentials(ref err) => err.description(),
GetPersonTrackingError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
GetPersonTrackingError::ParseError(ref cause) => cause,
GetPersonTrackingError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum IndexFacesError {
AccessDenied(String),
ImageTooLarge(String),
InternalServerError(String),
InvalidImageFormat(String),
InvalidParameter(String),
InvalidS3Object(String),
ProvisionedThroughputExceeded(String),
ResourceNotFound(String),
Throttling(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl IndexFacesError {
pub fn from_response(res: BufferedHttpResponse) -> IndexFacesError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"AccessDeniedException" => {
return IndexFacesError::AccessDenied(String::from(error_message))
}
"ImageTooLargeException" => {
return IndexFacesError::ImageTooLarge(String::from(error_message))
}
"InternalServerError" => {
return IndexFacesError::InternalServerError(String::from(error_message))
}
"InvalidImageFormatException" => {
return IndexFacesError::InvalidImageFormat(String::from(error_message))
}
"InvalidParameterException" => {
return IndexFacesError::InvalidParameter(String::from(error_message))
}
"InvalidS3ObjectException" => {
return IndexFacesError::InvalidS3Object(String::from(error_message))
}
"ProvisionedThroughputExceededException" => {
return IndexFacesError::ProvisionedThroughputExceeded(String::from(
error_message,
))
}
"ResourceNotFoundException" => {
return IndexFacesError::ResourceNotFound(String::from(error_message))
}
"ThrottlingException" => {
return IndexFacesError::Throttling(String::from(error_message))
}
"ValidationException" => {
return IndexFacesError::Validation(error_message.to_string())
}
_ => {}
}
}
return IndexFacesError::Unknown(res);
}
}
impl From<serde_json::error::Error> for IndexFacesError {
fn from(err: serde_json::error::Error) -> IndexFacesError {
IndexFacesError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for IndexFacesError {
fn from(err: CredentialsError) -> IndexFacesError {
IndexFacesError::Credentials(err)
}
}
impl From<HttpDispatchError> for IndexFacesError {
fn from(err: HttpDispatchError) -> IndexFacesError {
IndexFacesError::HttpDispatch(err)
}
}
impl From<io::Error> for IndexFacesError {
fn from(err: io::Error) -> IndexFacesError {
IndexFacesError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for IndexFacesError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for IndexFacesError {
fn description(&self) -> &str {
match *self {
IndexFacesError::AccessDenied(ref cause) => cause,
IndexFacesError::ImageTooLarge(ref cause) => cause,
IndexFacesError::InternalServerError(ref cause) => cause,
IndexFacesError::InvalidImageFormat(ref cause) => cause,
IndexFacesError::InvalidParameter(ref cause) => cause,
IndexFacesError::InvalidS3Object(ref cause) => cause,
IndexFacesError::ProvisionedThroughputExceeded(ref cause) => cause,
IndexFacesError::ResourceNotFound(ref cause) => cause,
IndexFacesError::Throttling(ref cause) => cause,
IndexFacesError::Validation(ref cause) => cause,
IndexFacesError::Credentials(ref err) => err.description(),
IndexFacesError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
IndexFacesError::ParseError(ref cause) => cause,
IndexFacesError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListCollectionsError {
AccessDenied(String),
InternalServerError(String),
InvalidPaginationToken(String),
InvalidParameter(String),
ProvisionedThroughputExceeded(String),
ResourceNotFound(String),
Throttling(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ListCollectionsError {
pub fn from_response(res: BufferedHttpResponse) -> ListCollectionsError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"AccessDeniedException" => {
return ListCollectionsError::AccessDenied(String::from(error_message))
}
"InternalServerError" => {
return ListCollectionsError::InternalServerError(String::from(error_message))
}
"InvalidPaginationTokenException" => {
return ListCollectionsError::InvalidPaginationToken(String::from(error_message))
}
"InvalidParameterException" => {
return ListCollectionsError::InvalidParameter(String::from(error_message))
}
"ProvisionedThroughputExceededException" => {
return ListCollectionsError::ProvisionedThroughputExceeded(String::from(
error_message,
))
}
"ResourceNotFoundException" => {
return ListCollectionsError::ResourceNotFound(String::from(error_message))
}
"ThrottlingException" => {
return ListCollectionsError::Throttling(String::from(error_message))
}
"ValidationException" => {
return ListCollectionsError::Validation(error_message.to_string())
}
_ => {}
}
}
return ListCollectionsError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ListCollectionsError {
fn from(err: serde_json::error::Error) -> ListCollectionsError {
ListCollectionsError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ListCollectionsError {
fn from(err: CredentialsError) -> ListCollectionsError {
ListCollectionsError::Credentials(err)
}
}
impl From<HttpDispatchError> for ListCollectionsError {
fn from(err: HttpDispatchError) -> ListCollectionsError {
ListCollectionsError::HttpDispatch(err)
}
}
impl From<io::Error> for ListCollectionsError {
fn from(err: io::Error) -> ListCollectionsError {
ListCollectionsError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ListCollectionsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListCollectionsError {
fn description(&self) -> &str {
match *self {
ListCollectionsError::AccessDenied(ref cause) => cause,
ListCollectionsError::InternalServerError(ref cause) => cause,
ListCollectionsError::InvalidPaginationToken(ref cause) => cause,
ListCollectionsError::InvalidParameter(ref cause) => cause,
ListCollectionsError::ProvisionedThroughputExceeded(ref cause) => cause,
ListCollectionsError::ResourceNotFound(ref cause) => cause,
ListCollectionsError::Throttling(ref cause) => cause,
ListCollectionsError::Validation(ref cause) => cause,
ListCollectionsError::Credentials(ref err) => err.description(),
ListCollectionsError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
ListCollectionsError::ParseError(ref cause) => cause,
ListCollectionsError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListFacesError {
AccessDenied(String),
InternalServerError(String),
InvalidPaginationToken(String),
InvalidParameter(String),
ProvisionedThroughputExceeded(String),
ResourceNotFound(String),
Throttling(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ListFacesError {
pub fn from_response(res: BufferedHttpResponse) -> ListFacesError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"AccessDeniedException" => {
return ListFacesError::AccessDenied(String::from(error_message))
}
"InternalServerError" => {
return ListFacesError::InternalServerError(String::from(error_message))
}
"InvalidPaginationTokenException" => {
return ListFacesError::InvalidPaginationToken(String::from(error_message))
}
"InvalidParameterException" => {
return ListFacesError::InvalidParameter(String::from(error_message))
}
"ProvisionedThroughputExceededException" => {
return ListFacesError::ProvisionedThroughputExceeded(String::from(
error_message,
))
}
"ResourceNotFoundException" => {
return ListFacesError::ResourceNotFound(String::from(error_message))
}
"ThrottlingException" => {
return ListFacesError::Throttling(String::from(error_message))
}
"ValidationException" => {
return ListFacesError::Validation(error_message.to_string())
}
_ => {}
}
}
return ListFacesError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ListFacesError {
fn from(err: serde_json::error::Error) -> ListFacesError {
ListFacesError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ListFacesError {
fn from(err: CredentialsError) -> ListFacesError {
ListFacesError::Credentials(err)
}
}
impl From<HttpDispatchError> for ListFacesError {
fn from(err: HttpDispatchError) -> ListFacesError {
ListFacesError::HttpDispatch(err)
}
}
impl From<io::Error> for ListFacesError {
fn from(err: io::Error) -> ListFacesError {
ListFacesError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ListFacesError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListFacesError {
fn description(&self) -> &str {
match *self {
ListFacesError::AccessDenied(ref cause) => cause,
ListFacesError::InternalServerError(ref cause) => cause,
ListFacesError::InvalidPaginationToken(ref cause) => cause,
ListFacesError::InvalidParameter(ref cause) => cause,
ListFacesError::ProvisionedThroughputExceeded(ref cause) => cause,
ListFacesError::ResourceNotFound(ref cause) => cause,
ListFacesError::Throttling(ref cause) => cause,
ListFacesError::Validation(ref cause) => cause,
ListFacesError::Credentials(ref err) => err.description(),
ListFacesError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
ListFacesError::ParseError(ref cause) => cause,
ListFacesError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListStreamProcessorsError {
AccessDenied(String),
InternalServerError(String),
InvalidPaginationToken(String),
InvalidParameter(String),
ProvisionedThroughputExceeded(String),
Throttling(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ListStreamProcessorsError {
pub fn from_response(res: BufferedHttpResponse) -> ListStreamProcessorsError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"AccessDeniedException" => {
return ListStreamProcessorsError::AccessDenied(String::from(error_message))
}
"InternalServerError" => {
return ListStreamProcessorsError::InternalServerError(String::from(
error_message,
))
}
"InvalidPaginationTokenException" => {
return ListStreamProcessorsError::InvalidPaginationToken(String::from(
error_message,
))
}
"InvalidParameterException" => {
return ListStreamProcessorsError::InvalidParameter(String::from(error_message))
}
"ProvisionedThroughputExceededException" => {
return ListStreamProcessorsError::ProvisionedThroughputExceeded(String::from(
error_message,
))
}
"ThrottlingException" => {
return ListStreamProcessorsError::Throttling(String::from(error_message))
}
"ValidationException" => {
return ListStreamProcessorsError::Validation(error_message.to_string())
}
_ => {}
}
}
return ListStreamProcessorsError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ListStreamProcessorsError {
fn from(err: serde_json::error::Error) -> ListStreamProcessorsError {
ListStreamProcessorsError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ListStreamProcessorsError {
fn from(err: CredentialsError) -> ListStreamProcessorsError {
ListStreamProcessorsError::Credentials(err)
}
}
impl From<HttpDispatchError> for ListStreamProcessorsError {
fn from(err: HttpDispatchError) -> ListStreamProcessorsError {
ListStreamProcessorsError::HttpDispatch(err)
}
}
impl From<io::Error> for ListStreamProcessorsError {
fn from(err: io::Error) -> ListStreamProcessorsError {
ListStreamProcessorsError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ListStreamProcessorsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListStreamProcessorsError {
fn description(&self) -> &str {
match *self {
ListStreamProcessorsError::AccessDenied(ref cause) => cause,
ListStreamProcessorsError::InternalServerError(ref cause) => cause,
ListStreamProcessorsError::InvalidPaginationToken(ref cause) => cause,
ListStreamProcessorsError::InvalidParameter(ref cause) => cause,
ListStreamProcessorsError::ProvisionedThroughputExceeded(ref cause) => cause,
ListStreamProcessorsError::Throttling(ref cause) => cause,
ListStreamProcessorsError::Validation(ref cause) => cause,
ListStreamProcessorsError::Credentials(ref err) => err.description(),
ListStreamProcessorsError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
ListStreamProcessorsError::ParseError(ref cause) => cause,
ListStreamProcessorsError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum RecognizeCelebritiesError {
AccessDenied(String),
ImageTooLarge(String),
InternalServerError(String),
InvalidImageFormat(String),
InvalidParameter(String),
InvalidS3Object(String),
ProvisionedThroughputExceeded(String),
Throttling(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl RecognizeCelebritiesError {
pub fn from_response(res: BufferedHttpResponse) -> RecognizeCelebritiesError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"AccessDeniedException" => {
return RecognizeCelebritiesError::AccessDenied(String::from(error_message))
}
"ImageTooLargeException" => {
return RecognizeCelebritiesError::ImageTooLarge(String::from(error_message))
}
"InternalServerError" => {
return RecognizeCelebritiesError::InternalServerError(String::from(
error_message,
))
}
"InvalidImageFormatException" => {
return RecognizeCelebritiesError::InvalidImageFormat(String::from(
error_message,
))
}
"InvalidParameterException" => {
return RecognizeCelebritiesError::InvalidParameter(String::from(error_message))
}
"InvalidS3ObjectException" => {
return RecognizeCelebritiesError::InvalidS3Object(String::from(error_message))
}
"ProvisionedThroughputExceededException" => {
return RecognizeCelebritiesError::ProvisionedThroughputExceeded(String::from(
error_message,
))
}
"ThrottlingException" => {
return RecognizeCelebritiesError::Throttling(String::from(error_message))
}
"ValidationException" => {
return RecognizeCelebritiesError::Validation(error_message.to_string())
}
_ => {}
}
}
return RecognizeCelebritiesError::Unknown(res);
}
}
impl From<serde_json::error::Error> for RecognizeCelebritiesError {
fn from(err: serde_json::error::Error) -> RecognizeCelebritiesError {
RecognizeCelebritiesError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for RecognizeCelebritiesError {
fn from(err: CredentialsError) -> RecognizeCelebritiesError {
RecognizeCelebritiesError::Credentials(err)
}
}
impl From<HttpDispatchError> for RecognizeCelebritiesError {
fn from(err: HttpDispatchError) -> RecognizeCelebritiesError {
RecognizeCelebritiesError::HttpDispatch(err)
}
}
impl From<io::Error> for RecognizeCelebritiesError {
fn from(err: io::Error) -> RecognizeCelebritiesError {
RecognizeCelebritiesError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for RecognizeCelebritiesError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for RecognizeCelebritiesError {
fn description(&self) -> &str {
match *self {
RecognizeCelebritiesError::AccessDenied(ref cause) => cause,
RecognizeCelebritiesError::ImageTooLarge(ref cause) => cause,
RecognizeCelebritiesError::InternalServerError(ref cause) => cause,
RecognizeCelebritiesError::InvalidImageFormat(ref cause) => cause,
RecognizeCelebritiesError::InvalidParameter(ref cause) => cause,
RecognizeCelebritiesError::InvalidS3Object(ref cause) => cause,
RecognizeCelebritiesError::ProvisionedThroughputExceeded(ref cause) => cause,
RecognizeCelebritiesError::Throttling(ref cause) => cause,
RecognizeCelebritiesError::Validation(ref cause) => cause,
RecognizeCelebritiesError::Credentials(ref err) => err.description(),
RecognizeCelebritiesError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
RecognizeCelebritiesError::ParseError(ref cause) => cause,
RecognizeCelebritiesError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum SearchFacesError {
AccessDenied(String),
InternalServerError(String),
InvalidParameter(String),
ProvisionedThroughputExceeded(String),
ResourceNotFound(String),
Throttling(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl SearchFacesError {
pub fn from_response(res: BufferedHttpResponse) -> SearchFacesError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"AccessDeniedException" => {
return SearchFacesError::AccessDenied(String::from(error_message))
}
"InternalServerError" => {
return SearchFacesError::InternalServerError(String::from(error_message))
}
"InvalidParameterException" => {
return SearchFacesError::InvalidParameter(String::from(error_message))
}
"ProvisionedThroughputExceededException" => {
return SearchFacesError::ProvisionedThroughputExceeded(String::from(
error_message,
))
}
"ResourceNotFoundException" => {
return SearchFacesError::ResourceNotFound(String::from(error_message))
}
"ThrottlingException" => {
return SearchFacesError::Throttling(String::from(error_message))
}
"ValidationException" => {
return SearchFacesError::Validation(error_message.to_string())
}
_ => {}
}
}
return SearchFacesError::Unknown(res);
}
}
impl From<serde_json::error::Error> for SearchFacesError {
fn from(err: serde_json::error::Error) -> SearchFacesError {
SearchFacesError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for SearchFacesError {
fn from(err: CredentialsError) -> SearchFacesError {
SearchFacesError::Credentials(err)
}
}
impl From<HttpDispatchError> for SearchFacesError {
fn from(err: HttpDispatchError) -> SearchFacesError {
SearchFacesError::HttpDispatch(err)
}
}
impl From<io::Error> for SearchFacesError {
fn from(err: io::Error) -> SearchFacesError {
SearchFacesError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for SearchFacesError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for SearchFacesError {
fn description(&self) -> &str {
match *self {
SearchFacesError::AccessDenied(ref cause) => cause,
SearchFacesError::InternalServerError(ref cause) => cause,
SearchFacesError::InvalidParameter(ref cause) => cause,
SearchFacesError::ProvisionedThroughputExceeded(ref cause) => cause,
SearchFacesError::ResourceNotFound(ref cause) => cause,
SearchFacesError::Throttling(ref cause) => cause,
SearchFacesError::Validation(ref cause) => cause,
SearchFacesError::Credentials(ref err) => err.description(),
SearchFacesError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
SearchFacesError::ParseError(ref cause) => cause,
SearchFacesError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum SearchFacesByImageError {
AccessDenied(String),
ImageTooLarge(String),
InternalServerError(String),
InvalidImageFormat(String),
InvalidParameter(String),
InvalidS3Object(String),
ProvisionedThroughputExceeded(String),
ResourceNotFound(String),
Throttling(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl SearchFacesByImageError {
pub fn from_response(res: BufferedHttpResponse) -> SearchFacesByImageError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"AccessDeniedException" => {
return SearchFacesByImageError::AccessDenied(String::from(error_message))
}
"ImageTooLargeException" => {
return SearchFacesByImageError::ImageTooLarge(String::from(error_message))
}
"InternalServerError" => {
return SearchFacesByImageError::InternalServerError(String::from(error_message))
}
"InvalidImageFormatException" => {
return SearchFacesByImageError::InvalidImageFormat(String::from(error_message))
}
"InvalidParameterException" => {
return SearchFacesByImageError::InvalidParameter(String::from(error_message))
}
"InvalidS3ObjectException" => {
return SearchFacesByImageError::InvalidS3Object(String::from(error_message))
}
"ProvisionedThroughputExceededException" => {
return SearchFacesByImageError::ProvisionedThroughputExceeded(String::from(
error_message,
))
}
"ResourceNotFoundException" => {
return SearchFacesByImageError::ResourceNotFound(String::from(error_message))
}
"ThrottlingException" => {
return SearchFacesByImageError::Throttling(String::from(error_message))
}
"ValidationException" => {
return SearchFacesByImageError::Validation(error_message.to_string())
}
_ => {}
}
}
return SearchFacesByImageError::Unknown(res);
}
}
impl From<serde_json::error::Error> for SearchFacesByImageError {
fn from(err: serde_json::error::Error) -> SearchFacesByImageError {
SearchFacesByImageError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for SearchFacesByImageError {
fn from(err: CredentialsError) -> SearchFacesByImageError {
SearchFacesByImageError::Credentials(err)
}
}
impl From<HttpDispatchError> for SearchFacesByImageError {
fn from(err: HttpDispatchError) -> SearchFacesByImageError {
SearchFacesByImageError::HttpDispatch(err)
}
}
impl From<io::Error> for SearchFacesByImageError {
fn from(err: io::Error) -> SearchFacesByImageError {
SearchFacesByImageError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for SearchFacesByImageError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for SearchFacesByImageError {
fn description(&self) -> &str {
match *self {
SearchFacesByImageError::AccessDenied(ref cause) => cause,
SearchFacesByImageError::ImageTooLarge(ref cause) => cause,
SearchFacesByImageError::InternalServerError(ref cause) => cause,
SearchFacesByImageError::InvalidImageFormat(ref cause) => cause,
SearchFacesByImageError::InvalidParameter(ref cause) => cause,
SearchFacesByImageError::InvalidS3Object(ref cause) => cause,
SearchFacesByImageError::ProvisionedThroughputExceeded(ref cause) => cause,
SearchFacesByImageError::ResourceNotFound(ref cause) => cause,
SearchFacesByImageError::Throttling(ref cause) => cause,
SearchFacesByImageError::Validation(ref cause) => cause,
SearchFacesByImageError::Credentials(ref err) => err.description(),
SearchFacesByImageError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
SearchFacesByImageError::ParseError(ref cause) => cause,
SearchFacesByImageError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum StartCelebrityRecognitionError {
AccessDenied(String),
IdempotentParameterMismatch(String),
InternalServerError(String),
InvalidParameter(String),
InvalidS3Object(String),
LimitExceeded(String),
ProvisionedThroughputExceeded(String),
Throttling(String),
VideoTooLarge(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl StartCelebrityRecognitionError {
pub fn from_response(res: BufferedHttpResponse) -> StartCelebrityRecognitionError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"AccessDeniedException" => {
return StartCelebrityRecognitionError::AccessDenied(String::from(error_message))
}
"IdempotentParameterMismatchException" => {
return StartCelebrityRecognitionError::IdempotentParameterMismatch(
String::from(error_message),
)
}
"InternalServerError" => {
return StartCelebrityRecognitionError::InternalServerError(String::from(
error_message,
))
}
"InvalidParameterException" => {
return StartCelebrityRecognitionError::InvalidParameter(String::from(
error_message,
))
}
"InvalidS3ObjectException" => {
return StartCelebrityRecognitionError::InvalidS3Object(String::from(
error_message,
))
}
"LimitExceededException" => {
return StartCelebrityRecognitionError::LimitExceeded(String::from(
error_message,
))
}
"ProvisionedThroughputExceededException" => {
return StartCelebrityRecognitionError::ProvisionedThroughputExceeded(
String::from(error_message),
)
}
"ThrottlingException" => {
return StartCelebrityRecognitionError::Throttling(String::from(error_message))
}
"VideoTooLargeException" => {
return StartCelebrityRecognitionError::VideoTooLarge(String::from(
error_message,
))
}
"ValidationException" => {
return StartCelebrityRecognitionError::Validation(error_message.to_string())
}
_ => {}
}
}
return StartCelebrityRecognitionError::Unknown(res);
}
}
impl From<serde_json::error::Error> for StartCelebrityRecognitionError {
fn from(err: serde_json::error::Error) -> StartCelebrityRecognitionError {
StartCelebrityRecognitionError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for StartCelebrityRecognitionError {
fn from(err: CredentialsError) -> StartCelebrityRecognitionError {
StartCelebrityRecognitionError::Credentials(err)
}
}
impl From<HttpDispatchError> for StartCelebrityRecognitionError {
fn from(err: HttpDispatchError) -> StartCelebrityRecognitionError {
StartCelebrityRecognitionError::HttpDispatch(err)
}
}
impl From<io::Error> for StartCelebrityRecognitionError {
fn from(err: io::Error) -> StartCelebrityRecognitionError {
StartCelebrityRecognitionError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for StartCelebrityRecognitionError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for StartCelebrityRecognitionError {
fn description(&self) -> &str {
match *self {
StartCelebrityRecognitionError::AccessDenied(ref cause) => cause,
StartCelebrityRecognitionError::IdempotentParameterMismatch(ref cause) => cause,
StartCelebrityRecognitionError::InternalServerError(ref cause) => cause,
StartCelebrityRecognitionError::InvalidParameter(ref cause) => cause,
StartCelebrityRecognitionError::InvalidS3Object(ref cause) => cause,
StartCelebrityRecognitionError::LimitExceeded(ref cause) => cause,
StartCelebrityRecognitionError::ProvisionedThroughputExceeded(ref cause) => cause,
StartCelebrityRecognitionError::Throttling(ref cause) => cause,
StartCelebrityRecognitionError::VideoTooLarge(ref cause) => cause,
StartCelebrityRecognitionError::Validation(ref cause) => cause,
StartCelebrityRecognitionError::Credentials(ref err) => err.description(),
StartCelebrityRecognitionError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
StartCelebrityRecognitionError::ParseError(ref cause) => cause,
StartCelebrityRecognitionError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum StartContentModerationError {
AccessDenied(String),
IdempotentParameterMismatch(String),
InternalServerError(String),
InvalidParameter(String),
InvalidS3Object(String),
LimitExceeded(String),
ProvisionedThroughputExceeded(String),
Throttling(String),
VideoTooLarge(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl StartContentModerationError {
pub fn from_response(res: BufferedHttpResponse) -> StartContentModerationError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"AccessDeniedException" => {
return StartContentModerationError::AccessDenied(String::from(error_message))
}
"IdempotentParameterMismatchException" => {
return StartContentModerationError::IdempotentParameterMismatch(String::from(
error_message,
))
}
"InternalServerError" => {
return StartContentModerationError::InternalServerError(String::from(
error_message,
))
}
"InvalidParameterException" => {
return StartContentModerationError::InvalidParameter(String::from(
error_message,
))
}
"InvalidS3ObjectException" => {
return StartContentModerationError::InvalidS3Object(String::from(error_message))
}
"LimitExceededException" => {
return StartContentModerationError::LimitExceeded(String::from(error_message))
}
"ProvisionedThroughputExceededException" => {
return StartContentModerationError::ProvisionedThroughputExceeded(String::from(
error_message,
))
}
"ThrottlingException" => {
return StartContentModerationError::Throttling(String::from(error_message))
}
"VideoTooLargeException" => {
return StartContentModerationError::VideoTooLarge(String::from(error_message))
}
"ValidationException" => {
return StartContentModerationError::Validation(error_message.to_string())
}
_ => {}
}
}
return StartContentModerationError::Unknown(res);
}
}
impl From<serde_json::error::Error> for StartContentModerationError {
fn from(err: serde_json::error::Error) -> StartContentModerationError {
StartContentModerationError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for StartContentModerationError {
fn from(err: CredentialsError) -> StartContentModerationError {
StartContentModerationError::Credentials(err)
}
}
impl From<HttpDispatchError> for StartContentModerationError {
fn from(err: HttpDispatchError) -> StartContentModerationError {
StartContentModerationError::HttpDispatch(err)
}
}
impl From<io::Error> for StartContentModerationError {
fn from(err: io::Error) -> StartContentModerationError {
StartContentModerationError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for StartContentModerationError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for StartContentModerationError {
fn description(&self) -> &str {
match *self {
StartContentModerationError::AccessDenied(ref cause) => cause,
StartContentModerationError::IdempotentParameterMismatch(ref cause) => cause,
StartContentModerationError::InternalServerError(ref cause) => cause,
StartContentModerationError::InvalidParameter(ref cause) => cause,
StartContentModerationError::InvalidS3Object(ref cause) => cause,
StartContentModerationError::LimitExceeded(ref cause) => cause,
StartContentModerationError::ProvisionedThroughputExceeded(ref cause) => cause,
StartContentModerationError::Throttling(ref cause) => cause,
StartContentModerationError::VideoTooLarge(ref cause) => cause,
StartContentModerationError::Validation(ref cause) => cause,
StartContentModerationError::Credentials(ref err) => err.description(),
StartContentModerationError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
StartContentModerationError::ParseError(ref cause) => cause,
StartContentModerationError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum StartFaceDetectionError {
AccessDenied(String),
IdempotentParameterMismatch(String),
InternalServerError(String),
InvalidParameter(String),
InvalidS3Object(String),
LimitExceeded(String),
ProvisionedThroughputExceeded(String),
Throttling(String),
VideoTooLarge(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl StartFaceDetectionError {
pub fn from_response(res: BufferedHttpResponse) -> StartFaceDetectionError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"AccessDeniedException" => {
return StartFaceDetectionError::AccessDenied(String::from(error_message))
}
"IdempotentParameterMismatchException" => {
return StartFaceDetectionError::IdempotentParameterMismatch(String::from(
error_message,
))
}
"InternalServerError" => {
return StartFaceDetectionError::InternalServerError(String::from(error_message))
}
"InvalidParameterException" => {
return StartFaceDetectionError::InvalidParameter(String::from(error_message))
}
"InvalidS3ObjectException" => {
return StartFaceDetectionError::InvalidS3Object(String::from(error_message))
}
"LimitExceededException" => {
return StartFaceDetectionError::LimitExceeded(String::from(error_message))
}
"ProvisionedThroughputExceededException" => {
return StartFaceDetectionError::ProvisionedThroughputExceeded(String::from(
error_message,
))
}
"ThrottlingException" => {
return StartFaceDetectionError::Throttling(String::from(error_message))
}
"VideoTooLargeException" => {
return StartFaceDetectionError::VideoTooLarge(String::from(error_message))
}
"ValidationException" => {
return StartFaceDetectionError::Validation(error_message.to_string())
}
_ => {}
}
}
return StartFaceDetectionError::Unknown(res);
}
}
impl From<serde_json::error::Error> for StartFaceDetectionError {
fn from(err: serde_json::error::Error) -> StartFaceDetectionError {
StartFaceDetectionError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for StartFaceDetectionError {
fn from(err: CredentialsError) -> StartFaceDetectionError {
StartFaceDetectionError::Credentials(err)
}
}
impl From<HttpDispatchError> for StartFaceDetectionError {
fn from(err: HttpDispatchError) -> StartFaceDetectionError {
StartFaceDetectionError::HttpDispatch(err)
}
}
impl From<io::Error> for StartFaceDetectionError {
fn from(err: io::Error) -> StartFaceDetectionError {
StartFaceDetectionError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for StartFaceDetectionError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for StartFaceDetectionError {
fn description(&self) -> &str {
match *self {
StartFaceDetectionError::AccessDenied(ref cause) => cause,
StartFaceDetectionError::IdempotentParameterMismatch(ref cause) => cause,
StartFaceDetectionError::InternalServerError(ref cause) => cause,
StartFaceDetectionError::InvalidParameter(ref cause) => cause,
StartFaceDetectionError::InvalidS3Object(ref cause) => cause,
StartFaceDetectionError::LimitExceeded(ref cause) => cause,
StartFaceDetectionError::ProvisionedThroughputExceeded(ref cause) => cause,
StartFaceDetectionError::Throttling(ref cause) => cause,
StartFaceDetectionError::VideoTooLarge(ref cause) => cause,
StartFaceDetectionError::Validation(ref cause) => cause,
StartFaceDetectionError::Credentials(ref err) => err.description(),
StartFaceDetectionError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
StartFaceDetectionError::ParseError(ref cause) => cause,
StartFaceDetectionError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum StartFaceSearchError {
AccessDenied(String),
IdempotentParameterMismatch(String),
InternalServerError(String),
InvalidParameter(String),
InvalidS3Object(String),
LimitExceeded(String),
ProvisionedThroughputExceeded(String),
ResourceNotFound(String),
Throttling(String),
VideoTooLarge(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl StartFaceSearchError {
pub fn from_response(res: BufferedHttpResponse) -> StartFaceSearchError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"AccessDeniedException" => {
return StartFaceSearchError::AccessDenied(String::from(error_message))
}
"IdempotentParameterMismatchException" => {
return StartFaceSearchError::IdempotentParameterMismatch(String::from(
error_message,
))
}
"InternalServerError" => {
return StartFaceSearchError::InternalServerError(String::from(error_message))
}
"InvalidParameterException" => {
return StartFaceSearchError::InvalidParameter(String::from(error_message))
}
"InvalidS3ObjectException" => {
return StartFaceSearchError::InvalidS3Object(String::from(error_message))
}
"LimitExceededException" => {
return StartFaceSearchError::LimitExceeded(String::from(error_message))
}
"ProvisionedThroughputExceededException" => {
return StartFaceSearchError::ProvisionedThroughputExceeded(String::from(
error_message,
))
}
"ResourceNotFoundException" => {
return StartFaceSearchError::ResourceNotFound(String::from(error_message))
}
"ThrottlingException" => {
return StartFaceSearchError::Throttling(String::from(error_message))
}
"VideoTooLargeException" => {
return StartFaceSearchError::VideoTooLarge(String::from(error_message))
}
"ValidationException" => {
return StartFaceSearchError::Validation(error_message.to_string())
}
_ => {}
}
}
return StartFaceSearchError::Unknown(res);
}
}
impl From<serde_json::error::Error> for StartFaceSearchError {
fn from(err: serde_json::error::Error) -> StartFaceSearchError {
StartFaceSearchError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for StartFaceSearchError {
fn from(err: CredentialsError) -> StartFaceSearchError {
StartFaceSearchError::Credentials(err)
}
}
impl From<HttpDispatchError> for StartFaceSearchError {
fn from(err: HttpDispatchError) -> StartFaceSearchError {
StartFaceSearchError::HttpDispatch(err)
}
}
impl From<io::Error> for StartFaceSearchError {
fn from(err: io::Error) -> StartFaceSearchError {
StartFaceSearchError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for StartFaceSearchError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for StartFaceSearchError {
fn description(&self) -> &str {
match *self {
StartFaceSearchError::AccessDenied(ref cause) => cause,
StartFaceSearchError::IdempotentParameterMismatch(ref cause) => cause,
StartFaceSearchError::InternalServerError(ref cause) => cause,
StartFaceSearchError::InvalidParameter(ref cause) => cause,
StartFaceSearchError::InvalidS3Object(ref cause) => cause,
StartFaceSearchError::LimitExceeded(ref cause) => cause,
StartFaceSearchError::ProvisionedThroughputExceeded(ref cause) => cause,
StartFaceSearchError::ResourceNotFound(ref cause) => cause,
StartFaceSearchError::Throttling(ref cause) => cause,
StartFaceSearchError::VideoTooLarge(ref cause) => cause,
StartFaceSearchError::Validation(ref cause) => cause,
StartFaceSearchError::Credentials(ref err) => err.description(),
StartFaceSearchError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
StartFaceSearchError::ParseError(ref cause) => cause,
StartFaceSearchError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum StartLabelDetectionError {
AccessDenied(String),
IdempotentParameterMismatch(String),
InternalServerError(String),
InvalidParameter(String),
InvalidS3Object(String),
LimitExceeded(String),
ProvisionedThroughputExceeded(String),
Throttling(String),
VideoTooLarge(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl StartLabelDetectionError {
pub fn from_response(res: BufferedHttpResponse) -> StartLabelDetectionError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"AccessDeniedException" => {
return StartLabelDetectionError::AccessDenied(String::from(error_message))
}
"IdempotentParameterMismatchException" => {
return StartLabelDetectionError::IdempotentParameterMismatch(String::from(
error_message,
))
}
"InternalServerError" => {
return StartLabelDetectionError::InternalServerError(String::from(
error_message,
))
}
"InvalidParameterException" => {
return StartLabelDetectionError::InvalidParameter(String::from(error_message))
}
"InvalidS3ObjectException" => {
return StartLabelDetectionError::InvalidS3Object(String::from(error_message))
}
"LimitExceededException" => {
return StartLabelDetectionError::LimitExceeded(String::from(error_message))
}
"ProvisionedThroughputExceededException" => {
return StartLabelDetectionError::ProvisionedThroughputExceeded(String::from(
error_message,
))
}
"ThrottlingException" => {
return StartLabelDetectionError::Throttling(String::from(error_message))
}
"VideoTooLargeException" => {
return StartLabelDetectionError::VideoTooLarge(String::from(error_message))
}
"ValidationException" => {
return StartLabelDetectionError::Validation(error_message.to_string())
}
_ => {}
}
}
return StartLabelDetectionError::Unknown(res);
}
}
impl From<serde_json::error::Error> for StartLabelDetectionError {
fn from(err: serde_json::error::Error) -> StartLabelDetectionError {
StartLabelDetectionError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for StartLabelDetectionError {
fn from(err: CredentialsError) -> StartLabelDetectionError {
StartLabelDetectionError::Credentials(err)
}
}
impl From<HttpDispatchError> for StartLabelDetectionError {
fn from(err: HttpDispatchError) -> StartLabelDetectionError {
StartLabelDetectionError::HttpDispatch(err)
}
}
impl From<io::Error> for StartLabelDetectionError {
fn from(err: io::Error) -> StartLabelDetectionError {
StartLabelDetectionError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for StartLabelDetectionError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for StartLabelDetectionError {
fn description(&self) -> &str {
match *self {
StartLabelDetectionError::AccessDenied(ref cause) => cause,
StartLabelDetectionError::IdempotentParameterMismatch(ref cause) => cause,
StartLabelDetectionError::InternalServerError(ref cause) => cause,
StartLabelDetectionError::InvalidParameter(ref cause) => cause,
StartLabelDetectionError::InvalidS3Object(ref cause) => cause,
StartLabelDetectionError::LimitExceeded(ref cause) => cause,
StartLabelDetectionError::ProvisionedThroughputExceeded(ref cause) => cause,
StartLabelDetectionError::Throttling(ref cause) => cause,
StartLabelDetectionError::VideoTooLarge(ref cause) => cause,
StartLabelDetectionError::Validation(ref cause) => cause,
StartLabelDetectionError::Credentials(ref err) => err.description(),
StartLabelDetectionError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
StartLabelDetectionError::ParseError(ref cause) => cause,
StartLabelDetectionError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum StartPersonTrackingError {
AccessDenied(String),
IdempotentParameterMismatch(String),
InternalServerError(String),
InvalidParameter(String),
InvalidS3Object(String),
LimitExceeded(String),
ProvisionedThroughputExceeded(String),
Throttling(String),
VideoTooLarge(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl StartPersonTrackingError {
pub fn from_response(res: BufferedHttpResponse) -> StartPersonTrackingError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"AccessDeniedException" => {
return StartPersonTrackingError::AccessDenied(String::from(error_message))
}
"IdempotentParameterMismatchException" => {
return StartPersonTrackingError::IdempotentParameterMismatch(String::from(
error_message,
))
}
"InternalServerError" => {
return StartPersonTrackingError::InternalServerError(String::from(
error_message,
))
}
"InvalidParameterException" => {
return StartPersonTrackingError::InvalidParameter(String::from(error_message))
}
"InvalidS3ObjectException" => {
return StartPersonTrackingError::InvalidS3Object(String::from(error_message))
}
"LimitExceededException" => {
return StartPersonTrackingError::LimitExceeded(String::from(error_message))
}
"ProvisionedThroughputExceededException" => {
return StartPersonTrackingError::ProvisionedThroughputExceeded(String::from(
error_message,
))
}
"ThrottlingException" => {
return StartPersonTrackingError::Throttling(String::from(error_message))
}
"VideoTooLargeException" => {
return StartPersonTrackingError::VideoTooLarge(String::from(error_message))
}
"ValidationException" => {
return StartPersonTrackingError::Validation(error_message.to_string())
}
_ => {}
}
}
return StartPersonTrackingError::Unknown(res);
}
}
impl From<serde_json::error::Error> for StartPersonTrackingError {
fn from(err: serde_json::error::Error) -> StartPersonTrackingError {
StartPersonTrackingError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for StartPersonTrackingError {
fn from(err: CredentialsError) -> StartPersonTrackingError {
StartPersonTrackingError::Credentials(err)
}
}
impl From<HttpDispatchError> for StartPersonTrackingError {
fn from(err: HttpDispatchError) -> StartPersonTrackingError {
StartPersonTrackingError::HttpDispatch(err)
}
}
impl From<io::Error> for StartPersonTrackingError {
fn from(err: io::Error) -> StartPersonTrackingError {
StartPersonTrackingError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for StartPersonTrackingError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for StartPersonTrackingError {
fn description(&self) -> &str {
match *self {
StartPersonTrackingError::AccessDenied(ref cause) => cause,
StartPersonTrackingError::IdempotentParameterMismatch(ref cause) => cause,
StartPersonTrackingError::InternalServerError(ref cause) => cause,
StartPersonTrackingError::InvalidParameter(ref cause) => cause,
StartPersonTrackingError::InvalidS3Object(ref cause) => cause,
StartPersonTrackingError::LimitExceeded(ref cause) => cause,
StartPersonTrackingError::ProvisionedThroughputExceeded(ref cause) => cause,
StartPersonTrackingError::Throttling(ref cause) => cause,
StartPersonTrackingError::VideoTooLarge(ref cause) => cause,
StartPersonTrackingError::Validation(ref cause) => cause,
StartPersonTrackingError::Credentials(ref err) => err.description(),
StartPersonTrackingError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
StartPersonTrackingError::ParseError(ref cause) => cause,
StartPersonTrackingError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum StartStreamProcessorError {
AccessDenied(String),
InternalServerError(String),
InvalidParameter(String),
ProvisionedThroughputExceeded(String),
ResourceInUse(String),
ResourceNotFound(String),
Throttling(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl StartStreamProcessorError {
pub fn from_response(res: BufferedHttpResponse) -> StartStreamProcessorError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"AccessDeniedException" => {
return StartStreamProcessorError::AccessDenied(String::from(error_message))
}
"InternalServerError" => {
return StartStreamProcessorError::InternalServerError(String::from(
error_message,
))
}
"InvalidParameterException" => {
return StartStreamProcessorError::InvalidParameter(String::from(error_message))
}
"ProvisionedThroughputExceededException" => {
return StartStreamProcessorError::ProvisionedThroughputExceeded(String::from(
error_message,
))
}
"ResourceInUseException" => {
return StartStreamProcessorError::ResourceInUse(String::from(error_message))
}
"ResourceNotFoundException" => {
return StartStreamProcessorError::ResourceNotFound(String::from(error_message))
}
"ThrottlingException" => {
return StartStreamProcessorError::Throttling(String::from(error_message))
}
"ValidationException" => {
return StartStreamProcessorError::Validation(error_message.to_string())
}
_ => {}
}
}
return StartStreamProcessorError::Unknown(res);
}
}
impl From<serde_json::error::Error> for StartStreamProcessorError {
fn from(err: serde_json::error::Error) -> StartStreamProcessorError {
StartStreamProcessorError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for StartStreamProcessorError {
fn from(err: CredentialsError) -> StartStreamProcessorError {
StartStreamProcessorError::Credentials(err)
}
}
impl From<HttpDispatchError> for StartStreamProcessorError {
fn from(err: HttpDispatchError) -> StartStreamProcessorError {
StartStreamProcessorError::HttpDispatch(err)
}
}
impl From<io::Error> for StartStreamProcessorError {
fn from(err: io::Error) -> StartStreamProcessorError {
StartStreamProcessorError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for StartStreamProcessorError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for StartStreamProcessorError {
fn description(&self) -> &str {
match *self {
StartStreamProcessorError::AccessDenied(ref cause) => cause,
StartStreamProcessorError::InternalServerError(ref cause) => cause,
StartStreamProcessorError::InvalidParameter(ref cause) => cause,
StartStreamProcessorError::ProvisionedThroughputExceeded(ref cause) => cause,
StartStreamProcessorError::ResourceInUse(ref cause) => cause,
StartStreamProcessorError::ResourceNotFound(ref cause) => cause,
StartStreamProcessorError::Throttling(ref cause) => cause,
StartStreamProcessorError::Validation(ref cause) => cause,
StartStreamProcessorError::Credentials(ref err) => err.description(),
StartStreamProcessorError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
StartStreamProcessorError::ParseError(ref cause) => cause,
StartStreamProcessorError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum StopStreamProcessorError {
AccessDenied(String),
InternalServerError(String),
InvalidParameter(String),
ProvisionedThroughputExceeded(String),
ResourceInUse(String),
ResourceNotFound(String),
Throttling(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl StopStreamProcessorError {
pub fn from_response(res: BufferedHttpResponse) -> StopStreamProcessorError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"AccessDeniedException" => {
return StopStreamProcessorError::AccessDenied(String::from(error_message))
}
"InternalServerError" => {
return StopStreamProcessorError::InternalServerError(String::from(
error_message,
))
}
"InvalidParameterException" => {
return StopStreamProcessorError::InvalidParameter(String::from(error_message))
}
"ProvisionedThroughputExceededException" => {
return StopStreamProcessorError::ProvisionedThroughputExceeded(String::from(
error_message,
))
}
"ResourceInUseException" => {
return StopStreamProcessorError::ResourceInUse(String::from(error_message))
}
"ResourceNotFoundException" => {
return StopStreamProcessorError::ResourceNotFound(String::from(error_message))
}
"ThrottlingException" => {
return StopStreamProcessorError::Throttling(String::from(error_message))
}
"ValidationException" => {
return StopStreamProcessorError::Validation(error_message.to_string())
}
_ => {}
}
}
return StopStreamProcessorError::Unknown(res);
}
}
impl From<serde_json::error::Error> for StopStreamProcessorError {
fn from(err: serde_json::error::Error) -> StopStreamProcessorError {
StopStreamProcessorError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for StopStreamProcessorError {
fn from(err: CredentialsError) -> StopStreamProcessorError {
StopStreamProcessorError::Credentials(err)
}
}
impl From<HttpDispatchError> for StopStreamProcessorError {
fn from(err: HttpDispatchError) -> StopStreamProcessorError {
StopStreamProcessorError::HttpDispatch(err)
}
}
impl From<io::Error> for StopStreamProcessorError {
fn from(err: io::Error) -> StopStreamProcessorError {
StopStreamProcessorError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for StopStreamProcessorError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for StopStreamProcessorError {
fn description(&self) -> &str {
match *self {
StopStreamProcessorError::AccessDenied(ref cause) => cause,
StopStreamProcessorError::InternalServerError(ref cause) => cause,
StopStreamProcessorError::InvalidParameter(ref cause) => cause,
StopStreamProcessorError::ProvisionedThroughputExceeded(ref cause) => cause,
StopStreamProcessorError::ResourceInUse(ref cause) => cause,
StopStreamProcessorError::ResourceNotFound(ref cause) => cause,
StopStreamProcessorError::Throttling(ref cause) => cause,
StopStreamProcessorError::Validation(ref cause) => cause,
StopStreamProcessorError::Credentials(ref err) => err.description(),
StopStreamProcessorError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
StopStreamProcessorError::ParseError(ref cause) => cause,
StopStreamProcessorError::Unknown(_) => "unknown error",
}
}
}
pub trait Rekognition {
fn compare_faces(
&self,
input: CompareFacesRequest,
) -> RusotoFuture<CompareFacesResponse, CompareFacesError>;
fn create_collection(
&self,
input: CreateCollectionRequest,
) -> RusotoFuture<CreateCollectionResponse, CreateCollectionError>;
fn create_stream_processor(
&self,
input: CreateStreamProcessorRequest,
) -> RusotoFuture<CreateStreamProcessorResponse, CreateStreamProcessorError>;
fn delete_collection(
&self,
input: DeleteCollectionRequest,
) -> RusotoFuture<DeleteCollectionResponse, DeleteCollectionError>;
fn delete_faces(
&self,
input: DeleteFacesRequest,
) -> RusotoFuture<DeleteFacesResponse, DeleteFacesError>;
fn delete_stream_processor(
&self,
input: DeleteStreamProcessorRequest,
) -> RusotoFuture<DeleteStreamProcessorResponse, DeleteStreamProcessorError>;
fn describe_stream_processor(
&self,
input: DescribeStreamProcessorRequest,
) -> RusotoFuture<DescribeStreamProcessorResponse, DescribeStreamProcessorError>;
fn detect_faces(
&self,
input: DetectFacesRequest,
) -> RusotoFuture<DetectFacesResponse, DetectFacesError>;
fn detect_labels(
&self,
input: DetectLabelsRequest,
) -> RusotoFuture<DetectLabelsResponse, DetectLabelsError>;
fn detect_moderation_labels(
&self,
input: DetectModerationLabelsRequest,
) -> RusotoFuture<DetectModerationLabelsResponse, DetectModerationLabelsError>;
fn detect_text(
&self,
input: DetectTextRequest,
) -> RusotoFuture<DetectTextResponse, DetectTextError>;
fn get_celebrity_info(
&self,
input: GetCelebrityInfoRequest,
) -> RusotoFuture<GetCelebrityInfoResponse, GetCelebrityInfoError>;
fn get_celebrity_recognition(
&self,
input: GetCelebrityRecognitionRequest,
) -> RusotoFuture<GetCelebrityRecognitionResponse, GetCelebrityRecognitionError>;
fn get_content_moderation(
&self,
input: GetContentModerationRequest,
) -> RusotoFuture<GetContentModerationResponse, GetContentModerationError>;
fn get_face_detection(
&self,
input: GetFaceDetectionRequest,
) -> RusotoFuture<GetFaceDetectionResponse, GetFaceDetectionError>;
fn get_face_search(
&self,
input: GetFaceSearchRequest,
) -> RusotoFuture<GetFaceSearchResponse, GetFaceSearchError>;
fn get_label_detection(
&self,
input: GetLabelDetectionRequest,
) -> RusotoFuture<GetLabelDetectionResponse, GetLabelDetectionError>;
fn get_person_tracking(
&self,
input: GetPersonTrackingRequest,
) -> RusotoFuture<GetPersonTrackingResponse, GetPersonTrackingError>;
fn index_faces(
&self,
input: IndexFacesRequest,
) -> RusotoFuture<IndexFacesResponse, IndexFacesError>;
fn list_collections(
&self,
input: ListCollectionsRequest,
) -> RusotoFuture<ListCollectionsResponse, ListCollectionsError>;
fn list_faces(
&self,
input: ListFacesRequest,
) -> RusotoFuture<ListFacesResponse, ListFacesError>;
fn list_stream_processors(
&self,
input: ListStreamProcessorsRequest,
) -> RusotoFuture<ListStreamProcessorsResponse, ListStreamProcessorsError>;
fn recognize_celebrities(
&self,
input: RecognizeCelebritiesRequest,
) -> RusotoFuture<RecognizeCelebritiesResponse, RecognizeCelebritiesError>;
fn search_faces(
&self,
input: SearchFacesRequest,
) -> RusotoFuture<SearchFacesResponse, SearchFacesError>;
fn search_faces_by_image(
&self,
input: SearchFacesByImageRequest,
) -> RusotoFuture<SearchFacesByImageResponse, SearchFacesByImageError>;
fn start_celebrity_recognition(
&self,
input: StartCelebrityRecognitionRequest,
) -> RusotoFuture<StartCelebrityRecognitionResponse, StartCelebrityRecognitionError>;
fn start_content_moderation(
&self,
input: StartContentModerationRequest,
) -> RusotoFuture<StartContentModerationResponse, StartContentModerationError>;
fn start_face_detection(
&self,
input: StartFaceDetectionRequest,
) -> RusotoFuture<StartFaceDetectionResponse, StartFaceDetectionError>;
fn start_face_search(
&self,
input: StartFaceSearchRequest,
) -> RusotoFuture<StartFaceSearchResponse, StartFaceSearchError>;
fn start_label_detection(
&self,
input: StartLabelDetectionRequest,
) -> RusotoFuture<StartLabelDetectionResponse, StartLabelDetectionError>;
fn start_person_tracking(
&self,
input: StartPersonTrackingRequest,
) -> RusotoFuture<StartPersonTrackingResponse, StartPersonTrackingError>;
fn start_stream_processor(
&self,
input: StartStreamProcessorRequest,
) -> RusotoFuture<StartStreamProcessorResponse, StartStreamProcessorError>;
fn stop_stream_processor(
&self,
input: StopStreamProcessorRequest,
) -> RusotoFuture<StopStreamProcessorResponse, StopStreamProcessorError>;
}
pub struct RekognitionClient {
client: Client,
region: region::Region,
}
impl RekognitionClient {
pub fn new(region: region::Region) -> RekognitionClient {
RekognitionClient {
client: Client::shared(),
region: region,
}
}
pub fn new_with<P, D>(
request_dispatcher: D,
credentials_provider: P,
region: region::Region,
) -> RekognitionClient
where
P: ProvideAwsCredentials + Send + Sync + 'static,
P::Future: Send,
D: DispatchSignedRequest + Send + Sync + 'static,
D::Future: Send,
{
RekognitionClient {
client: Client::new_with(credentials_provider, request_dispatcher),
region: region,
}
}
}
impl Rekognition for RekognitionClient {
fn compare_faces(
&self,
input: CompareFacesRequest,
) -> RusotoFuture<CompareFacesResponse, CompareFacesError> {
let mut request = SignedRequest::new("POST", "rekognition", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "RekognitionService.CompareFaces");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<CompareFacesResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(CompareFacesError::from_response(response))),
)
}
})
}
fn create_collection(
&self,
input: CreateCollectionRequest,
) -> RusotoFuture<CreateCollectionResponse, CreateCollectionError> {
let mut request = SignedRequest::new("POST", "rekognition", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "RekognitionService.CreateCollection");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<CreateCollectionResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(CreateCollectionError::from_response(response))),
)
}
})
}
fn create_stream_processor(
&self,
input: CreateStreamProcessorRequest,
) -> RusotoFuture<CreateStreamProcessorResponse, CreateStreamProcessorError> {
let mut request = SignedRequest::new("POST", "rekognition", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "RekognitionService.CreateStreamProcessor");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<CreateStreamProcessorResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(CreateStreamProcessorError::from_response(response))
}),
)
}
})
}
fn delete_collection(
&self,
input: DeleteCollectionRequest,
) -> RusotoFuture<DeleteCollectionResponse, DeleteCollectionError> {
let mut request = SignedRequest::new("POST", "rekognition", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "RekognitionService.DeleteCollection");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<DeleteCollectionResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(DeleteCollectionError::from_response(response))),
)
}
})
}
fn delete_faces(
&self,
input: DeleteFacesRequest,
) -> RusotoFuture<DeleteFacesResponse, DeleteFacesError> {
let mut request = SignedRequest::new("POST", "rekognition", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "RekognitionService.DeleteFaces");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<DeleteFacesResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(DeleteFacesError::from_response(response))),
)
}
})
}
fn delete_stream_processor(
&self,
input: DeleteStreamProcessorRequest,
) -> RusotoFuture<DeleteStreamProcessorResponse, DeleteStreamProcessorError> {
let mut request = SignedRequest::new("POST", "rekognition", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "RekognitionService.DeleteStreamProcessor");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<DeleteStreamProcessorResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(DeleteStreamProcessorError::from_response(response))
}),
)
}
})
}
fn describe_stream_processor(
&self,
input: DescribeStreamProcessorRequest,
) -> RusotoFuture<DescribeStreamProcessorResponse, DescribeStreamProcessorError> {
let mut request = SignedRequest::new("POST", "rekognition", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "RekognitionService.DescribeStreamProcessor");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<DescribeStreamProcessorResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(DescribeStreamProcessorError::from_response(response))
}))
}
})
}
fn detect_faces(
&self,
input: DetectFacesRequest,
) -> RusotoFuture<DetectFacesResponse, DetectFacesError> {
let mut request = SignedRequest::new("POST", "rekognition", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "RekognitionService.DetectFaces");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<DetectFacesResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(DetectFacesError::from_response(response))),
)
}
})
}
fn detect_labels(
&self,
input: DetectLabelsRequest,
) -> RusotoFuture<DetectLabelsResponse, DetectLabelsError> {
let mut request = SignedRequest::new("POST", "rekognition", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "RekognitionService.DetectLabels");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<DetectLabelsResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(DetectLabelsError::from_response(response))),
)
}
})
}
fn detect_moderation_labels(
&self,
input: DetectModerationLabelsRequest,
) -> RusotoFuture<DetectModerationLabelsResponse, DetectModerationLabelsError> {
let mut request = SignedRequest::new("POST", "rekognition", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "RekognitionService.DetectModerationLabels");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<DetectModerationLabelsResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(DetectModerationLabelsError::from_response(response))
}),
)
}
})
}
fn detect_text(
&self,
input: DetectTextRequest,
) -> RusotoFuture<DetectTextResponse, DetectTextError> {
let mut request = SignedRequest::new("POST", "rekognition", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "RekognitionService.DetectText");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<DetectTextResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(DetectTextError::from_response(response))),
)
}
})
}
fn get_celebrity_info(
&self,
input: GetCelebrityInfoRequest,
) -> RusotoFuture<GetCelebrityInfoResponse, GetCelebrityInfoError> {
let mut request = SignedRequest::new("POST", "rekognition", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "RekognitionService.GetCelebrityInfo");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<GetCelebrityInfoResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(GetCelebrityInfoError::from_response(response))),
)
}
})
}
fn get_celebrity_recognition(
&self,
input: GetCelebrityRecognitionRequest,
) -> RusotoFuture<GetCelebrityRecognitionResponse, GetCelebrityRecognitionError> {
let mut request = SignedRequest::new("POST", "rekognition", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "RekognitionService.GetCelebrityRecognition");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<GetCelebrityRecognitionResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(GetCelebrityRecognitionError::from_response(response))
}))
}
})
}
fn get_content_moderation(
&self,
input: GetContentModerationRequest,
) -> RusotoFuture<GetContentModerationResponse, GetContentModerationError> {
let mut request = SignedRequest::new("POST", "rekognition", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "RekognitionService.GetContentModeration");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<GetContentModerationResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(GetContentModerationError::from_response(response))
}),
)
}
})
}
fn get_face_detection(
&self,
input: GetFaceDetectionRequest,
) -> RusotoFuture<GetFaceDetectionResponse, GetFaceDetectionError> {
let mut request = SignedRequest::new("POST", "rekognition", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "RekognitionService.GetFaceDetection");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<GetFaceDetectionResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(GetFaceDetectionError::from_response(response))),
)
}
})
}
fn get_face_search(
&self,
input: GetFaceSearchRequest,
) -> RusotoFuture<GetFaceSearchResponse, GetFaceSearchError> {
let mut request = SignedRequest::new("POST", "rekognition", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "RekognitionService.GetFaceSearch");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<GetFaceSearchResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(GetFaceSearchError::from_response(response))),
)
}
})
}
fn get_label_detection(
&self,
input: GetLabelDetectionRequest,
) -> RusotoFuture<GetLabelDetectionResponse, GetLabelDetectionError> {
let mut request = SignedRequest::new("POST", "rekognition", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "RekognitionService.GetLabelDetection");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<GetLabelDetectionResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(GetLabelDetectionError::from_response(response))),
)
}
})
}
fn get_person_tracking(
&self,
input: GetPersonTrackingRequest,
) -> RusotoFuture<GetPersonTrackingResponse, GetPersonTrackingError> {
let mut request = SignedRequest::new("POST", "rekognition", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "RekognitionService.GetPersonTracking");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<GetPersonTrackingResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(GetPersonTrackingError::from_response(response))),
)
}
})
}
fn index_faces(
&self,
input: IndexFacesRequest,
) -> RusotoFuture<IndexFacesResponse, IndexFacesError> {
let mut request = SignedRequest::new("POST", "rekognition", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "RekognitionService.IndexFaces");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<IndexFacesResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(IndexFacesError::from_response(response))),
)
}
})
}
fn list_collections(
&self,
input: ListCollectionsRequest,
) -> RusotoFuture<ListCollectionsResponse, ListCollectionsError> {
let mut request = SignedRequest::new("POST", "rekognition", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "RekognitionService.ListCollections");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<ListCollectionsResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(ListCollectionsError::from_response(response))),
)
}
})
}
fn list_faces(
&self,
input: ListFacesRequest,
) -> RusotoFuture<ListFacesResponse, ListFacesError> {
let mut request = SignedRequest::new("POST", "rekognition", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "RekognitionService.ListFaces");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<ListFacesResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(ListFacesError::from_response(response))),
)
}
})
}
fn list_stream_processors(
&self,
input: ListStreamProcessorsRequest,
) -> RusotoFuture<ListStreamProcessorsResponse, ListStreamProcessorsError> {
let mut request = SignedRequest::new("POST", "rekognition", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "RekognitionService.ListStreamProcessors");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<ListStreamProcessorsResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(ListStreamProcessorsError::from_response(response))
}),
)
}
})
}
fn recognize_celebrities(
&self,
input: RecognizeCelebritiesRequest,
) -> RusotoFuture<RecognizeCelebritiesResponse, RecognizeCelebritiesError> {
let mut request = SignedRequest::new("POST", "rekognition", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "RekognitionService.RecognizeCelebrities");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<RecognizeCelebritiesResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(RecognizeCelebritiesError::from_response(response))
}),
)
}
})
}
fn search_faces(
&self,
input: SearchFacesRequest,
) -> RusotoFuture<SearchFacesResponse, SearchFacesError> {
let mut request = SignedRequest::new("POST", "rekognition", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "RekognitionService.SearchFaces");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<SearchFacesResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(SearchFacesError::from_response(response))),
)
}
})
}
fn search_faces_by_image(
&self,
input: SearchFacesByImageRequest,
) -> RusotoFuture<SearchFacesByImageResponse, SearchFacesByImageError> {
let mut request = SignedRequest::new("POST", "rekognition", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "RekognitionService.SearchFacesByImage");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<SearchFacesByImageResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(SearchFacesByImageError::from_response(response))),
)
}
})
}
fn start_celebrity_recognition(
&self,
input: StartCelebrityRecognitionRequest,
) -> RusotoFuture<StartCelebrityRecognitionResponse, StartCelebrityRecognitionError> {
let mut request = SignedRequest::new("POST", "rekognition", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"RekognitionService.StartCelebrityRecognition",
);
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<StartCelebrityRecognitionResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(StartCelebrityRecognitionError::from_response(response))
}))
}
})
}
fn start_content_moderation(
&self,
input: StartContentModerationRequest,
) -> RusotoFuture<StartContentModerationResponse, StartContentModerationError> {
let mut request = SignedRequest::new("POST", "rekognition", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "RekognitionService.StartContentModeration");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<StartContentModerationResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(StartContentModerationError::from_response(response))
}),
)
}
})
}
fn start_face_detection(
&self,
input: StartFaceDetectionRequest,
) -> RusotoFuture<StartFaceDetectionResponse, StartFaceDetectionError> {
let mut request = SignedRequest::new("POST", "rekognition", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "RekognitionService.StartFaceDetection");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<StartFaceDetectionResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(StartFaceDetectionError::from_response(response))),
)
}
})
}
fn start_face_search(
&self,
input: StartFaceSearchRequest,
) -> RusotoFuture<StartFaceSearchResponse, StartFaceSearchError> {
let mut request = SignedRequest::new("POST", "rekognition", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "RekognitionService.StartFaceSearch");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<StartFaceSearchResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(StartFaceSearchError::from_response(response))),
)
}
})
}
fn start_label_detection(
&self,
input: StartLabelDetectionRequest,
) -> RusotoFuture<StartLabelDetectionResponse, StartLabelDetectionError> {
let mut request = SignedRequest::new("POST", "rekognition", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "RekognitionService.StartLabelDetection");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<StartLabelDetectionResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(StartLabelDetectionError::from_response(response))
}),
)
}
})
}
fn start_person_tracking(
&self,
input: StartPersonTrackingRequest,
) -> RusotoFuture<StartPersonTrackingResponse, StartPersonTrackingError> {
let mut request = SignedRequest::new("POST", "rekognition", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "RekognitionService.StartPersonTracking");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<StartPersonTrackingResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(StartPersonTrackingError::from_response(response))
}),
)
}
})
}
fn start_stream_processor(
&self,
input: StartStreamProcessorRequest,
) -> RusotoFuture<StartStreamProcessorResponse, StartStreamProcessorError> {
let mut request = SignedRequest::new("POST", "rekognition", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "RekognitionService.StartStreamProcessor");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<StartStreamProcessorResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(StartStreamProcessorError::from_response(response))
}),
)
}
})
}
fn stop_stream_processor(
&self,
input: StopStreamProcessorRequest,
) -> RusotoFuture<StopStreamProcessorResponse, StopStreamProcessorError> {
let mut request = SignedRequest::new("POST", "rekognition", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "RekognitionService.StopStreamProcessor");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<StopStreamProcessorResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(StopStreamProcessorError::from_response(response))
}),
)
}
})
}
}
#[cfg(test)]
mod protocol_tests {}