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 ActivityFailedEventDetails {
#[serde(rename = "cause")]
#[serde(skip_serializing_if = "Option::is_none")]
pub cause: Option<String>,
#[serde(rename = "error")]
#[serde(skip_serializing_if = "Option::is_none")]
pub error: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ActivityListItem {
#[serde(rename = "activityArn")]
pub activity_arn: String,
#[serde(rename = "creationDate")]
pub creation_date: f64,
#[serde(rename = "name")]
pub name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ActivityScheduleFailedEventDetails {
#[serde(rename = "cause")]
#[serde(skip_serializing_if = "Option::is_none")]
pub cause: Option<String>,
#[serde(rename = "error")]
#[serde(skip_serializing_if = "Option::is_none")]
pub error: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ActivityScheduledEventDetails {
#[serde(rename = "heartbeatInSeconds")]
#[serde(skip_serializing_if = "Option::is_none")]
pub heartbeat_in_seconds: Option<i64>,
#[serde(rename = "input")]
#[serde(skip_serializing_if = "Option::is_none")]
pub input: Option<String>,
#[serde(rename = "resource")]
pub resource: String,
#[serde(rename = "timeoutInSeconds")]
#[serde(skip_serializing_if = "Option::is_none")]
pub timeout_in_seconds: Option<i64>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ActivityStartedEventDetails {
#[serde(rename = "workerName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub worker_name: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ActivitySucceededEventDetails {
#[serde(rename = "output")]
#[serde(skip_serializing_if = "Option::is_none")]
pub output: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ActivityTimedOutEventDetails {
#[serde(rename = "cause")]
#[serde(skip_serializing_if = "Option::is_none")]
pub cause: Option<String>,
#[serde(rename = "error")]
#[serde(skip_serializing_if = "Option::is_none")]
pub error: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct CreateActivityInput {
#[serde(rename = "name")]
pub name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct CreateActivityOutput {
#[serde(rename = "activityArn")]
pub activity_arn: String,
#[serde(rename = "creationDate")]
pub creation_date: f64,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct CreateStateMachineInput {
#[serde(rename = "definition")]
pub definition: String,
#[serde(rename = "name")]
pub name: String,
#[serde(rename = "roleArn")]
pub role_arn: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct CreateStateMachineOutput {
#[serde(rename = "creationDate")]
pub creation_date: f64,
#[serde(rename = "stateMachineArn")]
pub state_machine_arn: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DeleteActivityInput {
#[serde(rename = "activityArn")]
pub activity_arn: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DeleteActivityOutput {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DeleteStateMachineInput {
#[serde(rename = "stateMachineArn")]
pub state_machine_arn: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DeleteStateMachineOutput {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DescribeActivityInput {
#[serde(rename = "activityArn")]
pub activity_arn: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DescribeActivityOutput {
#[serde(rename = "activityArn")]
pub activity_arn: String,
#[serde(rename = "creationDate")]
pub creation_date: f64,
#[serde(rename = "name")]
pub name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DescribeExecutionInput {
#[serde(rename = "executionArn")]
pub execution_arn: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DescribeExecutionOutput {
#[serde(rename = "executionArn")]
pub execution_arn: String,
#[serde(rename = "input")]
pub input: String,
#[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<String>,
#[serde(rename = "startDate")]
pub start_date: f64,
#[serde(rename = "stateMachineArn")]
pub state_machine_arn: String,
#[serde(rename = "status")]
pub status: String,
#[serde(rename = "stopDate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub stop_date: Option<f64>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DescribeStateMachineForExecutionInput {
#[serde(rename = "executionArn")]
pub execution_arn: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DescribeStateMachineForExecutionOutput {
#[serde(rename = "definition")]
pub definition: String,
#[serde(rename = "name")]
pub name: String,
#[serde(rename = "roleArn")]
pub role_arn: String,
#[serde(rename = "stateMachineArn")]
pub state_machine_arn: String,
#[serde(rename = "updateDate")]
pub update_date: f64,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DescribeStateMachineInput {
#[serde(rename = "stateMachineArn")]
pub state_machine_arn: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DescribeStateMachineOutput {
#[serde(rename = "creationDate")]
pub creation_date: f64,
#[serde(rename = "definition")]
pub definition: String,
#[serde(rename = "name")]
pub name: String,
#[serde(rename = "roleArn")]
pub role_arn: String,
#[serde(rename = "stateMachineArn")]
pub state_machine_arn: String,
#[serde(rename = "status")]
#[serde(skip_serializing_if = "Option::is_none")]
pub status: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ExecutionAbortedEventDetails {
#[serde(rename = "cause")]
#[serde(skip_serializing_if = "Option::is_none")]
pub cause: Option<String>,
#[serde(rename = "error")]
#[serde(skip_serializing_if = "Option::is_none")]
pub error: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ExecutionFailedEventDetails {
#[serde(rename = "cause")]
#[serde(skip_serializing_if = "Option::is_none")]
pub cause: Option<String>,
#[serde(rename = "error")]
#[serde(skip_serializing_if = "Option::is_none")]
pub error: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ExecutionListItem {
#[serde(rename = "executionArn")]
pub execution_arn: String,
#[serde(rename = "name")]
pub name: String,
#[serde(rename = "startDate")]
pub start_date: f64,
#[serde(rename = "stateMachineArn")]
pub state_machine_arn: String,
#[serde(rename = "status")]
pub status: String,
#[serde(rename = "stopDate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub stop_date: Option<f64>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ExecutionStartedEventDetails {
#[serde(rename = "input")]
#[serde(skip_serializing_if = "Option::is_none")]
pub input: Option<String>,
#[serde(rename = "roleArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub role_arn: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ExecutionSucceededEventDetails {
#[serde(rename = "output")]
#[serde(skip_serializing_if = "Option::is_none")]
pub output: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ExecutionTimedOutEventDetails {
#[serde(rename = "cause")]
#[serde(skip_serializing_if = "Option::is_none")]
pub cause: Option<String>,
#[serde(rename = "error")]
#[serde(skip_serializing_if = "Option::is_none")]
pub error: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetActivityTaskInput {
#[serde(rename = "activityArn")]
pub activity_arn: String,
#[serde(rename = "workerName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub worker_name: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct GetActivityTaskOutput {
#[serde(rename = "input")]
#[serde(skip_serializing_if = "Option::is_none")]
pub input: Option<String>,
#[serde(rename = "taskToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub task_token: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetExecutionHistoryInput {
#[serde(rename = "executionArn")]
pub execution_arn: 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 = "reverseOrder")]
#[serde(skip_serializing_if = "Option::is_none")]
pub reverse_order: Option<bool>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct GetExecutionHistoryOutput {
#[serde(rename = "events")]
pub events: Vec<HistoryEvent>,
#[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 HistoryEvent {
#[serde(rename = "activityFailedEventDetails")]
#[serde(skip_serializing_if = "Option::is_none")]
pub activity_failed_event_details: Option<ActivityFailedEventDetails>,
#[serde(rename = "activityScheduleFailedEventDetails")]
#[serde(skip_serializing_if = "Option::is_none")]
pub activity_schedule_failed_event_details: Option<ActivityScheduleFailedEventDetails>,
#[serde(rename = "activityScheduledEventDetails")]
#[serde(skip_serializing_if = "Option::is_none")]
pub activity_scheduled_event_details: Option<ActivityScheduledEventDetails>,
#[serde(rename = "activityStartedEventDetails")]
#[serde(skip_serializing_if = "Option::is_none")]
pub activity_started_event_details: Option<ActivityStartedEventDetails>,
#[serde(rename = "activitySucceededEventDetails")]
#[serde(skip_serializing_if = "Option::is_none")]
pub activity_succeeded_event_details: Option<ActivitySucceededEventDetails>,
#[serde(rename = "activityTimedOutEventDetails")]
#[serde(skip_serializing_if = "Option::is_none")]
pub activity_timed_out_event_details: Option<ActivityTimedOutEventDetails>,
#[serde(rename = "executionAbortedEventDetails")]
#[serde(skip_serializing_if = "Option::is_none")]
pub execution_aborted_event_details: Option<ExecutionAbortedEventDetails>,
#[serde(rename = "executionFailedEventDetails")]
#[serde(skip_serializing_if = "Option::is_none")]
pub execution_failed_event_details: Option<ExecutionFailedEventDetails>,
#[serde(rename = "executionStartedEventDetails")]
#[serde(skip_serializing_if = "Option::is_none")]
pub execution_started_event_details: Option<ExecutionStartedEventDetails>,
#[serde(rename = "executionSucceededEventDetails")]
#[serde(skip_serializing_if = "Option::is_none")]
pub execution_succeeded_event_details: Option<ExecutionSucceededEventDetails>,
#[serde(rename = "executionTimedOutEventDetails")]
#[serde(skip_serializing_if = "Option::is_none")]
pub execution_timed_out_event_details: Option<ExecutionTimedOutEventDetails>,
#[serde(rename = "id")]
pub id: i64,
#[serde(rename = "lambdaFunctionFailedEventDetails")]
#[serde(skip_serializing_if = "Option::is_none")]
pub lambda_function_failed_event_details: Option<LambdaFunctionFailedEventDetails>,
#[serde(rename = "lambdaFunctionScheduleFailedEventDetails")]
#[serde(skip_serializing_if = "Option::is_none")]
pub lambda_function_schedule_failed_event_details:
Option<LambdaFunctionScheduleFailedEventDetails>,
#[serde(rename = "lambdaFunctionScheduledEventDetails")]
#[serde(skip_serializing_if = "Option::is_none")]
pub lambda_function_scheduled_event_details: Option<LambdaFunctionScheduledEventDetails>,
#[serde(rename = "lambdaFunctionStartFailedEventDetails")]
#[serde(skip_serializing_if = "Option::is_none")]
pub lambda_function_start_failed_event_details: Option<LambdaFunctionStartFailedEventDetails>,
#[serde(rename = "lambdaFunctionSucceededEventDetails")]
#[serde(skip_serializing_if = "Option::is_none")]
pub lambda_function_succeeded_event_details: Option<LambdaFunctionSucceededEventDetails>,
#[serde(rename = "lambdaFunctionTimedOutEventDetails")]
#[serde(skip_serializing_if = "Option::is_none")]
pub lambda_function_timed_out_event_details: Option<LambdaFunctionTimedOutEventDetails>,
#[serde(rename = "previousEventId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub previous_event_id: Option<i64>,
#[serde(rename = "stateEnteredEventDetails")]
#[serde(skip_serializing_if = "Option::is_none")]
pub state_entered_event_details: Option<StateEnteredEventDetails>,
#[serde(rename = "stateExitedEventDetails")]
#[serde(skip_serializing_if = "Option::is_none")]
pub state_exited_event_details: Option<StateExitedEventDetails>,
#[serde(rename = "taskFailedEventDetails")]
#[serde(skip_serializing_if = "Option::is_none")]
pub task_failed_event_details: Option<TaskFailedEventDetails>,
#[serde(rename = "taskScheduledEventDetails")]
#[serde(skip_serializing_if = "Option::is_none")]
pub task_scheduled_event_details: Option<TaskScheduledEventDetails>,
#[serde(rename = "taskStartFailedEventDetails")]
#[serde(skip_serializing_if = "Option::is_none")]
pub task_start_failed_event_details: Option<TaskStartFailedEventDetails>,
#[serde(rename = "taskStartedEventDetails")]
#[serde(skip_serializing_if = "Option::is_none")]
pub task_started_event_details: Option<TaskStartedEventDetails>,
#[serde(rename = "taskSubmitFailedEventDetails")]
#[serde(skip_serializing_if = "Option::is_none")]
pub task_submit_failed_event_details: Option<TaskSubmitFailedEventDetails>,
#[serde(rename = "taskSubmittedEventDetails")]
#[serde(skip_serializing_if = "Option::is_none")]
pub task_submitted_event_details: Option<TaskSubmittedEventDetails>,
#[serde(rename = "taskSucceededEventDetails")]
#[serde(skip_serializing_if = "Option::is_none")]
pub task_succeeded_event_details: Option<TaskSucceededEventDetails>,
#[serde(rename = "taskTimedOutEventDetails")]
#[serde(skip_serializing_if = "Option::is_none")]
pub task_timed_out_event_details: Option<TaskTimedOutEventDetails>,
#[serde(rename = "timestamp")]
pub timestamp: f64,
#[serde(rename = "type")]
pub type_: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct LambdaFunctionFailedEventDetails {
#[serde(rename = "cause")]
#[serde(skip_serializing_if = "Option::is_none")]
pub cause: Option<String>,
#[serde(rename = "error")]
#[serde(skip_serializing_if = "Option::is_none")]
pub error: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct LambdaFunctionScheduleFailedEventDetails {
#[serde(rename = "cause")]
#[serde(skip_serializing_if = "Option::is_none")]
pub cause: Option<String>,
#[serde(rename = "error")]
#[serde(skip_serializing_if = "Option::is_none")]
pub error: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct LambdaFunctionScheduledEventDetails {
#[serde(rename = "input")]
#[serde(skip_serializing_if = "Option::is_none")]
pub input: Option<String>,
#[serde(rename = "resource")]
pub resource: String,
#[serde(rename = "timeoutInSeconds")]
#[serde(skip_serializing_if = "Option::is_none")]
pub timeout_in_seconds: Option<i64>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct LambdaFunctionStartFailedEventDetails {
#[serde(rename = "cause")]
#[serde(skip_serializing_if = "Option::is_none")]
pub cause: Option<String>,
#[serde(rename = "error")]
#[serde(skip_serializing_if = "Option::is_none")]
pub error: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct LambdaFunctionSucceededEventDetails {
#[serde(rename = "output")]
#[serde(skip_serializing_if = "Option::is_none")]
pub output: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct LambdaFunctionTimedOutEventDetails {
#[serde(rename = "cause")]
#[serde(skip_serializing_if = "Option::is_none")]
pub cause: Option<String>,
#[serde(rename = "error")]
#[serde(skip_serializing_if = "Option::is_none")]
pub error: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ListActivitiesInput {
#[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 ListActivitiesOutput {
#[serde(rename = "activities")]
pub activities: Vec<ActivityListItem>,
#[serde(rename = "nextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ListExecutionsInput {
#[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 = "stateMachineArn")]
pub state_machine_arn: String,
#[serde(rename = "statusFilter")]
#[serde(skip_serializing_if = "Option::is_none")]
pub status_filter: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ListExecutionsOutput {
#[serde(rename = "executions")]
pub executions: Vec<ExecutionListItem>,
#[serde(rename = "nextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ListStateMachinesInput {
#[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 ListStateMachinesOutput {
#[serde(rename = "nextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "stateMachines")]
pub state_machines: Vec<StateMachineListItem>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ListTagsForResourceInput {
#[serde(rename = "resourceArn")]
pub resource_arn: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ListTagsForResourceOutput {
#[serde(rename = "tags")]
#[serde(skip_serializing_if = "Option::is_none")]
pub tags: Option<Vec<Tag>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct SendTaskFailureInput {
#[serde(rename = "cause")]
#[serde(skip_serializing_if = "Option::is_none")]
pub cause: Option<String>,
#[serde(rename = "error")]
#[serde(skip_serializing_if = "Option::is_none")]
pub error: Option<String>,
#[serde(rename = "taskToken")]
pub task_token: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct SendTaskFailureOutput {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct SendTaskHeartbeatInput {
#[serde(rename = "taskToken")]
pub task_token: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct SendTaskHeartbeatOutput {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct SendTaskSuccessInput {
#[serde(rename = "output")]
pub output: String,
#[serde(rename = "taskToken")]
pub task_token: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct SendTaskSuccessOutput {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct StartExecutionInput {
#[serde(rename = "input")]
#[serde(skip_serializing_if = "Option::is_none")]
pub input: Option<String>,
#[serde(rename = "name")]
#[serde(skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
#[serde(rename = "stateMachineArn")]
pub state_machine_arn: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct StartExecutionOutput {
#[serde(rename = "executionArn")]
pub execution_arn: String,
#[serde(rename = "startDate")]
pub start_date: f64,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct StateEnteredEventDetails {
#[serde(rename = "input")]
#[serde(skip_serializing_if = "Option::is_none")]
pub input: Option<String>,
#[serde(rename = "name")]
pub name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct StateExitedEventDetails {
#[serde(rename = "name")]
pub name: String,
#[serde(rename = "output")]
#[serde(skip_serializing_if = "Option::is_none")]
pub output: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct StateMachineListItem {
#[serde(rename = "creationDate")]
pub creation_date: f64,
#[serde(rename = "name")]
pub name: String,
#[serde(rename = "stateMachineArn")]
pub state_machine_arn: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct StopExecutionInput {
#[serde(rename = "cause")]
#[serde(skip_serializing_if = "Option::is_none")]
pub cause: Option<String>,
#[serde(rename = "error")]
#[serde(skip_serializing_if = "Option::is_none")]
pub error: Option<String>,
#[serde(rename = "executionArn")]
pub execution_arn: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct StopExecutionOutput {
#[serde(rename = "stopDate")]
pub stop_date: f64,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct Tag {
#[serde(rename = "key")]
#[serde(skip_serializing_if = "Option::is_none")]
pub key: Option<String>,
#[serde(rename = "value")]
#[serde(skip_serializing_if = "Option::is_none")]
pub value: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct TagResourceInput {
#[serde(rename = "resourceArn")]
pub resource_arn: String,
#[serde(rename = "tags")]
pub tags: Vec<Tag>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct TagResourceOutput {}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct TaskFailedEventDetails {
#[serde(rename = "cause")]
#[serde(skip_serializing_if = "Option::is_none")]
pub cause: Option<String>,
#[serde(rename = "error")]
#[serde(skip_serializing_if = "Option::is_none")]
pub error: Option<String>,
#[serde(rename = "resource")]
pub resource: String,
#[serde(rename = "resourceType")]
pub resource_type: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct TaskScheduledEventDetails {
#[serde(rename = "parameters")]
pub parameters: String,
#[serde(rename = "region")]
pub region: String,
#[serde(rename = "resource")]
pub resource: String,
#[serde(rename = "resourceType")]
pub resource_type: String,
#[serde(rename = "timeoutInSeconds")]
#[serde(skip_serializing_if = "Option::is_none")]
pub timeout_in_seconds: Option<i64>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct TaskStartFailedEventDetails {
#[serde(rename = "cause")]
#[serde(skip_serializing_if = "Option::is_none")]
pub cause: Option<String>,
#[serde(rename = "error")]
#[serde(skip_serializing_if = "Option::is_none")]
pub error: Option<String>,
#[serde(rename = "resource")]
pub resource: String,
#[serde(rename = "resourceType")]
pub resource_type: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct TaskStartedEventDetails {
#[serde(rename = "resource")]
pub resource: String,
#[serde(rename = "resourceType")]
pub resource_type: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct TaskSubmitFailedEventDetails {
#[serde(rename = "cause")]
#[serde(skip_serializing_if = "Option::is_none")]
pub cause: Option<String>,
#[serde(rename = "error")]
#[serde(skip_serializing_if = "Option::is_none")]
pub error: Option<String>,
#[serde(rename = "resource")]
pub resource: String,
#[serde(rename = "resourceType")]
pub resource_type: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct TaskSubmittedEventDetails {
#[serde(rename = "output")]
#[serde(skip_serializing_if = "Option::is_none")]
pub output: Option<String>,
#[serde(rename = "resource")]
pub resource: String,
#[serde(rename = "resourceType")]
pub resource_type: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct TaskSucceededEventDetails {
#[serde(rename = "output")]
#[serde(skip_serializing_if = "Option::is_none")]
pub output: Option<String>,
#[serde(rename = "resource")]
pub resource: String,
#[serde(rename = "resourceType")]
pub resource_type: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct TaskTimedOutEventDetails {
#[serde(rename = "cause")]
#[serde(skip_serializing_if = "Option::is_none")]
pub cause: Option<String>,
#[serde(rename = "error")]
#[serde(skip_serializing_if = "Option::is_none")]
pub error: Option<String>,
#[serde(rename = "resource")]
pub resource: String,
#[serde(rename = "resourceType")]
pub resource_type: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct UntagResourceInput {
#[serde(rename = "resourceArn")]
pub resource_arn: String,
#[serde(rename = "tagKeys")]
pub tag_keys: Vec<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct UntagResourceOutput {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct UpdateStateMachineInput {
#[serde(rename = "definition")]
#[serde(skip_serializing_if = "Option::is_none")]
pub definition: Option<String>,
#[serde(rename = "roleArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub role_arn: Option<String>,
#[serde(rename = "stateMachineArn")]
pub state_machine_arn: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct UpdateStateMachineOutput {
#[serde(rename = "updateDate")]
pub update_date: f64,
}
#[derive(Debug, PartialEq)]
pub enum CreateActivityError {
ActivityLimitExceeded(String),
InvalidName(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl CreateActivityError {
pub fn from_response(res: BufferedHttpResponse) -> CreateActivityError {
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 {
"ActivityLimitExceeded" => {
return CreateActivityError::ActivityLimitExceeded(String::from(error_message));
}
"InvalidName" => {
return CreateActivityError::InvalidName(String::from(error_message));
}
"ValidationException" => {
return CreateActivityError::Validation(error_message.to_string());
}
_ => {}
}
}
return CreateActivityError::Unknown(res);
}
}
impl From<serde_json::error::Error> for CreateActivityError {
fn from(err: serde_json::error::Error) -> CreateActivityError {
CreateActivityError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for CreateActivityError {
fn from(err: CredentialsError) -> CreateActivityError {
CreateActivityError::Credentials(err)
}
}
impl From<HttpDispatchError> for CreateActivityError {
fn from(err: HttpDispatchError) -> CreateActivityError {
CreateActivityError::HttpDispatch(err)
}
}
impl From<io::Error> for CreateActivityError {
fn from(err: io::Error) -> CreateActivityError {
CreateActivityError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for CreateActivityError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for CreateActivityError {
fn description(&self) -> &str {
match *self {
CreateActivityError::ActivityLimitExceeded(ref cause) => cause,
CreateActivityError::InvalidName(ref cause) => cause,
CreateActivityError::Validation(ref cause) => cause,
CreateActivityError::Credentials(ref err) => err.description(),
CreateActivityError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
CreateActivityError::ParseError(ref cause) => cause,
CreateActivityError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum CreateStateMachineError {
InvalidArn(String),
InvalidDefinition(String),
InvalidName(String),
StateMachineAlreadyExists(String),
StateMachineDeleting(String),
StateMachineLimitExceeded(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl CreateStateMachineError {
pub fn from_response(res: BufferedHttpResponse) -> CreateStateMachineError {
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 {
"InvalidArn" => {
return CreateStateMachineError::InvalidArn(String::from(error_message));
}
"InvalidDefinition" => {
return CreateStateMachineError::InvalidDefinition(String::from(error_message));
}
"InvalidName" => {
return CreateStateMachineError::InvalidName(String::from(error_message));
}
"StateMachineAlreadyExists" => {
return CreateStateMachineError::StateMachineAlreadyExists(String::from(
error_message,
));
}
"StateMachineDeleting" => {
return CreateStateMachineError::StateMachineDeleting(String::from(
error_message,
));
}
"StateMachineLimitExceeded" => {
return CreateStateMachineError::StateMachineLimitExceeded(String::from(
error_message,
));
}
"ValidationException" => {
return CreateStateMachineError::Validation(error_message.to_string());
}
_ => {}
}
}
return CreateStateMachineError::Unknown(res);
}
}
impl From<serde_json::error::Error> for CreateStateMachineError {
fn from(err: serde_json::error::Error) -> CreateStateMachineError {
CreateStateMachineError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for CreateStateMachineError {
fn from(err: CredentialsError) -> CreateStateMachineError {
CreateStateMachineError::Credentials(err)
}
}
impl From<HttpDispatchError> for CreateStateMachineError {
fn from(err: HttpDispatchError) -> CreateStateMachineError {
CreateStateMachineError::HttpDispatch(err)
}
}
impl From<io::Error> for CreateStateMachineError {
fn from(err: io::Error) -> CreateStateMachineError {
CreateStateMachineError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for CreateStateMachineError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for CreateStateMachineError {
fn description(&self) -> &str {
match *self {
CreateStateMachineError::InvalidArn(ref cause) => cause,
CreateStateMachineError::InvalidDefinition(ref cause) => cause,
CreateStateMachineError::InvalidName(ref cause) => cause,
CreateStateMachineError::StateMachineAlreadyExists(ref cause) => cause,
CreateStateMachineError::StateMachineDeleting(ref cause) => cause,
CreateStateMachineError::StateMachineLimitExceeded(ref cause) => cause,
CreateStateMachineError::Validation(ref cause) => cause,
CreateStateMachineError::Credentials(ref err) => err.description(),
CreateStateMachineError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
CreateStateMachineError::ParseError(ref cause) => cause,
CreateStateMachineError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DeleteActivityError {
InvalidArn(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DeleteActivityError {
pub fn from_response(res: BufferedHttpResponse) -> DeleteActivityError {
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 {
"InvalidArn" => return DeleteActivityError::InvalidArn(String::from(error_message)),
"ValidationException" => {
return DeleteActivityError::Validation(error_message.to_string());
}
_ => {}
}
}
return DeleteActivityError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DeleteActivityError {
fn from(err: serde_json::error::Error) -> DeleteActivityError {
DeleteActivityError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DeleteActivityError {
fn from(err: CredentialsError) -> DeleteActivityError {
DeleteActivityError::Credentials(err)
}
}
impl From<HttpDispatchError> for DeleteActivityError {
fn from(err: HttpDispatchError) -> DeleteActivityError {
DeleteActivityError::HttpDispatch(err)
}
}
impl From<io::Error> for DeleteActivityError {
fn from(err: io::Error) -> DeleteActivityError {
DeleteActivityError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DeleteActivityError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DeleteActivityError {
fn description(&self) -> &str {
match *self {
DeleteActivityError::InvalidArn(ref cause) => cause,
DeleteActivityError::Validation(ref cause) => cause,
DeleteActivityError::Credentials(ref err) => err.description(),
DeleteActivityError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
DeleteActivityError::ParseError(ref cause) => cause,
DeleteActivityError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DeleteStateMachineError {
InvalidArn(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DeleteStateMachineError {
pub fn from_response(res: BufferedHttpResponse) -> DeleteStateMachineError {
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 {
"InvalidArn" => {
return DeleteStateMachineError::InvalidArn(String::from(error_message));
}
"ValidationException" => {
return DeleteStateMachineError::Validation(error_message.to_string());
}
_ => {}
}
}
return DeleteStateMachineError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DeleteStateMachineError {
fn from(err: serde_json::error::Error) -> DeleteStateMachineError {
DeleteStateMachineError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DeleteStateMachineError {
fn from(err: CredentialsError) -> DeleteStateMachineError {
DeleteStateMachineError::Credentials(err)
}
}
impl From<HttpDispatchError> for DeleteStateMachineError {
fn from(err: HttpDispatchError) -> DeleteStateMachineError {
DeleteStateMachineError::HttpDispatch(err)
}
}
impl From<io::Error> for DeleteStateMachineError {
fn from(err: io::Error) -> DeleteStateMachineError {
DeleteStateMachineError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DeleteStateMachineError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DeleteStateMachineError {
fn description(&self) -> &str {
match *self {
DeleteStateMachineError::InvalidArn(ref cause) => cause,
DeleteStateMachineError::Validation(ref cause) => cause,
DeleteStateMachineError::Credentials(ref err) => err.description(),
DeleteStateMachineError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
DeleteStateMachineError::ParseError(ref cause) => cause,
DeleteStateMachineError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DescribeActivityError {
ActivityDoesNotExist(String),
InvalidArn(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DescribeActivityError {
pub fn from_response(res: BufferedHttpResponse) -> DescribeActivityError {
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 {
"ActivityDoesNotExist" => {
return DescribeActivityError::ActivityDoesNotExist(String::from(error_message));
}
"InvalidArn" => {
return DescribeActivityError::InvalidArn(String::from(error_message));
}
"ValidationException" => {
return DescribeActivityError::Validation(error_message.to_string());
}
_ => {}
}
}
return DescribeActivityError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DescribeActivityError {
fn from(err: serde_json::error::Error) -> DescribeActivityError {
DescribeActivityError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DescribeActivityError {
fn from(err: CredentialsError) -> DescribeActivityError {
DescribeActivityError::Credentials(err)
}
}
impl From<HttpDispatchError> for DescribeActivityError {
fn from(err: HttpDispatchError) -> DescribeActivityError {
DescribeActivityError::HttpDispatch(err)
}
}
impl From<io::Error> for DescribeActivityError {
fn from(err: io::Error) -> DescribeActivityError {
DescribeActivityError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DescribeActivityError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DescribeActivityError {
fn description(&self) -> &str {
match *self {
DescribeActivityError::ActivityDoesNotExist(ref cause) => cause,
DescribeActivityError::InvalidArn(ref cause) => cause,
DescribeActivityError::Validation(ref cause) => cause,
DescribeActivityError::Credentials(ref err) => err.description(),
DescribeActivityError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
DescribeActivityError::ParseError(ref cause) => cause,
DescribeActivityError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DescribeExecutionError {
ExecutionDoesNotExist(String),
InvalidArn(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DescribeExecutionError {
pub fn from_response(res: BufferedHttpResponse) -> DescribeExecutionError {
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 {
"ExecutionDoesNotExist" => {
return DescribeExecutionError::ExecutionDoesNotExist(String::from(
error_message,
));
}
"InvalidArn" => {
return DescribeExecutionError::InvalidArn(String::from(error_message));
}
"ValidationException" => {
return DescribeExecutionError::Validation(error_message.to_string());
}
_ => {}
}
}
return DescribeExecutionError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DescribeExecutionError {
fn from(err: serde_json::error::Error) -> DescribeExecutionError {
DescribeExecutionError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DescribeExecutionError {
fn from(err: CredentialsError) -> DescribeExecutionError {
DescribeExecutionError::Credentials(err)
}
}
impl From<HttpDispatchError> for DescribeExecutionError {
fn from(err: HttpDispatchError) -> DescribeExecutionError {
DescribeExecutionError::HttpDispatch(err)
}
}
impl From<io::Error> for DescribeExecutionError {
fn from(err: io::Error) -> DescribeExecutionError {
DescribeExecutionError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DescribeExecutionError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DescribeExecutionError {
fn description(&self) -> &str {
match *self {
DescribeExecutionError::ExecutionDoesNotExist(ref cause) => cause,
DescribeExecutionError::InvalidArn(ref cause) => cause,
DescribeExecutionError::Validation(ref cause) => cause,
DescribeExecutionError::Credentials(ref err) => err.description(),
DescribeExecutionError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
DescribeExecutionError::ParseError(ref cause) => cause,
DescribeExecutionError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DescribeStateMachineError {
InvalidArn(String),
StateMachineDoesNotExist(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DescribeStateMachineError {
pub fn from_response(res: BufferedHttpResponse) -> DescribeStateMachineError {
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 {
"InvalidArn" => {
return DescribeStateMachineError::InvalidArn(String::from(error_message));
}
"StateMachineDoesNotExist" => {
return DescribeStateMachineError::StateMachineDoesNotExist(String::from(
error_message,
));
}
"ValidationException" => {
return DescribeStateMachineError::Validation(error_message.to_string());
}
_ => {}
}
}
return DescribeStateMachineError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DescribeStateMachineError {
fn from(err: serde_json::error::Error) -> DescribeStateMachineError {
DescribeStateMachineError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DescribeStateMachineError {
fn from(err: CredentialsError) -> DescribeStateMachineError {
DescribeStateMachineError::Credentials(err)
}
}
impl From<HttpDispatchError> for DescribeStateMachineError {
fn from(err: HttpDispatchError) -> DescribeStateMachineError {
DescribeStateMachineError::HttpDispatch(err)
}
}
impl From<io::Error> for DescribeStateMachineError {
fn from(err: io::Error) -> DescribeStateMachineError {
DescribeStateMachineError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DescribeStateMachineError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DescribeStateMachineError {
fn description(&self) -> &str {
match *self {
DescribeStateMachineError::InvalidArn(ref cause) => cause,
DescribeStateMachineError::StateMachineDoesNotExist(ref cause) => cause,
DescribeStateMachineError::Validation(ref cause) => cause,
DescribeStateMachineError::Credentials(ref err) => err.description(),
DescribeStateMachineError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
DescribeStateMachineError::ParseError(ref cause) => cause,
DescribeStateMachineError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DescribeStateMachineForExecutionError {
ExecutionDoesNotExist(String),
InvalidArn(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DescribeStateMachineForExecutionError {
pub fn from_response(res: BufferedHttpResponse) -> DescribeStateMachineForExecutionError {
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 {
"ExecutionDoesNotExist" => {
return DescribeStateMachineForExecutionError::ExecutionDoesNotExist(
String::from(error_message),
);
}
"InvalidArn" => {
return DescribeStateMachineForExecutionError::InvalidArn(String::from(
error_message,
));
}
"ValidationException" => {
return DescribeStateMachineForExecutionError::Validation(
error_message.to_string(),
);
}
_ => {}
}
}
return DescribeStateMachineForExecutionError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DescribeStateMachineForExecutionError {
fn from(err: serde_json::error::Error) -> DescribeStateMachineForExecutionError {
DescribeStateMachineForExecutionError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DescribeStateMachineForExecutionError {
fn from(err: CredentialsError) -> DescribeStateMachineForExecutionError {
DescribeStateMachineForExecutionError::Credentials(err)
}
}
impl From<HttpDispatchError> for DescribeStateMachineForExecutionError {
fn from(err: HttpDispatchError) -> DescribeStateMachineForExecutionError {
DescribeStateMachineForExecutionError::HttpDispatch(err)
}
}
impl From<io::Error> for DescribeStateMachineForExecutionError {
fn from(err: io::Error) -> DescribeStateMachineForExecutionError {
DescribeStateMachineForExecutionError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DescribeStateMachineForExecutionError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DescribeStateMachineForExecutionError {
fn description(&self) -> &str {
match *self {
DescribeStateMachineForExecutionError::ExecutionDoesNotExist(ref cause) => cause,
DescribeStateMachineForExecutionError::InvalidArn(ref cause) => cause,
DescribeStateMachineForExecutionError::Validation(ref cause) => cause,
DescribeStateMachineForExecutionError::Credentials(ref err) => err.description(),
DescribeStateMachineForExecutionError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
DescribeStateMachineForExecutionError::ParseError(ref cause) => cause,
DescribeStateMachineForExecutionError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetActivityTaskError {
ActivityDoesNotExist(String),
ActivityWorkerLimitExceeded(String),
InvalidArn(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetActivityTaskError {
pub fn from_response(res: BufferedHttpResponse) -> GetActivityTaskError {
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 {
"ActivityDoesNotExist" => {
return GetActivityTaskError::ActivityDoesNotExist(String::from(error_message));
}
"ActivityWorkerLimitExceeded" => {
return GetActivityTaskError::ActivityWorkerLimitExceeded(String::from(
error_message,
));
}
"InvalidArn" => {
return GetActivityTaskError::InvalidArn(String::from(error_message));
}
"ValidationException" => {
return GetActivityTaskError::Validation(error_message.to_string());
}
_ => {}
}
}
return GetActivityTaskError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetActivityTaskError {
fn from(err: serde_json::error::Error) -> GetActivityTaskError {
GetActivityTaskError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetActivityTaskError {
fn from(err: CredentialsError) -> GetActivityTaskError {
GetActivityTaskError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetActivityTaskError {
fn from(err: HttpDispatchError) -> GetActivityTaskError {
GetActivityTaskError::HttpDispatch(err)
}
}
impl From<io::Error> for GetActivityTaskError {
fn from(err: io::Error) -> GetActivityTaskError {
GetActivityTaskError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetActivityTaskError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetActivityTaskError {
fn description(&self) -> &str {
match *self {
GetActivityTaskError::ActivityDoesNotExist(ref cause) => cause,
GetActivityTaskError::ActivityWorkerLimitExceeded(ref cause) => cause,
GetActivityTaskError::InvalidArn(ref cause) => cause,
GetActivityTaskError::Validation(ref cause) => cause,
GetActivityTaskError::Credentials(ref err) => err.description(),
GetActivityTaskError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
GetActivityTaskError::ParseError(ref cause) => cause,
GetActivityTaskError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetExecutionHistoryError {
ExecutionDoesNotExist(String),
InvalidArn(String),
InvalidToken(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetExecutionHistoryError {
pub fn from_response(res: BufferedHttpResponse) -> GetExecutionHistoryError {
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 {
"ExecutionDoesNotExist" => {
return GetExecutionHistoryError::ExecutionDoesNotExist(String::from(
error_message,
));
}
"InvalidArn" => {
return GetExecutionHistoryError::InvalidArn(String::from(error_message));
}
"InvalidToken" => {
return GetExecutionHistoryError::InvalidToken(String::from(error_message));
}
"ValidationException" => {
return GetExecutionHistoryError::Validation(error_message.to_string());
}
_ => {}
}
}
return GetExecutionHistoryError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetExecutionHistoryError {
fn from(err: serde_json::error::Error) -> GetExecutionHistoryError {
GetExecutionHistoryError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetExecutionHistoryError {
fn from(err: CredentialsError) -> GetExecutionHistoryError {
GetExecutionHistoryError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetExecutionHistoryError {
fn from(err: HttpDispatchError) -> GetExecutionHistoryError {
GetExecutionHistoryError::HttpDispatch(err)
}
}
impl From<io::Error> for GetExecutionHistoryError {
fn from(err: io::Error) -> GetExecutionHistoryError {
GetExecutionHistoryError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetExecutionHistoryError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetExecutionHistoryError {
fn description(&self) -> &str {
match *self {
GetExecutionHistoryError::ExecutionDoesNotExist(ref cause) => cause,
GetExecutionHistoryError::InvalidArn(ref cause) => cause,
GetExecutionHistoryError::InvalidToken(ref cause) => cause,
GetExecutionHistoryError::Validation(ref cause) => cause,
GetExecutionHistoryError::Credentials(ref err) => err.description(),
GetExecutionHistoryError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
GetExecutionHistoryError::ParseError(ref cause) => cause,
GetExecutionHistoryError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListActivitiesError {
InvalidToken(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ListActivitiesError {
pub fn from_response(res: BufferedHttpResponse) -> ListActivitiesError {
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 {
"InvalidToken" => {
return ListActivitiesError::InvalidToken(String::from(error_message));
}
"ValidationException" => {
return ListActivitiesError::Validation(error_message.to_string());
}
_ => {}
}
}
return ListActivitiesError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ListActivitiesError {
fn from(err: serde_json::error::Error) -> ListActivitiesError {
ListActivitiesError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ListActivitiesError {
fn from(err: CredentialsError) -> ListActivitiesError {
ListActivitiesError::Credentials(err)
}
}
impl From<HttpDispatchError> for ListActivitiesError {
fn from(err: HttpDispatchError) -> ListActivitiesError {
ListActivitiesError::HttpDispatch(err)
}
}
impl From<io::Error> for ListActivitiesError {
fn from(err: io::Error) -> ListActivitiesError {
ListActivitiesError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ListActivitiesError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListActivitiesError {
fn description(&self) -> &str {
match *self {
ListActivitiesError::InvalidToken(ref cause) => cause,
ListActivitiesError::Validation(ref cause) => cause,
ListActivitiesError::Credentials(ref err) => err.description(),
ListActivitiesError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
ListActivitiesError::ParseError(ref cause) => cause,
ListActivitiesError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListExecutionsError {
InvalidArn(String),
InvalidToken(String),
StateMachineDoesNotExist(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ListExecutionsError {
pub fn from_response(res: BufferedHttpResponse) -> ListExecutionsError {
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 {
"InvalidArn" => return ListExecutionsError::InvalidArn(String::from(error_message)),
"InvalidToken" => {
return ListExecutionsError::InvalidToken(String::from(error_message));
}
"StateMachineDoesNotExist" => {
return ListExecutionsError::StateMachineDoesNotExist(String::from(
error_message,
));
}
"ValidationException" => {
return ListExecutionsError::Validation(error_message.to_string());
}
_ => {}
}
}
return ListExecutionsError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ListExecutionsError {
fn from(err: serde_json::error::Error) -> ListExecutionsError {
ListExecutionsError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ListExecutionsError {
fn from(err: CredentialsError) -> ListExecutionsError {
ListExecutionsError::Credentials(err)
}
}
impl From<HttpDispatchError> for ListExecutionsError {
fn from(err: HttpDispatchError) -> ListExecutionsError {
ListExecutionsError::HttpDispatch(err)
}
}
impl From<io::Error> for ListExecutionsError {
fn from(err: io::Error) -> ListExecutionsError {
ListExecutionsError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ListExecutionsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListExecutionsError {
fn description(&self) -> &str {
match *self {
ListExecutionsError::InvalidArn(ref cause) => cause,
ListExecutionsError::InvalidToken(ref cause) => cause,
ListExecutionsError::StateMachineDoesNotExist(ref cause) => cause,
ListExecutionsError::Validation(ref cause) => cause,
ListExecutionsError::Credentials(ref err) => err.description(),
ListExecutionsError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
ListExecutionsError::ParseError(ref cause) => cause,
ListExecutionsError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListStateMachinesError {
InvalidToken(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ListStateMachinesError {
pub fn from_response(res: BufferedHttpResponse) -> ListStateMachinesError {
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 {
"InvalidToken" => {
return ListStateMachinesError::InvalidToken(String::from(error_message));
}
"ValidationException" => {
return ListStateMachinesError::Validation(error_message.to_string());
}
_ => {}
}
}
return ListStateMachinesError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ListStateMachinesError {
fn from(err: serde_json::error::Error) -> ListStateMachinesError {
ListStateMachinesError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ListStateMachinesError {
fn from(err: CredentialsError) -> ListStateMachinesError {
ListStateMachinesError::Credentials(err)
}
}
impl From<HttpDispatchError> for ListStateMachinesError {
fn from(err: HttpDispatchError) -> ListStateMachinesError {
ListStateMachinesError::HttpDispatch(err)
}
}
impl From<io::Error> for ListStateMachinesError {
fn from(err: io::Error) -> ListStateMachinesError {
ListStateMachinesError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ListStateMachinesError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListStateMachinesError {
fn description(&self) -> &str {
match *self {
ListStateMachinesError::InvalidToken(ref cause) => cause,
ListStateMachinesError::Validation(ref cause) => cause,
ListStateMachinesError::Credentials(ref err) => err.description(),
ListStateMachinesError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
ListStateMachinesError::ParseError(ref cause) => cause,
ListStateMachinesError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListTagsForResourceError {
InvalidArn(String),
ResourceNotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ListTagsForResourceError {
pub fn from_response(res: BufferedHttpResponse) -> ListTagsForResourceError {
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 {
"InvalidArn" => {
return ListTagsForResourceError::InvalidArn(String::from(error_message));
}
"ResourceNotFound" => {
return ListTagsForResourceError::ResourceNotFound(String::from(error_message));
}
"ValidationException" => {
return ListTagsForResourceError::Validation(error_message.to_string());
}
_ => {}
}
}
return ListTagsForResourceError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ListTagsForResourceError {
fn from(err: serde_json::error::Error) -> ListTagsForResourceError {
ListTagsForResourceError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ListTagsForResourceError {
fn from(err: CredentialsError) -> ListTagsForResourceError {
ListTagsForResourceError::Credentials(err)
}
}
impl From<HttpDispatchError> for ListTagsForResourceError {
fn from(err: HttpDispatchError) -> ListTagsForResourceError {
ListTagsForResourceError::HttpDispatch(err)
}
}
impl From<io::Error> for ListTagsForResourceError {
fn from(err: io::Error) -> ListTagsForResourceError {
ListTagsForResourceError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ListTagsForResourceError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListTagsForResourceError {
fn description(&self) -> &str {
match *self {
ListTagsForResourceError::InvalidArn(ref cause) => cause,
ListTagsForResourceError::ResourceNotFound(ref cause) => cause,
ListTagsForResourceError::Validation(ref cause) => cause,
ListTagsForResourceError::Credentials(ref err) => err.description(),
ListTagsForResourceError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
ListTagsForResourceError::ParseError(ref cause) => cause,
ListTagsForResourceError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum SendTaskFailureError {
InvalidToken(String),
TaskDoesNotExist(String),
TaskTimedOut(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl SendTaskFailureError {
pub fn from_response(res: BufferedHttpResponse) -> SendTaskFailureError {
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 {
"InvalidToken" => {
return SendTaskFailureError::InvalidToken(String::from(error_message));
}
"TaskDoesNotExist" => {
return SendTaskFailureError::TaskDoesNotExist(String::from(error_message));
}
"TaskTimedOut" => {
return SendTaskFailureError::TaskTimedOut(String::from(error_message));
}
"ValidationException" => {
return SendTaskFailureError::Validation(error_message.to_string());
}
_ => {}
}
}
return SendTaskFailureError::Unknown(res);
}
}
impl From<serde_json::error::Error> for SendTaskFailureError {
fn from(err: serde_json::error::Error) -> SendTaskFailureError {
SendTaskFailureError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for SendTaskFailureError {
fn from(err: CredentialsError) -> SendTaskFailureError {
SendTaskFailureError::Credentials(err)
}
}
impl From<HttpDispatchError> for SendTaskFailureError {
fn from(err: HttpDispatchError) -> SendTaskFailureError {
SendTaskFailureError::HttpDispatch(err)
}
}
impl From<io::Error> for SendTaskFailureError {
fn from(err: io::Error) -> SendTaskFailureError {
SendTaskFailureError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for SendTaskFailureError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for SendTaskFailureError {
fn description(&self) -> &str {
match *self {
SendTaskFailureError::InvalidToken(ref cause) => cause,
SendTaskFailureError::TaskDoesNotExist(ref cause) => cause,
SendTaskFailureError::TaskTimedOut(ref cause) => cause,
SendTaskFailureError::Validation(ref cause) => cause,
SendTaskFailureError::Credentials(ref err) => err.description(),
SendTaskFailureError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
SendTaskFailureError::ParseError(ref cause) => cause,
SendTaskFailureError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum SendTaskHeartbeatError {
InvalidToken(String),
TaskDoesNotExist(String),
TaskTimedOut(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl SendTaskHeartbeatError {
pub fn from_response(res: BufferedHttpResponse) -> SendTaskHeartbeatError {
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 {
"InvalidToken" => {
return SendTaskHeartbeatError::InvalidToken(String::from(error_message));
}
"TaskDoesNotExist" => {
return SendTaskHeartbeatError::TaskDoesNotExist(String::from(error_message));
}
"TaskTimedOut" => {
return SendTaskHeartbeatError::TaskTimedOut(String::from(error_message));
}
"ValidationException" => {
return SendTaskHeartbeatError::Validation(error_message.to_string());
}
_ => {}
}
}
return SendTaskHeartbeatError::Unknown(res);
}
}
impl From<serde_json::error::Error> for SendTaskHeartbeatError {
fn from(err: serde_json::error::Error) -> SendTaskHeartbeatError {
SendTaskHeartbeatError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for SendTaskHeartbeatError {
fn from(err: CredentialsError) -> SendTaskHeartbeatError {
SendTaskHeartbeatError::Credentials(err)
}
}
impl From<HttpDispatchError> for SendTaskHeartbeatError {
fn from(err: HttpDispatchError) -> SendTaskHeartbeatError {
SendTaskHeartbeatError::HttpDispatch(err)
}
}
impl From<io::Error> for SendTaskHeartbeatError {
fn from(err: io::Error) -> SendTaskHeartbeatError {
SendTaskHeartbeatError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for SendTaskHeartbeatError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for SendTaskHeartbeatError {
fn description(&self) -> &str {
match *self {
SendTaskHeartbeatError::InvalidToken(ref cause) => cause,
SendTaskHeartbeatError::TaskDoesNotExist(ref cause) => cause,
SendTaskHeartbeatError::TaskTimedOut(ref cause) => cause,
SendTaskHeartbeatError::Validation(ref cause) => cause,
SendTaskHeartbeatError::Credentials(ref err) => err.description(),
SendTaskHeartbeatError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
SendTaskHeartbeatError::ParseError(ref cause) => cause,
SendTaskHeartbeatError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum SendTaskSuccessError {
InvalidOutput(String),
InvalidToken(String),
TaskDoesNotExist(String),
TaskTimedOut(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl SendTaskSuccessError {
pub fn from_response(res: BufferedHttpResponse) -> SendTaskSuccessError {
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 {
"InvalidOutput" => {
return SendTaskSuccessError::InvalidOutput(String::from(error_message));
}
"InvalidToken" => {
return SendTaskSuccessError::InvalidToken(String::from(error_message));
}
"TaskDoesNotExist" => {
return SendTaskSuccessError::TaskDoesNotExist(String::from(error_message));
}
"TaskTimedOut" => {
return SendTaskSuccessError::TaskTimedOut(String::from(error_message));
}
"ValidationException" => {
return SendTaskSuccessError::Validation(error_message.to_string());
}
_ => {}
}
}
return SendTaskSuccessError::Unknown(res);
}
}
impl From<serde_json::error::Error> for SendTaskSuccessError {
fn from(err: serde_json::error::Error) -> SendTaskSuccessError {
SendTaskSuccessError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for SendTaskSuccessError {
fn from(err: CredentialsError) -> SendTaskSuccessError {
SendTaskSuccessError::Credentials(err)
}
}
impl From<HttpDispatchError> for SendTaskSuccessError {
fn from(err: HttpDispatchError) -> SendTaskSuccessError {
SendTaskSuccessError::HttpDispatch(err)
}
}
impl From<io::Error> for SendTaskSuccessError {
fn from(err: io::Error) -> SendTaskSuccessError {
SendTaskSuccessError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for SendTaskSuccessError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for SendTaskSuccessError {
fn description(&self) -> &str {
match *self {
SendTaskSuccessError::InvalidOutput(ref cause) => cause,
SendTaskSuccessError::InvalidToken(ref cause) => cause,
SendTaskSuccessError::TaskDoesNotExist(ref cause) => cause,
SendTaskSuccessError::TaskTimedOut(ref cause) => cause,
SendTaskSuccessError::Validation(ref cause) => cause,
SendTaskSuccessError::Credentials(ref err) => err.description(),
SendTaskSuccessError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
SendTaskSuccessError::ParseError(ref cause) => cause,
SendTaskSuccessError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum StartExecutionError {
ExecutionAlreadyExists(String),
ExecutionLimitExceeded(String),
InvalidArn(String),
InvalidExecutionInput(String),
InvalidName(String),
StateMachineDeleting(String),
StateMachineDoesNotExist(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl StartExecutionError {
pub fn from_response(res: BufferedHttpResponse) -> StartExecutionError {
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 {
"ExecutionAlreadyExists" => {
return StartExecutionError::ExecutionAlreadyExists(String::from(error_message));
}
"ExecutionLimitExceeded" => {
return StartExecutionError::ExecutionLimitExceeded(String::from(error_message));
}
"InvalidArn" => return StartExecutionError::InvalidArn(String::from(error_message)),
"InvalidExecutionInput" => {
return StartExecutionError::InvalidExecutionInput(String::from(error_message));
}
"InvalidName" => {
return StartExecutionError::InvalidName(String::from(error_message));
}
"StateMachineDeleting" => {
return StartExecutionError::StateMachineDeleting(String::from(error_message));
}
"StateMachineDoesNotExist" => {
return StartExecutionError::StateMachineDoesNotExist(String::from(
error_message,
));
}
"ValidationException" => {
return StartExecutionError::Validation(error_message.to_string());
}
_ => {}
}
}
return StartExecutionError::Unknown(res);
}
}
impl From<serde_json::error::Error> for StartExecutionError {
fn from(err: serde_json::error::Error) -> StartExecutionError {
StartExecutionError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for StartExecutionError {
fn from(err: CredentialsError) -> StartExecutionError {
StartExecutionError::Credentials(err)
}
}
impl From<HttpDispatchError> for StartExecutionError {
fn from(err: HttpDispatchError) -> StartExecutionError {
StartExecutionError::HttpDispatch(err)
}
}
impl From<io::Error> for StartExecutionError {
fn from(err: io::Error) -> StartExecutionError {
StartExecutionError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for StartExecutionError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for StartExecutionError {
fn description(&self) -> &str {
match *self {
StartExecutionError::ExecutionAlreadyExists(ref cause) => cause,
StartExecutionError::ExecutionLimitExceeded(ref cause) => cause,
StartExecutionError::InvalidArn(ref cause) => cause,
StartExecutionError::InvalidExecutionInput(ref cause) => cause,
StartExecutionError::InvalidName(ref cause) => cause,
StartExecutionError::StateMachineDeleting(ref cause) => cause,
StartExecutionError::StateMachineDoesNotExist(ref cause) => cause,
StartExecutionError::Validation(ref cause) => cause,
StartExecutionError::Credentials(ref err) => err.description(),
StartExecutionError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
StartExecutionError::ParseError(ref cause) => cause,
StartExecutionError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum StopExecutionError {
ExecutionDoesNotExist(String),
InvalidArn(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl StopExecutionError {
pub fn from_response(res: BufferedHttpResponse) -> StopExecutionError {
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 {
"ExecutionDoesNotExist" => {
return StopExecutionError::ExecutionDoesNotExist(String::from(error_message));
}
"InvalidArn" => return StopExecutionError::InvalidArn(String::from(error_message)),
"ValidationException" => {
return StopExecutionError::Validation(error_message.to_string());
}
_ => {}
}
}
return StopExecutionError::Unknown(res);
}
}
impl From<serde_json::error::Error> for StopExecutionError {
fn from(err: serde_json::error::Error) -> StopExecutionError {
StopExecutionError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for StopExecutionError {
fn from(err: CredentialsError) -> StopExecutionError {
StopExecutionError::Credentials(err)
}
}
impl From<HttpDispatchError> for StopExecutionError {
fn from(err: HttpDispatchError) -> StopExecutionError {
StopExecutionError::HttpDispatch(err)
}
}
impl From<io::Error> for StopExecutionError {
fn from(err: io::Error) -> StopExecutionError {
StopExecutionError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for StopExecutionError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for StopExecutionError {
fn description(&self) -> &str {
match *self {
StopExecutionError::ExecutionDoesNotExist(ref cause) => cause,
StopExecutionError::InvalidArn(ref cause) => cause,
StopExecutionError::Validation(ref cause) => cause,
StopExecutionError::Credentials(ref err) => err.description(),
StopExecutionError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
StopExecutionError::ParseError(ref cause) => cause,
StopExecutionError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum TagResourceError {
InvalidArn(String),
ResourceNotFound(String),
TooManyTags(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl TagResourceError {
pub fn from_response(res: BufferedHttpResponse) -> TagResourceError {
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 {
"InvalidArn" => return TagResourceError::InvalidArn(String::from(error_message)),
"ResourceNotFound" => {
return TagResourceError::ResourceNotFound(String::from(error_message));
}
"TooManyTags" => return TagResourceError::TooManyTags(String::from(error_message)),
"ValidationException" => {
return TagResourceError::Validation(error_message.to_string());
}
_ => {}
}
}
return TagResourceError::Unknown(res);
}
}
impl From<serde_json::error::Error> for TagResourceError {
fn from(err: serde_json::error::Error) -> TagResourceError {
TagResourceError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for TagResourceError {
fn from(err: CredentialsError) -> TagResourceError {
TagResourceError::Credentials(err)
}
}
impl From<HttpDispatchError> for TagResourceError {
fn from(err: HttpDispatchError) -> TagResourceError {
TagResourceError::HttpDispatch(err)
}
}
impl From<io::Error> for TagResourceError {
fn from(err: io::Error) -> TagResourceError {
TagResourceError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for TagResourceError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for TagResourceError {
fn description(&self) -> &str {
match *self {
TagResourceError::InvalidArn(ref cause) => cause,
TagResourceError::ResourceNotFound(ref cause) => cause,
TagResourceError::TooManyTags(ref cause) => cause,
TagResourceError::Validation(ref cause) => cause,
TagResourceError::Credentials(ref err) => err.description(),
TagResourceError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
TagResourceError::ParseError(ref cause) => cause,
TagResourceError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum UntagResourceError {
InvalidArn(String),
ResourceNotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl UntagResourceError {
pub fn from_response(res: BufferedHttpResponse) -> UntagResourceError {
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 {
"InvalidArn" => return UntagResourceError::InvalidArn(String::from(error_message)),
"ResourceNotFound" => {
return UntagResourceError::ResourceNotFound(String::from(error_message));
}
"ValidationException" => {
return UntagResourceError::Validation(error_message.to_string());
}
_ => {}
}
}
return UntagResourceError::Unknown(res);
}
}
impl From<serde_json::error::Error> for UntagResourceError {
fn from(err: serde_json::error::Error) -> UntagResourceError {
UntagResourceError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for UntagResourceError {
fn from(err: CredentialsError) -> UntagResourceError {
UntagResourceError::Credentials(err)
}
}
impl From<HttpDispatchError> for UntagResourceError {
fn from(err: HttpDispatchError) -> UntagResourceError {
UntagResourceError::HttpDispatch(err)
}
}
impl From<io::Error> for UntagResourceError {
fn from(err: io::Error) -> UntagResourceError {
UntagResourceError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for UntagResourceError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for UntagResourceError {
fn description(&self) -> &str {
match *self {
UntagResourceError::InvalidArn(ref cause) => cause,
UntagResourceError::ResourceNotFound(ref cause) => cause,
UntagResourceError::Validation(ref cause) => cause,
UntagResourceError::Credentials(ref err) => err.description(),
UntagResourceError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
UntagResourceError::ParseError(ref cause) => cause,
UntagResourceError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum UpdateStateMachineError {
InvalidArn(String),
InvalidDefinition(String),
MissingRequiredParameter(String),
StateMachineDeleting(String),
StateMachineDoesNotExist(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl UpdateStateMachineError {
pub fn from_response(res: BufferedHttpResponse) -> UpdateStateMachineError {
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 {
"InvalidArn" => {
return UpdateStateMachineError::InvalidArn(String::from(error_message));
}
"InvalidDefinition" => {
return UpdateStateMachineError::InvalidDefinition(String::from(error_message));
}
"MissingRequiredParameter" => {
return UpdateStateMachineError::MissingRequiredParameter(String::from(
error_message,
));
}
"StateMachineDeleting" => {
return UpdateStateMachineError::StateMachineDeleting(String::from(
error_message,
));
}
"StateMachineDoesNotExist" => {
return UpdateStateMachineError::StateMachineDoesNotExist(String::from(
error_message,
));
}
"ValidationException" => {
return UpdateStateMachineError::Validation(error_message.to_string());
}
_ => {}
}
}
return UpdateStateMachineError::Unknown(res);
}
}
impl From<serde_json::error::Error> for UpdateStateMachineError {
fn from(err: serde_json::error::Error) -> UpdateStateMachineError {
UpdateStateMachineError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for UpdateStateMachineError {
fn from(err: CredentialsError) -> UpdateStateMachineError {
UpdateStateMachineError::Credentials(err)
}
}
impl From<HttpDispatchError> for UpdateStateMachineError {
fn from(err: HttpDispatchError) -> UpdateStateMachineError {
UpdateStateMachineError::HttpDispatch(err)
}
}
impl From<io::Error> for UpdateStateMachineError {
fn from(err: io::Error) -> UpdateStateMachineError {
UpdateStateMachineError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for UpdateStateMachineError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for UpdateStateMachineError {
fn description(&self) -> &str {
match *self {
UpdateStateMachineError::InvalidArn(ref cause) => cause,
UpdateStateMachineError::InvalidDefinition(ref cause) => cause,
UpdateStateMachineError::MissingRequiredParameter(ref cause) => cause,
UpdateStateMachineError::StateMachineDeleting(ref cause) => cause,
UpdateStateMachineError::StateMachineDoesNotExist(ref cause) => cause,
UpdateStateMachineError::Validation(ref cause) => cause,
UpdateStateMachineError::Credentials(ref err) => err.description(),
UpdateStateMachineError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
UpdateStateMachineError::ParseError(ref cause) => cause,
UpdateStateMachineError::Unknown(_) => "unknown error",
}
}
}
pub trait StepFunctions {
fn create_activity(
&self,
input: CreateActivityInput,
) -> RusotoFuture<CreateActivityOutput, CreateActivityError>;
fn create_state_machine(
&self,
input: CreateStateMachineInput,
) -> RusotoFuture<CreateStateMachineOutput, CreateStateMachineError>;
fn delete_activity(
&self,
input: DeleteActivityInput,
) -> RusotoFuture<DeleteActivityOutput, DeleteActivityError>;
fn delete_state_machine(
&self,
input: DeleteStateMachineInput,
) -> RusotoFuture<DeleteStateMachineOutput, DeleteStateMachineError>;
fn describe_activity(
&self,
input: DescribeActivityInput,
) -> RusotoFuture<DescribeActivityOutput, DescribeActivityError>;
fn describe_execution(
&self,
input: DescribeExecutionInput,
) -> RusotoFuture<DescribeExecutionOutput, DescribeExecutionError>;
fn describe_state_machine(
&self,
input: DescribeStateMachineInput,
) -> RusotoFuture<DescribeStateMachineOutput, DescribeStateMachineError>;
fn describe_state_machine_for_execution(
&self,
input: DescribeStateMachineForExecutionInput,
) -> RusotoFuture<DescribeStateMachineForExecutionOutput, DescribeStateMachineForExecutionError>;
fn get_activity_task(
&self,
input: GetActivityTaskInput,
) -> RusotoFuture<GetActivityTaskOutput, GetActivityTaskError>;
fn get_execution_history(
&self,
input: GetExecutionHistoryInput,
) -> RusotoFuture<GetExecutionHistoryOutput, GetExecutionHistoryError>;
fn list_activities(
&self,
input: ListActivitiesInput,
) -> RusotoFuture<ListActivitiesOutput, ListActivitiesError>;
fn list_executions(
&self,
input: ListExecutionsInput,
) -> RusotoFuture<ListExecutionsOutput, ListExecutionsError>;
fn list_state_machines(
&self,
input: ListStateMachinesInput,
) -> RusotoFuture<ListStateMachinesOutput, ListStateMachinesError>;
fn list_tags_for_resource(
&self,
input: ListTagsForResourceInput,
) -> RusotoFuture<ListTagsForResourceOutput, ListTagsForResourceError>;
fn send_task_failure(
&self,
input: SendTaskFailureInput,
) -> RusotoFuture<SendTaskFailureOutput, SendTaskFailureError>;
fn send_task_heartbeat(
&self,
input: SendTaskHeartbeatInput,
) -> RusotoFuture<SendTaskHeartbeatOutput, SendTaskHeartbeatError>;
fn send_task_success(
&self,
input: SendTaskSuccessInput,
) -> RusotoFuture<SendTaskSuccessOutput, SendTaskSuccessError>;
fn start_execution(
&self,
input: StartExecutionInput,
) -> RusotoFuture<StartExecutionOutput, StartExecutionError>;
fn stop_execution(
&self,
input: StopExecutionInput,
) -> RusotoFuture<StopExecutionOutput, StopExecutionError>;
fn tag_resource(
&self,
input: TagResourceInput,
) -> RusotoFuture<TagResourceOutput, TagResourceError>;
fn untag_resource(
&self,
input: UntagResourceInput,
) -> RusotoFuture<UntagResourceOutput, UntagResourceError>;
fn update_state_machine(
&self,
input: UpdateStateMachineInput,
) -> RusotoFuture<UpdateStateMachineOutput, UpdateStateMachineError>;
}
#[derive(Clone)]
pub struct StepFunctionsClient {
client: Client,
region: region::Region,
}
impl StepFunctionsClient {
pub fn new(region: region::Region) -> StepFunctionsClient {
StepFunctionsClient {
client: Client::shared(),
region: region,
}
}
pub fn new_with<P, D>(
request_dispatcher: D,
credentials_provider: P,
region: region::Region,
) -> StepFunctionsClient
where
P: ProvideAwsCredentials + Send + Sync + 'static,
P::Future: Send,
D: DispatchSignedRequest + Send + Sync + 'static,
D::Future: Send,
{
StepFunctionsClient {
client: Client::new_with(credentials_provider, request_dispatcher),
region: region,
}
}
}
impl StepFunctions for StepFunctionsClient {
fn create_activity(
&self,
input: CreateActivityInput,
) -> RusotoFuture<CreateActivityOutput, CreateActivityError> {
let mut request = SignedRequest::new("POST", "states", &self.region, "/");
request.set_content_type("application/x-amz-json-1.0".to_owned());
request.add_header("x-amz-target", "AWSStepFunctions.CreateActivity");
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::<CreateActivityOutput>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(CreateActivityError::from_response(response))),
)
}
})
}
fn create_state_machine(
&self,
input: CreateStateMachineInput,
) -> RusotoFuture<CreateStateMachineOutput, CreateStateMachineError> {
let mut request = SignedRequest::new("POST", "states", &self.region, "/");
request.set_content_type("application/x-amz-json-1.0".to_owned());
request.add_header("x-amz-target", "AWSStepFunctions.CreateStateMachine");
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::<CreateStateMachineOutput>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(CreateStateMachineError::from_response(response))),
)
}
})
}
fn delete_activity(
&self,
input: DeleteActivityInput,
) -> RusotoFuture<DeleteActivityOutput, DeleteActivityError> {
let mut request = SignedRequest::new("POST", "states", &self.region, "/");
request.set_content_type("application/x-amz-json-1.0".to_owned());
request.add_header("x-amz-target", "AWSStepFunctions.DeleteActivity");
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::<DeleteActivityOutput>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(DeleteActivityError::from_response(response))),
)
}
})
}
fn delete_state_machine(
&self,
input: DeleteStateMachineInput,
) -> RusotoFuture<DeleteStateMachineOutput, DeleteStateMachineError> {
let mut request = SignedRequest::new("POST", "states", &self.region, "/");
request.set_content_type("application/x-amz-json-1.0".to_owned());
request.add_header("x-amz-target", "AWSStepFunctions.DeleteStateMachine");
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::<DeleteStateMachineOutput>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(DeleteStateMachineError::from_response(response))),
)
}
})
}
fn describe_activity(
&self,
input: DescribeActivityInput,
) -> RusotoFuture<DescribeActivityOutput, DescribeActivityError> {
let mut request = SignedRequest::new("POST", "states", &self.region, "/");
request.set_content_type("application/x-amz-json-1.0".to_owned());
request.add_header("x-amz-target", "AWSStepFunctions.DescribeActivity");
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::<DescribeActivityOutput>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(DescribeActivityError::from_response(response))),
)
}
})
}
fn describe_execution(
&self,
input: DescribeExecutionInput,
) -> RusotoFuture<DescribeExecutionOutput, DescribeExecutionError> {
let mut request = SignedRequest::new("POST", "states", &self.region, "/");
request.set_content_type("application/x-amz-json-1.0".to_owned());
request.add_header("x-amz-target", "AWSStepFunctions.DescribeExecution");
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::<DescribeExecutionOutput>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(DescribeExecutionError::from_response(response))),
)
}
})
}
fn describe_state_machine(
&self,
input: DescribeStateMachineInput,
) -> RusotoFuture<DescribeStateMachineOutput, DescribeStateMachineError> {
let mut request = SignedRequest::new("POST", "states", &self.region, "/");
request.set_content_type("application/x-amz-json-1.0".to_owned());
request.add_header("x-amz-target", "AWSStepFunctions.DescribeStateMachine");
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::<DescribeStateMachineOutput>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(DescribeStateMachineError::from_response(response))
}),
)
}
})
}
fn describe_state_machine_for_execution(
&self,
input: DescribeStateMachineForExecutionInput,
) -> RusotoFuture<DescribeStateMachineForExecutionOutput, DescribeStateMachineForExecutionError>
{
let mut request = SignedRequest::new("POST", "states", &self.region, "/");
request.set_content_type("application/x-amz-json-1.0".to_owned());
request.add_header(
"x-amz-target",
"AWSStepFunctions.DescribeStateMachineForExecution",
);
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::<DescribeStateMachineForExecutionOutput>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(DescribeStateMachineForExecutionError::from_response(
response,
))
}))
}
})
}
fn get_activity_task(
&self,
input: GetActivityTaskInput,
) -> RusotoFuture<GetActivityTaskOutput, GetActivityTaskError> {
let mut request = SignedRequest::new("POST", "states", &self.region, "/");
request.set_content_type("application/x-amz-json-1.0".to_owned());
request.add_header("x-amz-target", "AWSStepFunctions.GetActivityTask");
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::<GetActivityTaskOutput>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(GetActivityTaskError::from_response(response))),
)
}
})
}
fn get_execution_history(
&self,
input: GetExecutionHistoryInput,
) -> RusotoFuture<GetExecutionHistoryOutput, GetExecutionHistoryError> {
let mut request = SignedRequest::new("POST", "states", &self.region, "/");
request.set_content_type("application/x-amz-json-1.0".to_owned());
request.add_header("x-amz-target", "AWSStepFunctions.GetExecutionHistory");
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::<GetExecutionHistoryOutput>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(GetExecutionHistoryError::from_response(response))
}),
)
}
})
}
fn list_activities(
&self,
input: ListActivitiesInput,
) -> RusotoFuture<ListActivitiesOutput, ListActivitiesError> {
let mut request = SignedRequest::new("POST", "states", &self.region, "/");
request.set_content_type("application/x-amz-json-1.0".to_owned());
request.add_header("x-amz-target", "AWSStepFunctions.ListActivities");
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::<ListActivitiesOutput>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(ListActivitiesError::from_response(response))),
)
}
})
}
fn list_executions(
&self,
input: ListExecutionsInput,
) -> RusotoFuture<ListExecutionsOutput, ListExecutionsError> {
let mut request = SignedRequest::new("POST", "states", &self.region, "/");
request.set_content_type("application/x-amz-json-1.0".to_owned());
request.add_header("x-amz-target", "AWSStepFunctions.ListExecutions");
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::<ListExecutionsOutput>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(ListExecutionsError::from_response(response))),
)
}
})
}
fn list_state_machines(
&self,
input: ListStateMachinesInput,
) -> RusotoFuture<ListStateMachinesOutput, ListStateMachinesError> {
let mut request = SignedRequest::new("POST", "states", &self.region, "/");
request.set_content_type("application/x-amz-json-1.0".to_owned());
request.add_header("x-amz-target", "AWSStepFunctions.ListStateMachines");
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::<ListStateMachinesOutput>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(ListStateMachinesError::from_response(response))),
)
}
})
}
fn list_tags_for_resource(
&self,
input: ListTagsForResourceInput,
) -> RusotoFuture<ListTagsForResourceOutput, ListTagsForResourceError> {
let mut request = SignedRequest::new("POST", "states", &self.region, "/");
request.set_content_type("application/x-amz-json-1.0".to_owned());
request.add_header("x-amz-target", "AWSStepFunctions.ListTagsForResource");
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::<ListTagsForResourceOutput>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(ListTagsForResourceError::from_response(response))
}),
)
}
})
}
fn send_task_failure(
&self,
input: SendTaskFailureInput,
) -> RusotoFuture<SendTaskFailureOutput, SendTaskFailureError> {
let mut request = SignedRequest::new("POST", "states", &self.region, "/");
request.set_content_type("application/x-amz-json-1.0".to_owned());
request.add_header("x-amz-target", "AWSStepFunctions.SendTaskFailure");
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::<SendTaskFailureOutput>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(SendTaskFailureError::from_response(response))),
)
}
})
}
fn send_task_heartbeat(
&self,
input: SendTaskHeartbeatInput,
) -> RusotoFuture<SendTaskHeartbeatOutput, SendTaskHeartbeatError> {
let mut request = SignedRequest::new("POST", "states", &self.region, "/");
request.set_content_type("application/x-amz-json-1.0".to_owned());
request.add_header("x-amz-target", "AWSStepFunctions.SendTaskHeartbeat");
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::<SendTaskHeartbeatOutput>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(SendTaskHeartbeatError::from_response(response))),
)
}
})
}
fn send_task_success(
&self,
input: SendTaskSuccessInput,
) -> RusotoFuture<SendTaskSuccessOutput, SendTaskSuccessError> {
let mut request = SignedRequest::new("POST", "states", &self.region, "/");
request.set_content_type("application/x-amz-json-1.0".to_owned());
request.add_header("x-amz-target", "AWSStepFunctions.SendTaskSuccess");
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::<SendTaskSuccessOutput>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(SendTaskSuccessError::from_response(response))),
)
}
})
}
fn start_execution(
&self,
input: StartExecutionInput,
) -> RusotoFuture<StartExecutionOutput, StartExecutionError> {
let mut request = SignedRequest::new("POST", "states", &self.region, "/");
request.set_content_type("application/x-amz-json-1.0".to_owned());
request.add_header("x-amz-target", "AWSStepFunctions.StartExecution");
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::<StartExecutionOutput>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(StartExecutionError::from_response(response))),
)
}
})
}
fn stop_execution(
&self,
input: StopExecutionInput,
) -> RusotoFuture<StopExecutionOutput, StopExecutionError> {
let mut request = SignedRequest::new("POST", "states", &self.region, "/");
request.set_content_type("application/x-amz-json-1.0".to_owned());
request.add_header("x-amz-target", "AWSStepFunctions.StopExecution");
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::<StopExecutionOutput>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(StopExecutionError::from_response(response))),
)
}
})
}
fn tag_resource(
&self,
input: TagResourceInput,
) -> RusotoFuture<TagResourceOutput, TagResourceError> {
let mut request = SignedRequest::new("POST", "states", &self.region, "/");
request.set_content_type("application/x-amz-json-1.0".to_owned());
request.add_header("x-amz-target", "AWSStepFunctions.TagResource");
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::<TagResourceOutput>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(TagResourceError::from_response(response))),
)
}
})
}
fn untag_resource(
&self,
input: UntagResourceInput,
) -> RusotoFuture<UntagResourceOutput, UntagResourceError> {
let mut request = SignedRequest::new("POST", "states", &self.region, "/");
request.set_content_type("application/x-amz-json-1.0".to_owned());
request.add_header("x-amz-target", "AWSStepFunctions.UntagResource");
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::<UntagResourceOutput>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(UntagResourceError::from_response(response))),
)
}
})
}
fn update_state_machine(
&self,
input: UpdateStateMachineInput,
) -> RusotoFuture<UpdateStateMachineOutput, UpdateStateMachineError> {
let mut request = SignedRequest::new("POST", "states", &self.region, "/");
request.set_content_type("application/x-amz-json-1.0".to_owned());
request.add_header("x-amz-target", "AWSStepFunctions.UpdateStateMachine");
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::<UpdateStateMachineOutput>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(UpdateStateMachineError::from_response(response))),
)
}
})
}
}
#[cfg(test)]
mod protocol_tests {}