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 AWSSessionCredentials {
#[serde(rename = "accessKeyId")]
pub access_key_id: String,
#[serde(rename = "secretAccessKey")]
pub secret_access_key: String,
#[serde(rename = "sessionToken")]
pub session_token: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct AcknowledgeJobInput {
#[serde(rename = "jobId")]
pub job_id: String,
#[serde(rename = "nonce")]
pub nonce: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct AcknowledgeJobOutput {
#[serde(rename = "status")]
#[serde(skip_serializing_if = "Option::is_none")]
pub status: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct AcknowledgeThirdPartyJobInput {
#[serde(rename = "clientToken")]
pub client_token: String,
#[serde(rename = "jobId")]
pub job_id: String,
#[serde(rename = "nonce")]
pub nonce: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct AcknowledgeThirdPartyJobOutput {
#[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 ActionConfiguration {
#[serde(rename = "configuration")]
#[serde(skip_serializing_if = "Option::is_none")]
pub configuration: Option<::std::collections::HashMap<String, String>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct ActionConfigurationProperty {
#[serde(rename = "description")]
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[serde(rename = "key")]
pub key: bool,
#[serde(rename = "name")]
pub name: String,
#[serde(rename = "queryable")]
#[serde(skip_serializing_if = "Option::is_none")]
pub queryable: Option<bool>,
#[serde(rename = "required")]
pub required: bool,
#[serde(rename = "secret")]
pub secret: bool,
#[serde(rename = "type")]
#[serde(skip_serializing_if = "Option::is_none")]
pub type_: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ActionContext {
#[serde(rename = "name")]
#[serde(skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct ActionDeclaration {
#[serde(rename = "actionTypeId")]
pub action_type_id: ActionTypeId,
#[serde(rename = "configuration")]
#[serde(skip_serializing_if = "Option::is_none")]
pub configuration: Option<::std::collections::HashMap<String, String>>,
#[serde(rename = "inputArtifacts")]
#[serde(skip_serializing_if = "Option::is_none")]
pub input_artifacts: Option<Vec<InputArtifact>>,
#[serde(rename = "name")]
pub name: String,
#[serde(rename = "outputArtifacts")]
#[serde(skip_serializing_if = "Option::is_none")]
pub output_artifacts: Option<Vec<OutputArtifact>>,
#[serde(rename = "roleArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub role_arn: Option<String>,
#[serde(rename = "runOrder")]
#[serde(skip_serializing_if = "Option::is_none")]
pub run_order: Option<i64>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ActionExecution {
#[serde(rename = "errorDetails")]
#[serde(skip_serializing_if = "Option::is_none")]
pub error_details: Option<ErrorDetails>,
#[serde(rename = "externalExecutionId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub external_execution_id: Option<String>,
#[serde(rename = "externalExecutionUrl")]
#[serde(skip_serializing_if = "Option::is_none")]
pub external_execution_url: Option<String>,
#[serde(rename = "lastStatusChange")]
#[serde(skip_serializing_if = "Option::is_none")]
pub last_status_change: Option<f64>,
#[serde(rename = "lastUpdatedBy")]
#[serde(skip_serializing_if = "Option::is_none")]
pub last_updated_by: Option<String>,
#[serde(rename = "percentComplete")]
#[serde(skip_serializing_if = "Option::is_none")]
pub percent_complete: Option<i64>,
#[serde(rename = "status")]
#[serde(skip_serializing_if = "Option::is_none")]
pub status: Option<String>,
#[serde(rename = "summary")]
#[serde(skip_serializing_if = "Option::is_none")]
pub summary: Option<String>,
#[serde(rename = "token")]
#[serde(skip_serializing_if = "Option::is_none")]
pub token: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct ActionRevision {
#[serde(rename = "created")]
pub created: f64,
#[serde(rename = "revisionChangeId")]
pub revision_change_id: String,
#[serde(rename = "revisionId")]
pub revision_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ActionState {
#[serde(rename = "actionName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub action_name: Option<String>,
#[serde(rename = "currentRevision")]
#[serde(skip_serializing_if = "Option::is_none")]
pub current_revision: Option<ActionRevision>,
#[serde(rename = "entityUrl")]
#[serde(skip_serializing_if = "Option::is_none")]
pub entity_url: Option<String>,
#[serde(rename = "latestExecution")]
#[serde(skip_serializing_if = "Option::is_none")]
pub latest_execution: Option<ActionExecution>,
#[serde(rename = "revisionUrl")]
#[serde(skip_serializing_if = "Option::is_none")]
pub revision_url: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ActionType {
#[serde(rename = "actionConfigurationProperties")]
#[serde(skip_serializing_if = "Option::is_none")]
pub action_configuration_properties: Option<Vec<ActionConfigurationProperty>>,
#[serde(rename = "id")]
pub id: ActionTypeId,
#[serde(rename = "inputArtifactDetails")]
pub input_artifact_details: ArtifactDetails,
#[serde(rename = "outputArtifactDetails")]
pub output_artifact_details: ArtifactDetails,
#[serde(rename = "settings")]
#[serde(skip_serializing_if = "Option::is_none")]
pub settings: Option<ActionTypeSettings>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct ActionTypeId {
#[serde(rename = "category")]
pub category: String,
#[serde(rename = "owner")]
pub owner: String,
#[serde(rename = "provider")]
pub provider: String,
#[serde(rename = "version")]
pub version: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct ActionTypeSettings {
#[serde(rename = "entityUrlTemplate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub entity_url_template: Option<String>,
#[serde(rename = "executionUrlTemplate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub execution_url_template: Option<String>,
#[serde(rename = "revisionUrlTemplate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub revision_url_template: Option<String>,
#[serde(rename = "thirdPartyConfigurationUrl")]
#[serde(skip_serializing_if = "Option::is_none")]
pub third_party_configuration_url: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ApprovalResult {
#[serde(rename = "status")]
pub status: String,
#[serde(rename = "summary")]
pub summary: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct Artifact {
#[serde(rename = "location")]
#[serde(skip_serializing_if = "Option::is_none")]
pub location: Option<ArtifactLocation>,
#[serde(rename = "name")]
#[serde(skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
#[serde(rename = "revision")]
#[serde(skip_serializing_if = "Option::is_none")]
pub revision: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct ArtifactDetails {
#[serde(rename = "maximumCount")]
pub maximum_count: i64,
#[serde(rename = "minimumCount")]
pub minimum_count: i64,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ArtifactLocation {
#[serde(rename = "s3Location")]
#[serde(skip_serializing_if = "Option::is_none")]
pub s_3_location: Option<S3ArtifactLocation>,
#[serde(rename = "type")]
#[serde(skip_serializing_if = "Option::is_none")]
pub type_: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ArtifactRevision {
#[serde(rename = "created")]
#[serde(skip_serializing_if = "Option::is_none")]
pub created: Option<f64>,
#[serde(rename = "name")]
#[serde(skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
#[serde(rename = "revisionChangeIdentifier")]
#[serde(skip_serializing_if = "Option::is_none")]
pub revision_change_identifier: Option<String>,
#[serde(rename = "revisionId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub revision_id: Option<String>,
#[serde(rename = "revisionSummary")]
#[serde(skip_serializing_if = "Option::is_none")]
pub revision_summary: Option<String>,
#[serde(rename = "revisionUrl")]
#[serde(skip_serializing_if = "Option::is_none")]
pub revision_url: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct ArtifactStore {
#[serde(rename = "encryptionKey")]
#[serde(skip_serializing_if = "Option::is_none")]
pub encryption_key: Option<EncryptionKey>,
#[serde(rename = "location")]
pub location: String,
#[serde(rename = "type")]
pub type_: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct BlockerDeclaration {
#[serde(rename = "name")]
pub name: String,
#[serde(rename = "type")]
pub type_: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct CreateCustomActionTypeInput {
#[serde(rename = "category")]
pub category: String,
#[serde(rename = "configurationProperties")]
#[serde(skip_serializing_if = "Option::is_none")]
pub configuration_properties: Option<Vec<ActionConfigurationProperty>>,
#[serde(rename = "inputArtifactDetails")]
pub input_artifact_details: ArtifactDetails,
#[serde(rename = "outputArtifactDetails")]
pub output_artifact_details: ArtifactDetails,
#[serde(rename = "provider")]
pub provider: String,
#[serde(rename = "settings")]
#[serde(skip_serializing_if = "Option::is_none")]
pub settings: Option<ActionTypeSettings>,
#[serde(rename = "version")]
pub version: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct CreateCustomActionTypeOutput {
#[serde(rename = "actionType")]
pub action_type: ActionType,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct CreatePipelineInput {
#[serde(rename = "pipeline")]
pub pipeline: PipelineDeclaration,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct CreatePipelineOutput {
#[serde(rename = "pipeline")]
#[serde(skip_serializing_if = "Option::is_none")]
pub pipeline: Option<PipelineDeclaration>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct CurrentRevision {
#[serde(rename = "changeIdentifier")]
pub change_identifier: String,
#[serde(rename = "created")]
#[serde(skip_serializing_if = "Option::is_none")]
pub created: Option<f64>,
#[serde(rename = "revision")]
pub revision: String,
#[serde(rename = "revisionSummary")]
#[serde(skip_serializing_if = "Option::is_none")]
pub revision_summary: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DeleteCustomActionTypeInput {
#[serde(rename = "category")]
pub category: String,
#[serde(rename = "provider")]
pub provider: String,
#[serde(rename = "version")]
pub version: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DeletePipelineInput {
#[serde(rename = "name")]
pub name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DeleteWebhookInput {
#[serde(rename = "name")]
pub name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DeleteWebhookOutput {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DeregisterWebhookWithThirdPartyInput {
#[serde(rename = "webhookName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub webhook_name: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DeregisterWebhookWithThirdPartyOutput {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DisableStageTransitionInput {
#[serde(rename = "pipelineName")]
pub pipeline_name: String,
#[serde(rename = "reason")]
pub reason: String,
#[serde(rename = "stageName")]
pub stage_name: String,
#[serde(rename = "transitionType")]
pub transition_type: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct EnableStageTransitionInput {
#[serde(rename = "pipelineName")]
pub pipeline_name: String,
#[serde(rename = "stageName")]
pub stage_name: String,
#[serde(rename = "transitionType")]
pub transition_type: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct EncryptionKey {
#[serde(rename = "id")]
pub id: String,
#[serde(rename = "type")]
pub type_: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ErrorDetails {
#[serde(rename = "code")]
#[serde(skip_serializing_if = "Option::is_none")]
pub code: Option<String>,
#[serde(rename = "message")]
#[serde(skip_serializing_if = "Option::is_none")]
pub message: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ExecutionDetails {
#[serde(rename = "externalExecutionId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub external_execution_id: Option<String>,
#[serde(rename = "percentComplete")]
#[serde(skip_serializing_if = "Option::is_none")]
pub percent_complete: Option<i64>,
#[serde(rename = "summary")]
#[serde(skip_serializing_if = "Option::is_none")]
pub summary: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct FailureDetails {
#[serde(rename = "externalExecutionId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub external_execution_id: Option<String>,
#[serde(rename = "message")]
pub message: String,
#[serde(rename = "type")]
pub type_: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetJobDetailsInput {
#[serde(rename = "jobId")]
pub job_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct GetJobDetailsOutput {
#[serde(rename = "jobDetails")]
#[serde(skip_serializing_if = "Option::is_none")]
pub job_details: Option<JobDetails>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetPipelineExecutionInput {
#[serde(rename = "pipelineExecutionId")]
pub pipeline_execution_id: String,
#[serde(rename = "pipelineName")]
pub pipeline_name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct GetPipelineExecutionOutput {
#[serde(rename = "pipelineExecution")]
#[serde(skip_serializing_if = "Option::is_none")]
pub pipeline_execution: Option<PipelineExecution>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetPipelineInput {
#[serde(rename = "name")]
pub name: String,
#[serde(rename = "version")]
#[serde(skip_serializing_if = "Option::is_none")]
pub version: Option<i64>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct GetPipelineOutput {
#[serde(rename = "metadata")]
#[serde(skip_serializing_if = "Option::is_none")]
pub metadata: Option<PipelineMetadata>,
#[serde(rename = "pipeline")]
#[serde(skip_serializing_if = "Option::is_none")]
pub pipeline: Option<PipelineDeclaration>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetPipelineStateInput {
#[serde(rename = "name")]
pub name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct GetPipelineStateOutput {
#[serde(rename = "created")]
#[serde(skip_serializing_if = "Option::is_none")]
pub created: Option<f64>,
#[serde(rename = "pipelineName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub pipeline_name: Option<String>,
#[serde(rename = "pipelineVersion")]
#[serde(skip_serializing_if = "Option::is_none")]
pub pipeline_version: Option<i64>,
#[serde(rename = "stageStates")]
#[serde(skip_serializing_if = "Option::is_none")]
pub stage_states: Option<Vec<StageState>>,
#[serde(rename = "updated")]
#[serde(skip_serializing_if = "Option::is_none")]
pub updated: Option<f64>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetThirdPartyJobDetailsInput {
#[serde(rename = "clientToken")]
pub client_token: String,
#[serde(rename = "jobId")]
pub job_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct GetThirdPartyJobDetailsOutput {
#[serde(rename = "jobDetails")]
#[serde(skip_serializing_if = "Option::is_none")]
pub job_details: Option<ThirdPartyJobDetails>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct InputArtifact {
#[serde(rename = "name")]
pub name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct Job {
#[serde(rename = "accountId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub account_id: Option<String>,
#[serde(rename = "data")]
#[serde(skip_serializing_if = "Option::is_none")]
pub data: Option<JobData>,
#[serde(rename = "id")]
#[serde(skip_serializing_if = "Option::is_none")]
pub id: Option<String>,
#[serde(rename = "nonce")]
#[serde(skip_serializing_if = "Option::is_none")]
pub nonce: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct JobData {
#[serde(rename = "actionConfiguration")]
#[serde(skip_serializing_if = "Option::is_none")]
pub action_configuration: Option<ActionConfiguration>,
#[serde(rename = "actionTypeId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub action_type_id: Option<ActionTypeId>,
#[serde(rename = "artifactCredentials")]
#[serde(skip_serializing_if = "Option::is_none")]
pub artifact_credentials: Option<AWSSessionCredentials>,
#[serde(rename = "continuationToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub continuation_token: Option<String>,
#[serde(rename = "encryptionKey")]
#[serde(skip_serializing_if = "Option::is_none")]
pub encryption_key: Option<EncryptionKey>,
#[serde(rename = "inputArtifacts")]
#[serde(skip_serializing_if = "Option::is_none")]
pub input_artifacts: Option<Vec<Artifact>>,
#[serde(rename = "outputArtifacts")]
#[serde(skip_serializing_if = "Option::is_none")]
pub output_artifacts: Option<Vec<Artifact>>,
#[serde(rename = "pipelineContext")]
#[serde(skip_serializing_if = "Option::is_none")]
pub pipeline_context: Option<PipelineContext>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct JobDetails {
#[serde(rename = "accountId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub account_id: Option<String>,
#[serde(rename = "data")]
#[serde(skip_serializing_if = "Option::is_none")]
pub data: Option<JobData>,
#[serde(rename = "id")]
#[serde(skip_serializing_if = "Option::is_none")]
pub id: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ListActionTypesInput {
#[serde(rename = "actionOwnerFilter")]
#[serde(skip_serializing_if = "Option::is_none")]
pub action_owner_filter: Option<String>,
#[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 ListActionTypesOutput {
#[serde(rename = "actionTypes")]
pub action_types: Vec<ActionType>,
#[serde(rename = "nextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ListPipelineExecutionsInput {
#[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 = "pipelineName")]
pub pipeline_name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ListPipelineExecutionsOutput {
#[serde(rename = "nextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "pipelineExecutionSummaries")]
#[serde(skip_serializing_if = "Option::is_none")]
pub pipeline_execution_summaries: Option<Vec<PipelineExecutionSummary>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ListPipelinesInput {
#[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 ListPipelinesOutput {
#[serde(rename = "nextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "pipelines")]
#[serde(skip_serializing_if = "Option::is_none")]
pub pipelines: Option<Vec<PipelineSummary>>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ListWebhookItem {
#[serde(rename = "arn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub arn: Option<String>,
#[serde(rename = "definition")]
pub definition: WebhookDefinition,
#[serde(rename = "errorCode")]
#[serde(skip_serializing_if = "Option::is_none")]
pub error_code: Option<String>,
#[serde(rename = "errorMessage")]
#[serde(skip_serializing_if = "Option::is_none")]
pub error_message: Option<String>,
#[serde(rename = "lastTriggered")]
#[serde(skip_serializing_if = "Option::is_none")]
pub last_triggered: Option<f64>,
#[serde(rename = "url")]
pub url: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ListWebhooksInput {
#[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 ListWebhooksOutput {
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "webhooks")]
#[serde(skip_serializing_if = "Option::is_none")]
pub webhooks: Option<Vec<ListWebhookItem>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct OutputArtifact {
#[serde(rename = "name")]
pub name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct PipelineContext {
#[serde(rename = "action")]
#[serde(skip_serializing_if = "Option::is_none")]
pub action: Option<ActionContext>,
#[serde(rename = "pipelineName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub pipeline_name: Option<String>,
#[serde(rename = "stage")]
#[serde(skip_serializing_if = "Option::is_none")]
pub stage: Option<StageContext>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct PipelineDeclaration {
#[serde(rename = "artifactStore")]
pub artifact_store: ArtifactStore,
#[serde(rename = "name")]
pub name: String,
#[serde(rename = "roleArn")]
pub role_arn: String,
#[serde(rename = "stages")]
pub stages: Vec<StageDeclaration>,
#[serde(rename = "version")]
#[serde(skip_serializing_if = "Option::is_none")]
pub version: Option<i64>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct PipelineExecution {
#[serde(rename = "artifactRevisions")]
#[serde(skip_serializing_if = "Option::is_none")]
pub artifact_revisions: Option<Vec<ArtifactRevision>>,
#[serde(rename = "pipelineExecutionId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub pipeline_execution_id: Option<String>,
#[serde(rename = "pipelineName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub pipeline_name: Option<String>,
#[serde(rename = "pipelineVersion")]
#[serde(skip_serializing_if = "Option::is_none")]
pub pipeline_version: Option<i64>,
#[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 PipelineExecutionSummary {
#[serde(rename = "lastUpdateTime")]
#[serde(skip_serializing_if = "Option::is_none")]
pub last_update_time: Option<f64>,
#[serde(rename = "pipelineExecutionId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub pipeline_execution_id: Option<String>,
#[serde(rename = "sourceRevisions")]
#[serde(skip_serializing_if = "Option::is_none")]
pub source_revisions: Option<Vec<SourceRevision>>,
#[serde(rename = "startTime")]
#[serde(skip_serializing_if = "Option::is_none")]
pub start_time: Option<f64>,
#[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 PipelineMetadata {
#[serde(rename = "created")]
#[serde(skip_serializing_if = "Option::is_none")]
pub created: Option<f64>,
#[serde(rename = "pipelineArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub pipeline_arn: Option<String>,
#[serde(rename = "updated")]
#[serde(skip_serializing_if = "Option::is_none")]
pub updated: Option<f64>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct PipelineSummary {
#[serde(rename = "created")]
#[serde(skip_serializing_if = "Option::is_none")]
pub created: Option<f64>,
#[serde(rename = "name")]
#[serde(skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
#[serde(rename = "updated")]
#[serde(skip_serializing_if = "Option::is_none")]
pub updated: Option<f64>,
#[serde(rename = "version")]
#[serde(skip_serializing_if = "Option::is_none")]
pub version: Option<i64>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct PollForJobsInput {
#[serde(rename = "actionTypeId")]
pub action_type_id: ActionTypeId,
#[serde(rename = "maxBatchSize")]
#[serde(skip_serializing_if = "Option::is_none")]
pub max_batch_size: Option<i64>,
#[serde(rename = "queryParam")]
#[serde(skip_serializing_if = "Option::is_none")]
pub query_param: Option<::std::collections::HashMap<String, String>>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct PollForJobsOutput {
#[serde(rename = "jobs")]
#[serde(skip_serializing_if = "Option::is_none")]
pub jobs: Option<Vec<Job>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct PollForThirdPartyJobsInput {
#[serde(rename = "actionTypeId")]
pub action_type_id: ActionTypeId,
#[serde(rename = "maxBatchSize")]
#[serde(skip_serializing_if = "Option::is_none")]
pub max_batch_size: Option<i64>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct PollForThirdPartyJobsOutput {
#[serde(rename = "jobs")]
#[serde(skip_serializing_if = "Option::is_none")]
pub jobs: Option<Vec<ThirdPartyJob>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct PutActionRevisionInput {
#[serde(rename = "actionName")]
pub action_name: String,
#[serde(rename = "actionRevision")]
pub action_revision: ActionRevision,
#[serde(rename = "pipelineName")]
pub pipeline_name: String,
#[serde(rename = "stageName")]
pub stage_name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct PutActionRevisionOutput {
#[serde(rename = "newRevision")]
#[serde(skip_serializing_if = "Option::is_none")]
pub new_revision: Option<bool>,
#[serde(rename = "pipelineExecutionId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub pipeline_execution_id: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct PutApprovalResultInput {
#[serde(rename = "actionName")]
pub action_name: String,
#[serde(rename = "pipelineName")]
pub pipeline_name: String,
#[serde(rename = "result")]
pub result: ApprovalResult,
#[serde(rename = "stageName")]
pub stage_name: String,
#[serde(rename = "token")]
pub token: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct PutApprovalResultOutput {
#[serde(rename = "approvedAt")]
#[serde(skip_serializing_if = "Option::is_none")]
pub approved_at: Option<f64>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct PutJobFailureResultInput {
#[serde(rename = "failureDetails")]
pub failure_details: FailureDetails,
#[serde(rename = "jobId")]
pub job_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct PutJobSuccessResultInput {
#[serde(rename = "continuationToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub continuation_token: Option<String>,
#[serde(rename = "currentRevision")]
#[serde(skip_serializing_if = "Option::is_none")]
pub current_revision: Option<CurrentRevision>,
#[serde(rename = "executionDetails")]
#[serde(skip_serializing_if = "Option::is_none")]
pub execution_details: Option<ExecutionDetails>,
#[serde(rename = "jobId")]
pub job_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct PutThirdPartyJobFailureResultInput {
#[serde(rename = "clientToken")]
pub client_token: String,
#[serde(rename = "failureDetails")]
pub failure_details: FailureDetails,
#[serde(rename = "jobId")]
pub job_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct PutThirdPartyJobSuccessResultInput {
#[serde(rename = "clientToken")]
pub client_token: String,
#[serde(rename = "continuationToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub continuation_token: Option<String>,
#[serde(rename = "currentRevision")]
#[serde(skip_serializing_if = "Option::is_none")]
pub current_revision: Option<CurrentRevision>,
#[serde(rename = "executionDetails")]
#[serde(skip_serializing_if = "Option::is_none")]
pub execution_details: Option<ExecutionDetails>,
#[serde(rename = "jobId")]
pub job_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct PutWebhookInput {
#[serde(rename = "webhook")]
pub webhook: WebhookDefinition,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct PutWebhookOutput {
#[serde(rename = "webhook")]
#[serde(skip_serializing_if = "Option::is_none")]
pub webhook: Option<ListWebhookItem>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct RegisterWebhookWithThirdPartyInput {
#[serde(rename = "webhookName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub webhook_name: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct RegisterWebhookWithThirdPartyOutput {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct RetryStageExecutionInput {
#[serde(rename = "pipelineExecutionId")]
pub pipeline_execution_id: String,
#[serde(rename = "pipelineName")]
pub pipeline_name: String,
#[serde(rename = "retryMode")]
pub retry_mode: String,
#[serde(rename = "stageName")]
pub stage_name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct RetryStageExecutionOutput {
#[serde(rename = "pipelineExecutionId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub pipeline_execution_id: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct S3ArtifactLocation {
#[serde(rename = "bucketName")]
pub bucket_name: String,
#[serde(rename = "objectKey")]
pub object_key: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct SourceRevision {
#[serde(rename = "actionName")]
pub action_name: String,
#[serde(rename = "revisionId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub revision_id: Option<String>,
#[serde(rename = "revisionSummary")]
#[serde(skip_serializing_if = "Option::is_none")]
pub revision_summary: Option<String>,
#[serde(rename = "revisionUrl")]
#[serde(skip_serializing_if = "Option::is_none")]
pub revision_url: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct StageContext {
#[serde(rename = "name")]
#[serde(skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct StageDeclaration {
#[serde(rename = "actions")]
pub actions: Vec<ActionDeclaration>,
#[serde(rename = "blockers")]
#[serde(skip_serializing_if = "Option::is_none")]
pub blockers: Option<Vec<BlockerDeclaration>>,
#[serde(rename = "name")]
pub name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct StageExecution {
#[serde(rename = "pipelineExecutionId")]
pub pipeline_execution_id: String,
#[serde(rename = "status")]
pub status: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct StageState {
#[serde(rename = "actionStates")]
#[serde(skip_serializing_if = "Option::is_none")]
pub action_states: Option<Vec<ActionState>>,
#[serde(rename = "inboundTransitionState")]
#[serde(skip_serializing_if = "Option::is_none")]
pub inbound_transition_state: Option<TransitionState>,
#[serde(rename = "latestExecution")]
#[serde(skip_serializing_if = "Option::is_none")]
pub latest_execution: Option<StageExecution>,
#[serde(rename = "stageName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub stage_name: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct StartPipelineExecutionInput {
#[serde(rename = "name")]
pub name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct StartPipelineExecutionOutput {
#[serde(rename = "pipelineExecutionId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub pipeline_execution_id: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ThirdPartyJob {
#[serde(rename = "clientId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub client_id: Option<String>,
#[serde(rename = "jobId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub job_id: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ThirdPartyJobData {
#[serde(rename = "actionConfiguration")]
#[serde(skip_serializing_if = "Option::is_none")]
pub action_configuration: Option<ActionConfiguration>,
#[serde(rename = "actionTypeId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub action_type_id: Option<ActionTypeId>,
#[serde(rename = "artifactCredentials")]
#[serde(skip_serializing_if = "Option::is_none")]
pub artifact_credentials: Option<AWSSessionCredentials>,
#[serde(rename = "continuationToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub continuation_token: Option<String>,
#[serde(rename = "encryptionKey")]
#[serde(skip_serializing_if = "Option::is_none")]
pub encryption_key: Option<EncryptionKey>,
#[serde(rename = "inputArtifacts")]
#[serde(skip_serializing_if = "Option::is_none")]
pub input_artifacts: Option<Vec<Artifact>>,
#[serde(rename = "outputArtifacts")]
#[serde(skip_serializing_if = "Option::is_none")]
pub output_artifacts: Option<Vec<Artifact>>,
#[serde(rename = "pipelineContext")]
#[serde(skip_serializing_if = "Option::is_none")]
pub pipeline_context: Option<PipelineContext>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ThirdPartyJobDetails {
#[serde(rename = "data")]
#[serde(skip_serializing_if = "Option::is_none")]
pub data: Option<ThirdPartyJobData>,
#[serde(rename = "id")]
#[serde(skip_serializing_if = "Option::is_none")]
pub id: Option<String>,
#[serde(rename = "nonce")]
#[serde(skip_serializing_if = "Option::is_none")]
pub nonce: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct TransitionState {
#[serde(rename = "disabledReason")]
#[serde(skip_serializing_if = "Option::is_none")]
pub disabled_reason: Option<String>,
#[serde(rename = "enabled")]
#[serde(skip_serializing_if = "Option::is_none")]
pub enabled: Option<bool>,
#[serde(rename = "lastChangedAt")]
#[serde(skip_serializing_if = "Option::is_none")]
pub last_changed_at: Option<f64>,
#[serde(rename = "lastChangedBy")]
#[serde(skip_serializing_if = "Option::is_none")]
pub last_changed_by: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct UpdatePipelineInput {
#[serde(rename = "pipeline")]
pub pipeline: PipelineDeclaration,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct UpdatePipelineOutput {
#[serde(rename = "pipeline")]
#[serde(skip_serializing_if = "Option::is_none")]
pub pipeline: Option<PipelineDeclaration>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct WebhookAuthConfiguration {
#[serde(rename = "AllowedIPRange")]
#[serde(skip_serializing_if = "Option::is_none")]
pub allowed_ip_range: Option<String>,
#[serde(rename = "SecretToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub secret_token: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct WebhookDefinition {
#[serde(rename = "authentication")]
pub authentication: String,
#[serde(rename = "authenticationConfiguration")]
pub authentication_configuration: WebhookAuthConfiguration,
#[serde(rename = "filters")]
pub filters: Vec<WebhookFilterRule>,
#[serde(rename = "name")]
pub name: String,
#[serde(rename = "targetAction")]
pub target_action: String,
#[serde(rename = "targetPipeline")]
pub target_pipeline: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct WebhookFilterRule {
#[serde(rename = "jsonPath")]
pub json_path: String,
#[serde(rename = "matchEquals")]
#[serde(skip_serializing_if = "Option::is_none")]
pub match_equals: Option<String>,
}
#[derive(Debug, PartialEq)]
pub enum AcknowledgeJobError {
InvalidNonce(String),
JobNotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl AcknowledgeJobError {
pub fn from_response(res: BufferedHttpResponse) -> AcknowledgeJobError {
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 {
"InvalidNonceException" => {
return AcknowledgeJobError::InvalidNonce(String::from(error_message))
}
"JobNotFoundException" => {
return AcknowledgeJobError::JobNotFound(String::from(error_message))
}
"ValidationException" => {
return AcknowledgeJobError::Validation(error_message.to_string())
}
_ => {}
}
}
return AcknowledgeJobError::Unknown(res);
}
}
impl From<serde_json::error::Error> for AcknowledgeJobError {
fn from(err: serde_json::error::Error) -> AcknowledgeJobError {
AcknowledgeJobError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for AcknowledgeJobError {
fn from(err: CredentialsError) -> AcknowledgeJobError {
AcknowledgeJobError::Credentials(err)
}
}
impl From<HttpDispatchError> for AcknowledgeJobError {
fn from(err: HttpDispatchError) -> AcknowledgeJobError {
AcknowledgeJobError::HttpDispatch(err)
}
}
impl From<io::Error> for AcknowledgeJobError {
fn from(err: io::Error) -> AcknowledgeJobError {
AcknowledgeJobError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for AcknowledgeJobError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for AcknowledgeJobError {
fn description(&self) -> &str {
match *self {
AcknowledgeJobError::InvalidNonce(ref cause) => cause,
AcknowledgeJobError::JobNotFound(ref cause) => cause,
AcknowledgeJobError::Validation(ref cause) => cause,
AcknowledgeJobError::Credentials(ref err) => err.description(),
AcknowledgeJobError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
AcknowledgeJobError::ParseError(ref cause) => cause,
AcknowledgeJobError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum AcknowledgeThirdPartyJobError {
InvalidClientToken(String),
InvalidNonce(String),
JobNotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl AcknowledgeThirdPartyJobError {
pub fn from_response(res: BufferedHttpResponse) -> AcknowledgeThirdPartyJobError {
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 {
"InvalidClientTokenException" => {
return AcknowledgeThirdPartyJobError::InvalidClientToken(String::from(
error_message,
))
}
"InvalidNonceException" => {
return AcknowledgeThirdPartyJobError::InvalidNonce(String::from(error_message))
}
"JobNotFoundException" => {
return AcknowledgeThirdPartyJobError::JobNotFound(String::from(error_message))
}
"ValidationException" => {
return AcknowledgeThirdPartyJobError::Validation(error_message.to_string())
}
_ => {}
}
}
return AcknowledgeThirdPartyJobError::Unknown(res);
}
}
impl From<serde_json::error::Error> for AcknowledgeThirdPartyJobError {
fn from(err: serde_json::error::Error) -> AcknowledgeThirdPartyJobError {
AcknowledgeThirdPartyJobError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for AcknowledgeThirdPartyJobError {
fn from(err: CredentialsError) -> AcknowledgeThirdPartyJobError {
AcknowledgeThirdPartyJobError::Credentials(err)
}
}
impl From<HttpDispatchError> for AcknowledgeThirdPartyJobError {
fn from(err: HttpDispatchError) -> AcknowledgeThirdPartyJobError {
AcknowledgeThirdPartyJobError::HttpDispatch(err)
}
}
impl From<io::Error> for AcknowledgeThirdPartyJobError {
fn from(err: io::Error) -> AcknowledgeThirdPartyJobError {
AcknowledgeThirdPartyJobError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for AcknowledgeThirdPartyJobError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for AcknowledgeThirdPartyJobError {
fn description(&self) -> &str {
match *self {
AcknowledgeThirdPartyJobError::InvalidClientToken(ref cause) => cause,
AcknowledgeThirdPartyJobError::InvalidNonce(ref cause) => cause,
AcknowledgeThirdPartyJobError::JobNotFound(ref cause) => cause,
AcknowledgeThirdPartyJobError::Validation(ref cause) => cause,
AcknowledgeThirdPartyJobError::Credentials(ref err) => err.description(),
AcknowledgeThirdPartyJobError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
AcknowledgeThirdPartyJobError::ParseError(ref cause) => cause,
AcknowledgeThirdPartyJobError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum CreateCustomActionTypeError {
LimitExceeded(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl CreateCustomActionTypeError {
pub fn from_response(res: BufferedHttpResponse) -> CreateCustomActionTypeError {
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 {
"LimitExceededException" => {
return CreateCustomActionTypeError::LimitExceeded(String::from(error_message))
}
"ValidationException" => {
return CreateCustomActionTypeError::Validation(error_message.to_string())
}
_ => {}
}
}
return CreateCustomActionTypeError::Unknown(res);
}
}
impl From<serde_json::error::Error> for CreateCustomActionTypeError {
fn from(err: serde_json::error::Error) -> CreateCustomActionTypeError {
CreateCustomActionTypeError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for CreateCustomActionTypeError {
fn from(err: CredentialsError) -> CreateCustomActionTypeError {
CreateCustomActionTypeError::Credentials(err)
}
}
impl From<HttpDispatchError> for CreateCustomActionTypeError {
fn from(err: HttpDispatchError) -> CreateCustomActionTypeError {
CreateCustomActionTypeError::HttpDispatch(err)
}
}
impl From<io::Error> for CreateCustomActionTypeError {
fn from(err: io::Error) -> CreateCustomActionTypeError {
CreateCustomActionTypeError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for CreateCustomActionTypeError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for CreateCustomActionTypeError {
fn description(&self) -> &str {
match *self {
CreateCustomActionTypeError::LimitExceeded(ref cause) => cause,
CreateCustomActionTypeError::Validation(ref cause) => cause,
CreateCustomActionTypeError::Credentials(ref err) => err.description(),
CreateCustomActionTypeError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
CreateCustomActionTypeError::ParseError(ref cause) => cause,
CreateCustomActionTypeError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum CreatePipelineError {
InvalidActionDeclaration(String),
InvalidBlockerDeclaration(String),
InvalidStageDeclaration(String),
InvalidStructure(String),
LimitExceeded(String),
PipelineNameInUse(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl CreatePipelineError {
pub fn from_response(res: BufferedHttpResponse) -> CreatePipelineError {
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 {
"InvalidActionDeclarationException" => {
return CreatePipelineError::InvalidActionDeclaration(String::from(
error_message,
))
}
"InvalidBlockerDeclarationException" => {
return CreatePipelineError::InvalidBlockerDeclaration(String::from(
error_message,
))
}
"InvalidStageDeclarationException" => {
return CreatePipelineError::InvalidStageDeclaration(String::from(error_message))
}
"InvalidStructureException" => {
return CreatePipelineError::InvalidStructure(String::from(error_message))
}
"LimitExceededException" => {
return CreatePipelineError::LimitExceeded(String::from(error_message))
}
"PipelineNameInUseException" => {
return CreatePipelineError::PipelineNameInUse(String::from(error_message))
}
"ValidationException" => {
return CreatePipelineError::Validation(error_message.to_string())
}
_ => {}
}
}
return CreatePipelineError::Unknown(res);
}
}
impl From<serde_json::error::Error> for CreatePipelineError {
fn from(err: serde_json::error::Error) -> CreatePipelineError {
CreatePipelineError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for CreatePipelineError {
fn from(err: CredentialsError) -> CreatePipelineError {
CreatePipelineError::Credentials(err)
}
}
impl From<HttpDispatchError> for CreatePipelineError {
fn from(err: HttpDispatchError) -> CreatePipelineError {
CreatePipelineError::HttpDispatch(err)
}
}
impl From<io::Error> for CreatePipelineError {
fn from(err: io::Error) -> CreatePipelineError {
CreatePipelineError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for CreatePipelineError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for CreatePipelineError {
fn description(&self) -> &str {
match *self {
CreatePipelineError::InvalidActionDeclaration(ref cause) => cause,
CreatePipelineError::InvalidBlockerDeclaration(ref cause) => cause,
CreatePipelineError::InvalidStageDeclaration(ref cause) => cause,
CreatePipelineError::InvalidStructure(ref cause) => cause,
CreatePipelineError::LimitExceeded(ref cause) => cause,
CreatePipelineError::PipelineNameInUse(ref cause) => cause,
CreatePipelineError::Validation(ref cause) => cause,
CreatePipelineError::Credentials(ref err) => err.description(),
CreatePipelineError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
CreatePipelineError::ParseError(ref cause) => cause,
CreatePipelineError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DeleteCustomActionTypeError {
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DeleteCustomActionTypeError {
pub fn from_response(res: BufferedHttpResponse) -> DeleteCustomActionTypeError {
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 {
"ValidationException" => {
return DeleteCustomActionTypeError::Validation(error_message.to_string())
}
_ => {}
}
}
return DeleteCustomActionTypeError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DeleteCustomActionTypeError {
fn from(err: serde_json::error::Error) -> DeleteCustomActionTypeError {
DeleteCustomActionTypeError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DeleteCustomActionTypeError {
fn from(err: CredentialsError) -> DeleteCustomActionTypeError {
DeleteCustomActionTypeError::Credentials(err)
}
}
impl From<HttpDispatchError> for DeleteCustomActionTypeError {
fn from(err: HttpDispatchError) -> DeleteCustomActionTypeError {
DeleteCustomActionTypeError::HttpDispatch(err)
}
}
impl From<io::Error> for DeleteCustomActionTypeError {
fn from(err: io::Error) -> DeleteCustomActionTypeError {
DeleteCustomActionTypeError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DeleteCustomActionTypeError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DeleteCustomActionTypeError {
fn description(&self) -> &str {
match *self {
DeleteCustomActionTypeError::Validation(ref cause) => cause,
DeleteCustomActionTypeError::Credentials(ref err) => err.description(),
DeleteCustomActionTypeError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
DeleteCustomActionTypeError::ParseError(ref cause) => cause,
DeleteCustomActionTypeError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DeletePipelineError {
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DeletePipelineError {
pub fn from_response(res: BufferedHttpResponse) -> DeletePipelineError {
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 {
"ValidationException" => {
return DeletePipelineError::Validation(error_message.to_string())
}
_ => {}
}
}
return DeletePipelineError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DeletePipelineError {
fn from(err: serde_json::error::Error) -> DeletePipelineError {
DeletePipelineError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DeletePipelineError {
fn from(err: CredentialsError) -> DeletePipelineError {
DeletePipelineError::Credentials(err)
}
}
impl From<HttpDispatchError> for DeletePipelineError {
fn from(err: HttpDispatchError) -> DeletePipelineError {
DeletePipelineError::HttpDispatch(err)
}
}
impl From<io::Error> for DeletePipelineError {
fn from(err: io::Error) -> DeletePipelineError {
DeletePipelineError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DeletePipelineError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DeletePipelineError {
fn description(&self) -> &str {
match *self {
DeletePipelineError::Validation(ref cause) => cause,
DeletePipelineError::Credentials(ref err) => err.description(),
DeletePipelineError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
DeletePipelineError::ParseError(ref cause) => cause,
DeletePipelineError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DeleteWebhookError {
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DeleteWebhookError {
pub fn from_response(res: BufferedHttpResponse) -> DeleteWebhookError {
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 {
"ValidationException" => {
return DeleteWebhookError::Validation(error_message.to_string())
}
_ => {}
}
}
return DeleteWebhookError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DeleteWebhookError {
fn from(err: serde_json::error::Error) -> DeleteWebhookError {
DeleteWebhookError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DeleteWebhookError {
fn from(err: CredentialsError) -> DeleteWebhookError {
DeleteWebhookError::Credentials(err)
}
}
impl From<HttpDispatchError> for DeleteWebhookError {
fn from(err: HttpDispatchError) -> DeleteWebhookError {
DeleteWebhookError::HttpDispatch(err)
}
}
impl From<io::Error> for DeleteWebhookError {
fn from(err: io::Error) -> DeleteWebhookError {
DeleteWebhookError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DeleteWebhookError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DeleteWebhookError {
fn description(&self) -> &str {
match *self {
DeleteWebhookError::Validation(ref cause) => cause,
DeleteWebhookError::Credentials(ref err) => err.description(),
DeleteWebhookError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
DeleteWebhookError::ParseError(ref cause) => cause,
DeleteWebhookError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DeregisterWebhookWithThirdPartyError {
WebhookNotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DeregisterWebhookWithThirdPartyError {
pub fn from_response(res: BufferedHttpResponse) -> DeregisterWebhookWithThirdPartyError {
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 {
"WebhookNotFoundException" => {
return DeregisterWebhookWithThirdPartyError::WebhookNotFound(String::from(
error_message,
))
}
"ValidationException" => {
return DeregisterWebhookWithThirdPartyError::Validation(
error_message.to_string(),
)
}
_ => {}
}
}
return DeregisterWebhookWithThirdPartyError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DeregisterWebhookWithThirdPartyError {
fn from(err: serde_json::error::Error) -> DeregisterWebhookWithThirdPartyError {
DeregisterWebhookWithThirdPartyError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DeregisterWebhookWithThirdPartyError {
fn from(err: CredentialsError) -> DeregisterWebhookWithThirdPartyError {
DeregisterWebhookWithThirdPartyError::Credentials(err)
}
}
impl From<HttpDispatchError> for DeregisterWebhookWithThirdPartyError {
fn from(err: HttpDispatchError) -> DeregisterWebhookWithThirdPartyError {
DeregisterWebhookWithThirdPartyError::HttpDispatch(err)
}
}
impl From<io::Error> for DeregisterWebhookWithThirdPartyError {
fn from(err: io::Error) -> DeregisterWebhookWithThirdPartyError {
DeregisterWebhookWithThirdPartyError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DeregisterWebhookWithThirdPartyError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DeregisterWebhookWithThirdPartyError {
fn description(&self) -> &str {
match *self {
DeregisterWebhookWithThirdPartyError::WebhookNotFound(ref cause) => cause,
DeregisterWebhookWithThirdPartyError::Validation(ref cause) => cause,
DeregisterWebhookWithThirdPartyError::Credentials(ref err) => err.description(),
DeregisterWebhookWithThirdPartyError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
DeregisterWebhookWithThirdPartyError::ParseError(ref cause) => cause,
DeregisterWebhookWithThirdPartyError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DisableStageTransitionError {
PipelineNotFound(String),
StageNotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DisableStageTransitionError {
pub fn from_response(res: BufferedHttpResponse) -> DisableStageTransitionError {
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 {
"PipelineNotFoundException" => {
return DisableStageTransitionError::PipelineNotFound(String::from(
error_message,
))
}
"StageNotFoundException" => {
return DisableStageTransitionError::StageNotFound(String::from(error_message))
}
"ValidationException" => {
return DisableStageTransitionError::Validation(error_message.to_string())
}
_ => {}
}
}
return DisableStageTransitionError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DisableStageTransitionError {
fn from(err: serde_json::error::Error) -> DisableStageTransitionError {
DisableStageTransitionError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DisableStageTransitionError {
fn from(err: CredentialsError) -> DisableStageTransitionError {
DisableStageTransitionError::Credentials(err)
}
}
impl From<HttpDispatchError> for DisableStageTransitionError {
fn from(err: HttpDispatchError) -> DisableStageTransitionError {
DisableStageTransitionError::HttpDispatch(err)
}
}
impl From<io::Error> for DisableStageTransitionError {
fn from(err: io::Error) -> DisableStageTransitionError {
DisableStageTransitionError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DisableStageTransitionError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DisableStageTransitionError {
fn description(&self) -> &str {
match *self {
DisableStageTransitionError::PipelineNotFound(ref cause) => cause,
DisableStageTransitionError::StageNotFound(ref cause) => cause,
DisableStageTransitionError::Validation(ref cause) => cause,
DisableStageTransitionError::Credentials(ref err) => err.description(),
DisableStageTransitionError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
DisableStageTransitionError::ParseError(ref cause) => cause,
DisableStageTransitionError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum EnableStageTransitionError {
PipelineNotFound(String),
StageNotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl EnableStageTransitionError {
pub fn from_response(res: BufferedHttpResponse) -> EnableStageTransitionError {
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 {
"PipelineNotFoundException" => {
return EnableStageTransitionError::PipelineNotFound(String::from(error_message))
}
"StageNotFoundException" => {
return EnableStageTransitionError::StageNotFound(String::from(error_message))
}
"ValidationException" => {
return EnableStageTransitionError::Validation(error_message.to_string())
}
_ => {}
}
}
return EnableStageTransitionError::Unknown(res);
}
}
impl From<serde_json::error::Error> for EnableStageTransitionError {
fn from(err: serde_json::error::Error) -> EnableStageTransitionError {
EnableStageTransitionError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for EnableStageTransitionError {
fn from(err: CredentialsError) -> EnableStageTransitionError {
EnableStageTransitionError::Credentials(err)
}
}
impl From<HttpDispatchError> for EnableStageTransitionError {
fn from(err: HttpDispatchError) -> EnableStageTransitionError {
EnableStageTransitionError::HttpDispatch(err)
}
}
impl From<io::Error> for EnableStageTransitionError {
fn from(err: io::Error) -> EnableStageTransitionError {
EnableStageTransitionError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for EnableStageTransitionError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for EnableStageTransitionError {
fn description(&self) -> &str {
match *self {
EnableStageTransitionError::PipelineNotFound(ref cause) => cause,
EnableStageTransitionError::StageNotFound(ref cause) => cause,
EnableStageTransitionError::Validation(ref cause) => cause,
EnableStageTransitionError::Credentials(ref err) => err.description(),
EnableStageTransitionError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
EnableStageTransitionError::ParseError(ref cause) => cause,
EnableStageTransitionError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetJobDetailsError {
JobNotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetJobDetailsError {
pub fn from_response(res: BufferedHttpResponse) -> GetJobDetailsError {
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 {
"JobNotFoundException" => {
return GetJobDetailsError::JobNotFound(String::from(error_message))
}
"ValidationException" => {
return GetJobDetailsError::Validation(error_message.to_string())
}
_ => {}
}
}
return GetJobDetailsError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetJobDetailsError {
fn from(err: serde_json::error::Error) -> GetJobDetailsError {
GetJobDetailsError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetJobDetailsError {
fn from(err: CredentialsError) -> GetJobDetailsError {
GetJobDetailsError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetJobDetailsError {
fn from(err: HttpDispatchError) -> GetJobDetailsError {
GetJobDetailsError::HttpDispatch(err)
}
}
impl From<io::Error> for GetJobDetailsError {
fn from(err: io::Error) -> GetJobDetailsError {
GetJobDetailsError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetJobDetailsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetJobDetailsError {
fn description(&self) -> &str {
match *self {
GetJobDetailsError::JobNotFound(ref cause) => cause,
GetJobDetailsError::Validation(ref cause) => cause,
GetJobDetailsError::Credentials(ref err) => err.description(),
GetJobDetailsError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
GetJobDetailsError::ParseError(ref cause) => cause,
GetJobDetailsError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetPipelineError {
PipelineNotFound(String),
PipelineVersionNotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetPipelineError {
pub fn from_response(res: BufferedHttpResponse) -> GetPipelineError {
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 {
"PipelineNotFoundException" => {
return GetPipelineError::PipelineNotFound(String::from(error_message))
}
"PipelineVersionNotFoundException" => {
return GetPipelineError::PipelineVersionNotFound(String::from(error_message))
}
"ValidationException" => {
return GetPipelineError::Validation(error_message.to_string())
}
_ => {}
}
}
return GetPipelineError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetPipelineError {
fn from(err: serde_json::error::Error) -> GetPipelineError {
GetPipelineError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetPipelineError {
fn from(err: CredentialsError) -> GetPipelineError {
GetPipelineError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetPipelineError {
fn from(err: HttpDispatchError) -> GetPipelineError {
GetPipelineError::HttpDispatch(err)
}
}
impl From<io::Error> for GetPipelineError {
fn from(err: io::Error) -> GetPipelineError {
GetPipelineError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetPipelineError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetPipelineError {
fn description(&self) -> &str {
match *self {
GetPipelineError::PipelineNotFound(ref cause) => cause,
GetPipelineError::PipelineVersionNotFound(ref cause) => cause,
GetPipelineError::Validation(ref cause) => cause,
GetPipelineError::Credentials(ref err) => err.description(),
GetPipelineError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
GetPipelineError::ParseError(ref cause) => cause,
GetPipelineError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetPipelineExecutionError {
PipelineExecutionNotFound(String),
PipelineNotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetPipelineExecutionError {
pub fn from_response(res: BufferedHttpResponse) -> GetPipelineExecutionError {
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 {
"PipelineExecutionNotFoundException" => {
return GetPipelineExecutionError::PipelineExecutionNotFound(String::from(
error_message,
))
}
"PipelineNotFoundException" => {
return GetPipelineExecutionError::PipelineNotFound(String::from(error_message))
}
"ValidationException" => {
return GetPipelineExecutionError::Validation(error_message.to_string())
}
_ => {}
}
}
return GetPipelineExecutionError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetPipelineExecutionError {
fn from(err: serde_json::error::Error) -> GetPipelineExecutionError {
GetPipelineExecutionError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetPipelineExecutionError {
fn from(err: CredentialsError) -> GetPipelineExecutionError {
GetPipelineExecutionError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetPipelineExecutionError {
fn from(err: HttpDispatchError) -> GetPipelineExecutionError {
GetPipelineExecutionError::HttpDispatch(err)
}
}
impl From<io::Error> for GetPipelineExecutionError {
fn from(err: io::Error) -> GetPipelineExecutionError {
GetPipelineExecutionError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetPipelineExecutionError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetPipelineExecutionError {
fn description(&self) -> &str {
match *self {
GetPipelineExecutionError::PipelineExecutionNotFound(ref cause) => cause,
GetPipelineExecutionError::PipelineNotFound(ref cause) => cause,
GetPipelineExecutionError::Validation(ref cause) => cause,
GetPipelineExecutionError::Credentials(ref err) => err.description(),
GetPipelineExecutionError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
GetPipelineExecutionError::ParseError(ref cause) => cause,
GetPipelineExecutionError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetPipelineStateError {
PipelineNotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetPipelineStateError {
pub fn from_response(res: BufferedHttpResponse) -> GetPipelineStateError {
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 {
"PipelineNotFoundException" => {
return GetPipelineStateError::PipelineNotFound(String::from(error_message))
}
"ValidationException" => {
return GetPipelineStateError::Validation(error_message.to_string())
}
_ => {}
}
}
return GetPipelineStateError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetPipelineStateError {
fn from(err: serde_json::error::Error) -> GetPipelineStateError {
GetPipelineStateError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetPipelineStateError {
fn from(err: CredentialsError) -> GetPipelineStateError {
GetPipelineStateError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetPipelineStateError {
fn from(err: HttpDispatchError) -> GetPipelineStateError {
GetPipelineStateError::HttpDispatch(err)
}
}
impl From<io::Error> for GetPipelineStateError {
fn from(err: io::Error) -> GetPipelineStateError {
GetPipelineStateError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetPipelineStateError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetPipelineStateError {
fn description(&self) -> &str {
match *self {
GetPipelineStateError::PipelineNotFound(ref cause) => cause,
GetPipelineStateError::Validation(ref cause) => cause,
GetPipelineStateError::Credentials(ref err) => err.description(),
GetPipelineStateError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
GetPipelineStateError::ParseError(ref cause) => cause,
GetPipelineStateError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetThirdPartyJobDetailsError {
InvalidClientToken(String),
InvalidJob(String),
JobNotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetThirdPartyJobDetailsError {
pub fn from_response(res: BufferedHttpResponse) -> GetThirdPartyJobDetailsError {
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 {
"InvalidClientTokenException" => {
return GetThirdPartyJobDetailsError::InvalidClientToken(String::from(
error_message,
))
}
"InvalidJobException" => {
return GetThirdPartyJobDetailsError::InvalidJob(String::from(error_message))
}
"JobNotFoundException" => {
return GetThirdPartyJobDetailsError::JobNotFound(String::from(error_message))
}
"ValidationException" => {
return GetThirdPartyJobDetailsError::Validation(error_message.to_string())
}
_ => {}
}
}
return GetThirdPartyJobDetailsError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetThirdPartyJobDetailsError {
fn from(err: serde_json::error::Error) -> GetThirdPartyJobDetailsError {
GetThirdPartyJobDetailsError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetThirdPartyJobDetailsError {
fn from(err: CredentialsError) -> GetThirdPartyJobDetailsError {
GetThirdPartyJobDetailsError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetThirdPartyJobDetailsError {
fn from(err: HttpDispatchError) -> GetThirdPartyJobDetailsError {
GetThirdPartyJobDetailsError::HttpDispatch(err)
}
}
impl From<io::Error> for GetThirdPartyJobDetailsError {
fn from(err: io::Error) -> GetThirdPartyJobDetailsError {
GetThirdPartyJobDetailsError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetThirdPartyJobDetailsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetThirdPartyJobDetailsError {
fn description(&self) -> &str {
match *self {
GetThirdPartyJobDetailsError::InvalidClientToken(ref cause) => cause,
GetThirdPartyJobDetailsError::InvalidJob(ref cause) => cause,
GetThirdPartyJobDetailsError::JobNotFound(ref cause) => cause,
GetThirdPartyJobDetailsError::Validation(ref cause) => cause,
GetThirdPartyJobDetailsError::Credentials(ref err) => err.description(),
GetThirdPartyJobDetailsError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
GetThirdPartyJobDetailsError::ParseError(ref cause) => cause,
GetThirdPartyJobDetailsError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListActionTypesError {
InvalidNextToken(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ListActionTypesError {
pub fn from_response(res: BufferedHttpResponse) -> ListActionTypesError {
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 {
"InvalidNextTokenException" => {
return ListActionTypesError::InvalidNextToken(String::from(error_message))
}
"ValidationException" => {
return ListActionTypesError::Validation(error_message.to_string())
}
_ => {}
}
}
return ListActionTypesError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ListActionTypesError {
fn from(err: serde_json::error::Error) -> ListActionTypesError {
ListActionTypesError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ListActionTypesError {
fn from(err: CredentialsError) -> ListActionTypesError {
ListActionTypesError::Credentials(err)
}
}
impl From<HttpDispatchError> for ListActionTypesError {
fn from(err: HttpDispatchError) -> ListActionTypesError {
ListActionTypesError::HttpDispatch(err)
}
}
impl From<io::Error> for ListActionTypesError {
fn from(err: io::Error) -> ListActionTypesError {
ListActionTypesError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ListActionTypesError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListActionTypesError {
fn description(&self) -> &str {
match *self {
ListActionTypesError::InvalidNextToken(ref cause) => cause,
ListActionTypesError::Validation(ref cause) => cause,
ListActionTypesError::Credentials(ref err) => err.description(),
ListActionTypesError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
ListActionTypesError::ParseError(ref cause) => cause,
ListActionTypesError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListPipelineExecutionsError {
InvalidNextToken(String),
PipelineNotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ListPipelineExecutionsError {
pub fn from_response(res: BufferedHttpResponse) -> ListPipelineExecutionsError {
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 {
"InvalidNextTokenException" => {
return ListPipelineExecutionsError::InvalidNextToken(String::from(
error_message,
))
}
"PipelineNotFoundException" => {
return ListPipelineExecutionsError::PipelineNotFound(String::from(
error_message,
))
}
"ValidationException" => {
return ListPipelineExecutionsError::Validation(error_message.to_string())
}
_ => {}
}
}
return ListPipelineExecutionsError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ListPipelineExecutionsError {
fn from(err: serde_json::error::Error) -> ListPipelineExecutionsError {
ListPipelineExecutionsError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ListPipelineExecutionsError {
fn from(err: CredentialsError) -> ListPipelineExecutionsError {
ListPipelineExecutionsError::Credentials(err)
}
}
impl From<HttpDispatchError> for ListPipelineExecutionsError {
fn from(err: HttpDispatchError) -> ListPipelineExecutionsError {
ListPipelineExecutionsError::HttpDispatch(err)
}
}
impl From<io::Error> for ListPipelineExecutionsError {
fn from(err: io::Error) -> ListPipelineExecutionsError {
ListPipelineExecutionsError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ListPipelineExecutionsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListPipelineExecutionsError {
fn description(&self) -> &str {
match *self {
ListPipelineExecutionsError::InvalidNextToken(ref cause) => cause,
ListPipelineExecutionsError::PipelineNotFound(ref cause) => cause,
ListPipelineExecutionsError::Validation(ref cause) => cause,
ListPipelineExecutionsError::Credentials(ref err) => err.description(),
ListPipelineExecutionsError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
ListPipelineExecutionsError::ParseError(ref cause) => cause,
ListPipelineExecutionsError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListPipelinesError {
InvalidNextToken(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ListPipelinesError {
pub fn from_response(res: BufferedHttpResponse) -> ListPipelinesError {
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 {
"InvalidNextTokenException" => {
return ListPipelinesError::InvalidNextToken(String::from(error_message))
}
"ValidationException" => {
return ListPipelinesError::Validation(error_message.to_string())
}
_ => {}
}
}
return ListPipelinesError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ListPipelinesError {
fn from(err: serde_json::error::Error) -> ListPipelinesError {
ListPipelinesError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ListPipelinesError {
fn from(err: CredentialsError) -> ListPipelinesError {
ListPipelinesError::Credentials(err)
}
}
impl From<HttpDispatchError> for ListPipelinesError {
fn from(err: HttpDispatchError) -> ListPipelinesError {
ListPipelinesError::HttpDispatch(err)
}
}
impl From<io::Error> for ListPipelinesError {
fn from(err: io::Error) -> ListPipelinesError {
ListPipelinesError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ListPipelinesError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListPipelinesError {
fn description(&self) -> &str {
match *self {
ListPipelinesError::InvalidNextToken(ref cause) => cause,
ListPipelinesError::Validation(ref cause) => cause,
ListPipelinesError::Credentials(ref err) => err.description(),
ListPipelinesError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
ListPipelinesError::ParseError(ref cause) => cause,
ListPipelinesError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListWebhooksError {
InvalidNextToken(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ListWebhooksError {
pub fn from_response(res: BufferedHttpResponse) -> ListWebhooksError {
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 {
"InvalidNextTokenException" => {
return ListWebhooksError::InvalidNextToken(String::from(error_message))
}
"ValidationException" => {
return ListWebhooksError::Validation(error_message.to_string())
}
_ => {}
}
}
return ListWebhooksError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ListWebhooksError {
fn from(err: serde_json::error::Error) -> ListWebhooksError {
ListWebhooksError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ListWebhooksError {
fn from(err: CredentialsError) -> ListWebhooksError {
ListWebhooksError::Credentials(err)
}
}
impl From<HttpDispatchError> for ListWebhooksError {
fn from(err: HttpDispatchError) -> ListWebhooksError {
ListWebhooksError::HttpDispatch(err)
}
}
impl From<io::Error> for ListWebhooksError {
fn from(err: io::Error) -> ListWebhooksError {
ListWebhooksError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ListWebhooksError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListWebhooksError {
fn description(&self) -> &str {
match *self {
ListWebhooksError::InvalidNextToken(ref cause) => cause,
ListWebhooksError::Validation(ref cause) => cause,
ListWebhooksError::Credentials(ref err) => err.description(),
ListWebhooksError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
ListWebhooksError::ParseError(ref cause) => cause,
ListWebhooksError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum PollForJobsError {
ActionTypeNotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl PollForJobsError {
pub fn from_response(res: BufferedHttpResponse) -> PollForJobsError {
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 {
"ActionTypeNotFoundException" => {
return PollForJobsError::ActionTypeNotFound(String::from(error_message))
}
"ValidationException" => {
return PollForJobsError::Validation(error_message.to_string())
}
_ => {}
}
}
return PollForJobsError::Unknown(res);
}
}
impl From<serde_json::error::Error> for PollForJobsError {
fn from(err: serde_json::error::Error) -> PollForJobsError {
PollForJobsError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for PollForJobsError {
fn from(err: CredentialsError) -> PollForJobsError {
PollForJobsError::Credentials(err)
}
}
impl From<HttpDispatchError> for PollForJobsError {
fn from(err: HttpDispatchError) -> PollForJobsError {
PollForJobsError::HttpDispatch(err)
}
}
impl From<io::Error> for PollForJobsError {
fn from(err: io::Error) -> PollForJobsError {
PollForJobsError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for PollForJobsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for PollForJobsError {
fn description(&self) -> &str {
match *self {
PollForJobsError::ActionTypeNotFound(ref cause) => cause,
PollForJobsError::Validation(ref cause) => cause,
PollForJobsError::Credentials(ref err) => err.description(),
PollForJobsError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
PollForJobsError::ParseError(ref cause) => cause,
PollForJobsError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum PollForThirdPartyJobsError {
ActionTypeNotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl PollForThirdPartyJobsError {
pub fn from_response(res: BufferedHttpResponse) -> PollForThirdPartyJobsError {
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 {
"ActionTypeNotFoundException" => {
return PollForThirdPartyJobsError::ActionTypeNotFound(String::from(
error_message,
))
}
"ValidationException" => {
return PollForThirdPartyJobsError::Validation(error_message.to_string())
}
_ => {}
}
}
return PollForThirdPartyJobsError::Unknown(res);
}
}
impl From<serde_json::error::Error> for PollForThirdPartyJobsError {
fn from(err: serde_json::error::Error) -> PollForThirdPartyJobsError {
PollForThirdPartyJobsError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for PollForThirdPartyJobsError {
fn from(err: CredentialsError) -> PollForThirdPartyJobsError {
PollForThirdPartyJobsError::Credentials(err)
}
}
impl From<HttpDispatchError> for PollForThirdPartyJobsError {
fn from(err: HttpDispatchError) -> PollForThirdPartyJobsError {
PollForThirdPartyJobsError::HttpDispatch(err)
}
}
impl From<io::Error> for PollForThirdPartyJobsError {
fn from(err: io::Error) -> PollForThirdPartyJobsError {
PollForThirdPartyJobsError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for PollForThirdPartyJobsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for PollForThirdPartyJobsError {
fn description(&self) -> &str {
match *self {
PollForThirdPartyJobsError::ActionTypeNotFound(ref cause) => cause,
PollForThirdPartyJobsError::Validation(ref cause) => cause,
PollForThirdPartyJobsError::Credentials(ref err) => err.description(),
PollForThirdPartyJobsError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
PollForThirdPartyJobsError::ParseError(ref cause) => cause,
PollForThirdPartyJobsError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum PutActionRevisionError {
ActionNotFound(String),
PipelineNotFound(String),
StageNotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl PutActionRevisionError {
pub fn from_response(res: BufferedHttpResponse) -> PutActionRevisionError {
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 {
"ActionNotFoundException" => {
return PutActionRevisionError::ActionNotFound(String::from(error_message))
}
"PipelineNotFoundException" => {
return PutActionRevisionError::PipelineNotFound(String::from(error_message))
}
"StageNotFoundException" => {
return PutActionRevisionError::StageNotFound(String::from(error_message))
}
"ValidationException" => {
return PutActionRevisionError::Validation(error_message.to_string())
}
_ => {}
}
}
return PutActionRevisionError::Unknown(res);
}
}
impl From<serde_json::error::Error> for PutActionRevisionError {
fn from(err: serde_json::error::Error) -> PutActionRevisionError {
PutActionRevisionError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for PutActionRevisionError {
fn from(err: CredentialsError) -> PutActionRevisionError {
PutActionRevisionError::Credentials(err)
}
}
impl From<HttpDispatchError> for PutActionRevisionError {
fn from(err: HttpDispatchError) -> PutActionRevisionError {
PutActionRevisionError::HttpDispatch(err)
}
}
impl From<io::Error> for PutActionRevisionError {
fn from(err: io::Error) -> PutActionRevisionError {
PutActionRevisionError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for PutActionRevisionError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for PutActionRevisionError {
fn description(&self) -> &str {
match *self {
PutActionRevisionError::ActionNotFound(ref cause) => cause,
PutActionRevisionError::PipelineNotFound(ref cause) => cause,
PutActionRevisionError::StageNotFound(ref cause) => cause,
PutActionRevisionError::Validation(ref cause) => cause,
PutActionRevisionError::Credentials(ref err) => err.description(),
PutActionRevisionError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
PutActionRevisionError::ParseError(ref cause) => cause,
PutActionRevisionError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum PutApprovalResultError {
ActionNotFound(String),
ApprovalAlreadyCompleted(String),
InvalidApprovalToken(String),
PipelineNotFound(String),
StageNotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl PutApprovalResultError {
pub fn from_response(res: BufferedHttpResponse) -> PutApprovalResultError {
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 {
"ActionNotFoundException" => {
return PutApprovalResultError::ActionNotFound(String::from(error_message))
}
"ApprovalAlreadyCompletedException" => {
return PutApprovalResultError::ApprovalAlreadyCompleted(String::from(
error_message,
))
}
"InvalidApprovalTokenException" => {
return PutApprovalResultError::InvalidApprovalToken(String::from(error_message))
}
"PipelineNotFoundException" => {
return PutApprovalResultError::PipelineNotFound(String::from(error_message))
}
"StageNotFoundException" => {
return PutApprovalResultError::StageNotFound(String::from(error_message))
}
"ValidationException" => {
return PutApprovalResultError::Validation(error_message.to_string())
}
_ => {}
}
}
return PutApprovalResultError::Unknown(res);
}
}
impl From<serde_json::error::Error> for PutApprovalResultError {
fn from(err: serde_json::error::Error) -> PutApprovalResultError {
PutApprovalResultError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for PutApprovalResultError {
fn from(err: CredentialsError) -> PutApprovalResultError {
PutApprovalResultError::Credentials(err)
}
}
impl From<HttpDispatchError> for PutApprovalResultError {
fn from(err: HttpDispatchError) -> PutApprovalResultError {
PutApprovalResultError::HttpDispatch(err)
}
}
impl From<io::Error> for PutApprovalResultError {
fn from(err: io::Error) -> PutApprovalResultError {
PutApprovalResultError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for PutApprovalResultError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for PutApprovalResultError {
fn description(&self) -> &str {
match *self {
PutApprovalResultError::ActionNotFound(ref cause) => cause,
PutApprovalResultError::ApprovalAlreadyCompleted(ref cause) => cause,
PutApprovalResultError::InvalidApprovalToken(ref cause) => cause,
PutApprovalResultError::PipelineNotFound(ref cause) => cause,
PutApprovalResultError::StageNotFound(ref cause) => cause,
PutApprovalResultError::Validation(ref cause) => cause,
PutApprovalResultError::Credentials(ref err) => err.description(),
PutApprovalResultError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
PutApprovalResultError::ParseError(ref cause) => cause,
PutApprovalResultError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum PutJobFailureResultError {
InvalidJobState(String),
JobNotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl PutJobFailureResultError {
pub fn from_response(res: BufferedHttpResponse) -> PutJobFailureResultError {
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 {
"InvalidJobStateException" => {
return PutJobFailureResultError::InvalidJobState(String::from(error_message))
}
"JobNotFoundException" => {
return PutJobFailureResultError::JobNotFound(String::from(error_message))
}
"ValidationException" => {
return PutJobFailureResultError::Validation(error_message.to_string())
}
_ => {}
}
}
return PutJobFailureResultError::Unknown(res);
}
}
impl From<serde_json::error::Error> for PutJobFailureResultError {
fn from(err: serde_json::error::Error) -> PutJobFailureResultError {
PutJobFailureResultError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for PutJobFailureResultError {
fn from(err: CredentialsError) -> PutJobFailureResultError {
PutJobFailureResultError::Credentials(err)
}
}
impl From<HttpDispatchError> for PutJobFailureResultError {
fn from(err: HttpDispatchError) -> PutJobFailureResultError {
PutJobFailureResultError::HttpDispatch(err)
}
}
impl From<io::Error> for PutJobFailureResultError {
fn from(err: io::Error) -> PutJobFailureResultError {
PutJobFailureResultError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for PutJobFailureResultError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for PutJobFailureResultError {
fn description(&self) -> &str {
match *self {
PutJobFailureResultError::InvalidJobState(ref cause) => cause,
PutJobFailureResultError::JobNotFound(ref cause) => cause,
PutJobFailureResultError::Validation(ref cause) => cause,
PutJobFailureResultError::Credentials(ref err) => err.description(),
PutJobFailureResultError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
PutJobFailureResultError::ParseError(ref cause) => cause,
PutJobFailureResultError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum PutJobSuccessResultError {
InvalidJobState(String),
JobNotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl PutJobSuccessResultError {
pub fn from_response(res: BufferedHttpResponse) -> PutJobSuccessResultError {
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 {
"InvalidJobStateException" => {
return PutJobSuccessResultError::InvalidJobState(String::from(error_message))
}
"JobNotFoundException" => {
return PutJobSuccessResultError::JobNotFound(String::from(error_message))
}
"ValidationException" => {
return PutJobSuccessResultError::Validation(error_message.to_string())
}
_ => {}
}
}
return PutJobSuccessResultError::Unknown(res);
}
}
impl From<serde_json::error::Error> for PutJobSuccessResultError {
fn from(err: serde_json::error::Error) -> PutJobSuccessResultError {
PutJobSuccessResultError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for PutJobSuccessResultError {
fn from(err: CredentialsError) -> PutJobSuccessResultError {
PutJobSuccessResultError::Credentials(err)
}
}
impl From<HttpDispatchError> for PutJobSuccessResultError {
fn from(err: HttpDispatchError) -> PutJobSuccessResultError {
PutJobSuccessResultError::HttpDispatch(err)
}
}
impl From<io::Error> for PutJobSuccessResultError {
fn from(err: io::Error) -> PutJobSuccessResultError {
PutJobSuccessResultError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for PutJobSuccessResultError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for PutJobSuccessResultError {
fn description(&self) -> &str {
match *self {
PutJobSuccessResultError::InvalidJobState(ref cause) => cause,
PutJobSuccessResultError::JobNotFound(ref cause) => cause,
PutJobSuccessResultError::Validation(ref cause) => cause,
PutJobSuccessResultError::Credentials(ref err) => err.description(),
PutJobSuccessResultError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
PutJobSuccessResultError::ParseError(ref cause) => cause,
PutJobSuccessResultError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum PutThirdPartyJobFailureResultError {
InvalidClientToken(String),
InvalidJobState(String),
JobNotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl PutThirdPartyJobFailureResultError {
pub fn from_response(res: BufferedHttpResponse) -> PutThirdPartyJobFailureResultError {
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 {
"InvalidClientTokenException" => {
return PutThirdPartyJobFailureResultError::InvalidClientToken(String::from(
error_message,
))
}
"InvalidJobStateException" => {
return PutThirdPartyJobFailureResultError::InvalidJobState(String::from(
error_message,
))
}
"JobNotFoundException" => {
return PutThirdPartyJobFailureResultError::JobNotFound(String::from(
error_message,
))
}
"ValidationException" => {
return PutThirdPartyJobFailureResultError::Validation(error_message.to_string())
}
_ => {}
}
}
return PutThirdPartyJobFailureResultError::Unknown(res);
}
}
impl From<serde_json::error::Error> for PutThirdPartyJobFailureResultError {
fn from(err: serde_json::error::Error) -> PutThirdPartyJobFailureResultError {
PutThirdPartyJobFailureResultError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for PutThirdPartyJobFailureResultError {
fn from(err: CredentialsError) -> PutThirdPartyJobFailureResultError {
PutThirdPartyJobFailureResultError::Credentials(err)
}
}
impl From<HttpDispatchError> for PutThirdPartyJobFailureResultError {
fn from(err: HttpDispatchError) -> PutThirdPartyJobFailureResultError {
PutThirdPartyJobFailureResultError::HttpDispatch(err)
}
}
impl From<io::Error> for PutThirdPartyJobFailureResultError {
fn from(err: io::Error) -> PutThirdPartyJobFailureResultError {
PutThirdPartyJobFailureResultError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for PutThirdPartyJobFailureResultError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for PutThirdPartyJobFailureResultError {
fn description(&self) -> &str {
match *self {
PutThirdPartyJobFailureResultError::InvalidClientToken(ref cause) => cause,
PutThirdPartyJobFailureResultError::InvalidJobState(ref cause) => cause,
PutThirdPartyJobFailureResultError::JobNotFound(ref cause) => cause,
PutThirdPartyJobFailureResultError::Validation(ref cause) => cause,
PutThirdPartyJobFailureResultError::Credentials(ref err) => err.description(),
PutThirdPartyJobFailureResultError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
PutThirdPartyJobFailureResultError::ParseError(ref cause) => cause,
PutThirdPartyJobFailureResultError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum PutThirdPartyJobSuccessResultError {
InvalidClientToken(String),
InvalidJobState(String),
JobNotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl PutThirdPartyJobSuccessResultError {
pub fn from_response(res: BufferedHttpResponse) -> PutThirdPartyJobSuccessResultError {
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 {
"InvalidClientTokenException" => {
return PutThirdPartyJobSuccessResultError::InvalidClientToken(String::from(
error_message,
))
}
"InvalidJobStateException" => {
return PutThirdPartyJobSuccessResultError::InvalidJobState(String::from(
error_message,
))
}
"JobNotFoundException" => {
return PutThirdPartyJobSuccessResultError::JobNotFound(String::from(
error_message,
))
}
"ValidationException" => {
return PutThirdPartyJobSuccessResultError::Validation(error_message.to_string())
}
_ => {}
}
}
return PutThirdPartyJobSuccessResultError::Unknown(res);
}
}
impl From<serde_json::error::Error> for PutThirdPartyJobSuccessResultError {
fn from(err: serde_json::error::Error) -> PutThirdPartyJobSuccessResultError {
PutThirdPartyJobSuccessResultError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for PutThirdPartyJobSuccessResultError {
fn from(err: CredentialsError) -> PutThirdPartyJobSuccessResultError {
PutThirdPartyJobSuccessResultError::Credentials(err)
}
}
impl From<HttpDispatchError> for PutThirdPartyJobSuccessResultError {
fn from(err: HttpDispatchError) -> PutThirdPartyJobSuccessResultError {
PutThirdPartyJobSuccessResultError::HttpDispatch(err)
}
}
impl From<io::Error> for PutThirdPartyJobSuccessResultError {
fn from(err: io::Error) -> PutThirdPartyJobSuccessResultError {
PutThirdPartyJobSuccessResultError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for PutThirdPartyJobSuccessResultError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for PutThirdPartyJobSuccessResultError {
fn description(&self) -> &str {
match *self {
PutThirdPartyJobSuccessResultError::InvalidClientToken(ref cause) => cause,
PutThirdPartyJobSuccessResultError::InvalidJobState(ref cause) => cause,
PutThirdPartyJobSuccessResultError::JobNotFound(ref cause) => cause,
PutThirdPartyJobSuccessResultError::Validation(ref cause) => cause,
PutThirdPartyJobSuccessResultError::Credentials(ref err) => err.description(),
PutThirdPartyJobSuccessResultError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
PutThirdPartyJobSuccessResultError::ParseError(ref cause) => cause,
PutThirdPartyJobSuccessResultError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum PutWebhookError {
InvalidWebhookAuthenticationParameters(String),
InvalidWebhookFilterPattern(String),
LimitExceeded(String),
PipelineNotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl PutWebhookError {
pub fn from_response(res: BufferedHttpResponse) -> PutWebhookError {
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 {
"InvalidWebhookAuthenticationParametersException" => {
return PutWebhookError::InvalidWebhookAuthenticationParameters(String::from(
error_message,
))
}
"InvalidWebhookFilterPatternException" => {
return PutWebhookError::InvalidWebhookFilterPattern(String::from(error_message))
}
"LimitExceededException" => {
return PutWebhookError::LimitExceeded(String::from(error_message))
}
"PipelineNotFoundException" => {
return PutWebhookError::PipelineNotFound(String::from(error_message))
}
"ValidationException" => {
return PutWebhookError::Validation(error_message.to_string())
}
_ => {}
}
}
return PutWebhookError::Unknown(res);
}
}
impl From<serde_json::error::Error> for PutWebhookError {
fn from(err: serde_json::error::Error) -> PutWebhookError {
PutWebhookError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for PutWebhookError {
fn from(err: CredentialsError) -> PutWebhookError {
PutWebhookError::Credentials(err)
}
}
impl From<HttpDispatchError> for PutWebhookError {
fn from(err: HttpDispatchError) -> PutWebhookError {
PutWebhookError::HttpDispatch(err)
}
}
impl From<io::Error> for PutWebhookError {
fn from(err: io::Error) -> PutWebhookError {
PutWebhookError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for PutWebhookError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for PutWebhookError {
fn description(&self) -> &str {
match *self {
PutWebhookError::InvalidWebhookAuthenticationParameters(ref cause) => cause,
PutWebhookError::InvalidWebhookFilterPattern(ref cause) => cause,
PutWebhookError::LimitExceeded(ref cause) => cause,
PutWebhookError::PipelineNotFound(ref cause) => cause,
PutWebhookError::Validation(ref cause) => cause,
PutWebhookError::Credentials(ref err) => err.description(),
PutWebhookError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
PutWebhookError::ParseError(ref cause) => cause,
PutWebhookError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum RegisterWebhookWithThirdPartyError {
WebhookNotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl RegisterWebhookWithThirdPartyError {
pub fn from_response(res: BufferedHttpResponse) -> RegisterWebhookWithThirdPartyError {
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 {
"WebhookNotFoundException" => {
return RegisterWebhookWithThirdPartyError::WebhookNotFound(String::from(
error_message,
))
}
"ValidationException" => {
return RegisterWebhookWithThirdPartyError::Validation(error_message.to_string())
}
_ => {}
}
}
return RegisterWebhookWithThirdPartyError::Unknown(res);
}
}
impl From<serde_json::error::Error> for RegisterWebhookWithThirdPartyError {
fn from(err: serde_json::error::Error) -> RegisterWebhookWithThirdPartyError {
RegisterWebhookWithThirdPartyError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for RegisterWebhookWithThirdPartyError {
fn from(err: CredentialsError) -> RegisterWebhookWithThirdPartyError {
RegisterWebhookWithThirdPartyError::Credentials(err)
}
}
impl From<HttpDispatchError> for RegisterWebhookWithThirdPartyError {
fn from(err: HttpDispatchError) -> RegisterWebhookWithThirdPartyError {
RegisterWebhookWithThirdPartyError::HttpDispatch(err)
}
}
impl From<io::Error> for RegisterWebhookWithThirdPartyError {
fn from(err: io::Error) -> RegisterWebhookWithThirdPartyError {
RegisterWebhookWithThirdPartyError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for RegisterWebhookWithThirdPartyError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for RegisterWebhookWithThirdPartyError {
fn description(&self) -> &str {
match *self {
RegisterWebhookWithThirdPartyError::WebhookNotFound(ref cause) => cause,
RegisterWebhookWithThirdPartyError::Validation(ref cause) => cause,
RegisterWebhookWithThirdPartyError::Credentials(ref err) => err.description(),
RegisterWebhookWithThirdPartyError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
RegisterWebhookWithThirdPartyError::ParseError(ref cause) => cause,
RegisterWebhookWithThirdPartyError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum RetryStageExecutionError {
NotLatestPipelineExecution(String),
PipelineNotFound(String),
StageNotFound(String),
StageNotRetryable(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl RetryStageExecutionError {
pub fn from_response(res: BufferedHttpResponse) -> RetryStageExecutionError {
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 {
"NotLatestPipelineExecutionException" => {
return RetryStageExecutionError::NotLatestPipelineExecution(String::from(
error_message,
))
}
"PipelineNotFoundException" => {
return RetryStageExecutionError::PipelineNotFound(String::from(error_message))
}
"StageNotFoundException" => {
return RetryStageExecutionError::StageNotFound(String::from(error_message))
}
"StageNotRetryableException" => {
return RetryStageExecutionError::StageNotRetryable(String::from(error_message))
}
"ValidationException" => {
return RetryStageExecutionError::Validation(error_message.to_string())
}
_ => {}
}
}
return RetryStageExecutionError::Unknown(res);
}
}
impl From<serde_json::error::Error> for RetryStageExecutionError {
fn from(err: serde_json::error::Error) -> RetryStageExecutionError {
RetryStageExecutionError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for RetryStageExecutionError {
fn from(err: CredentialsError) -> RetryStageExecutionError {
RetryStageExecutionError::Credentials(err)
}
}
impl From<HttpDispatchError> for RetryStageExecutionError {
fn from(err: HttpDispatchError) -> RetryStageExecutionError {
RetryStageExecutionError::HttpDispatch(err)
}
}
impl From<io::Error> for RetryStageExecutionError {
fn from(err: io::Error) -> RetryStageExecutionError {
RetryStageExecutionError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for RetryStageExecutionError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for RetryStageExecutionError {
fn description(&self) -> &str {
match *self {
RetryStageExecutionError::NotLatestPipelineExecution(ref cause) => cause,
RetryStageExecutionError::PipelineNotFound(ref cause) => cause,
RetryStageExecutionError::StageNotFound(ref cause) => cause,
RetryStageExecutionError::StageNotRetryable(ref cause) => cause,
RetryStageExecutionError::Validation(ref cause) => cause,
RetryStageExecutionError::Credentials(ref err) => err.description(),
RetryStageExecutionError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
RetryStageExecutionError::ParseError(ref cause) => cause,
RetryStageExecutionError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum StartPipelineExecutionError {
PipelineNotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl StartPipelineExecutionError {
pub fn from_response(res: BufferedHttpResponse) -> StartPipelineExecutionError {
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 {
"PipelineNotFoundException" => {
return StartPipelineExecutionError::PipelineNotFound(String::from(
error_message,
))
}
"ValidationException" => {
return StartPipelineExecutionError::Validation(error_message.to_string())
}
_ => {}
}
}
return StartPipelineExecutionError::Unknown(res);
}
}
impl From<serde_json::error::Error> for StartPipelineExecutionError {
fn from(err: serde_json::error::Error) -> StartPipelineExecutionError {
StartPipelineExecutionError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for StartPipelineExecutionError {
fn from(err: CredentialsError) -> StartPipelineExecutionError {
StartPipelineExecutionError::Credentials(err)
}
}
impl From<HttpDispatchError> for StartPipelineExecutionError {
fn from(err: HttpDispatchError) -> StartPipelineExecutionError {
StartPipelineExecutionError::HttpDispatch(err)
}
}
impl From<io::Error> for StartPipelineExecutionError {
fn from(err: io::Error) -> StartPipelineExecutionError {
StartPipelineExecutionError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for StartPipelineExecutionError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for StartPipelineExecutionError {
fn description(&self) -> &str {
match *self {
StartPipelineExecutionError::PipelineNotFound(ref cause) => cause,
StartPipelineExecutionError::Validation(ref cause) => cause,
StartPipelineExecutionError::Credentials(ref err) => err.description(),
StartPipelineExecutionError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
StartPipelineExecutionError::ParseError(ref cause) => cause,
StartPipelineExecutionError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum UpdatePipelineError {
InvalidActionDeclaration(String),
InvalidBlockerDeclaration(String),
InvalidStageDeclaration(String),
InvalidStructure(String),
LimitExceeded(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl UpdatePipelineError {
pub fn from_response(res: BufferedHttpResponse) -> UpdatePipelineError {
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 {
"InvalidActionDeclarationException" => {
return UpdatePipelineError::InvalidActionDeclaration(String::from(
error_message,
))
}
"InvalidBlockerDeclarationException" => {
return UpdatePipelineError::InvalidBlockerDeclaration(String::from(
error_message,
))
}
"InvalidStageDeclarationException" => {
return UpdatePipelineError::InvalidStageDeclaration(String::from(error_message))
}
"InvalidStructureException" => {
return UpdatePipelineError::InvalidStructure(String::from(error_message))
}
"LimitExceededException" => {
return UpdatePipelineError::LimitExceeded(String::from(error_message))
}
"ValidationException" => {
return UpdatePipelineError::Validation(error_message.to_string())
}
_ => {}
}
}
return UpdatePipelineError::Unknown(res);
}
}
impl From<serde_json::error::Error> for UpdatePipelineError {
fn from(err: serde_json::error::Error) -> UpdatePipelineError {
UpdatePipelineError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for UpdatePipelineError {
fn from(err: CredentialsError) -> UpdatePipelineError {
UpdatePipelineError::Credentials(err)
}
}
impl From<HttpDispatchError> for UpdatePipelineError {
fn from(err: HttpDispatchError) -> UpdatePipelineError {
UpdatePipelineError::HttpDispatch(err)
}
}
impl From<io::Error> for UpdatePipelineError {
fn from(err: io::Error) -> UpdatePipelineError {
UpdatePipelineError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for UpdatePipelineError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for UpdatePipelineError {
fn description(&self) -> &str {
match *self {
UpdatePipelineError::InvalidActionDeclaration(ref cause) => cause,
UpdatePipelineError::InvalidBlockerDeclaration(ref cause) => cause,
UpdatePipelineError::InvalidStageDeclaration(ref cause) => cause,
UpdatePipelineError::InvalidStructure(ref cause) => cause,
UpdatePipelineError::LimitExceeded(ref cause) => cause,
UpdatePipelineError::Validation(ref cause) => cause,
UpdatePipelineError::Credentials(ref err) => err.description(),
UpdatePipelineError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
UpdatePipelineError::ParseError(ref cause) => cause,
UpdatePipelineError::Unknown(_) => "unknown error",
}
}
}
pub trait CodePipeline {
fn acknowledge_job(
&self,
input: AcknowledgeJobInput,
) -> RusotoFuture<AcknowledgeJobOutput, AcknowledgeJobError>;
fn acknowledge_third_party_job(
&self,
input: AcknowledgeThirdPartyJobInput,
) -> RusotoFuture<AcknowledgeThirdPartyJobOutput, AcknowledgeThirdPartyJobError>;
fn create_custom_action_type(
&self,
input: CreateCustomActionTypeInput,
) -> RusotoFuture<CreateCustomActionTypeOutput, CreateCustomActionTypeError>;
fn create_pipeline(
&self,
input: CreatePipelineInput,
) -> RusotoFuture<CreatePipelineOutput, CreatePipelineError>;
fn delete_custom_action_type(
&self,
input: DeleteCustomActionTypeInput,
) -> RusotoFuture<(), DeleteCustomActionTypeError>;
fn delete_pipeline(&self, input: DeletePipelineInput) -> RusotoFuture<(), DeletePipelineError>;
fn delete_webhook(
&self,
input: DeleteWebhookInput,
) -> RusotoFuture<DeleteWebhookOutput, DeleteWebhookError>;
fn deregister_webhook_with_third_party(
&self,
input: DeregisterWebhookWithThirdPartyInput,
) -> RusotoFuture<DeregisterWebhookWithThirdPartyOutput, DeregisterWebhookWithThirdPartyError>;
fn disable_stage_transition(
&self,
input: DisableStageTransitionInput,
) -> RusotoFuture<(), DisableStageTransitionError>;
fn enable_stage_transition(
&self,
input: EnableStageTransitionInput,
) -> RusotoFuture<(), EnableStageTransitionError>;
fn get_job_details(
&self,
input: GetJobDetailsInput,
) -> RusotoFuture<GetJobDetailsOutput, GetJobDetailsError>;
fn get_pipeline(
&self,
input: GetPipelineInput,
) -> RusotoFuture<GetPipelineOutput, GetPipelineError>;
fn get_pipeline_execution(
&self,
input: GetPipelineExecutionInput,
) -> RusotoFuture<GetPipelineExecutionOutput, GetPipelineExecutionError>;
fn get_pipeline_state(
&self,
input: GetPipelineStateInput,
) -> RusotoFuture<GetPipelineStateOutput, GetPipelineStateError>;
fn get_third_party_job_details(
&self,
input: GetThirdPartyJobDetailsInput,
) -> RusotoFuture<GetThirdPartyJobDetailsOutput, GetThirdPartyJobDetailsError>;
fn list_action_types(
&self,
input: ListActionTypesInput,
) -> RusotoFuture<ListActionTypesOutput, ListActionTypesError>;
fn list_pipeline_executions(
&self,
input: ListPipelineExecutionsInput,
) -> RusotoFuture<ListPipelineExecutionsOutput, ListPipelineExecutionsError>;
fn list_pipelines(
&self,
input: ListPipelinesInput,
) -> RusotoFuture<ListPipelinesOutput, ListPipelinesError>;
fn list_webhooks(
&self,
input: ListWebhooksInput,
) -> RusotoFuture<ListWebhooksOutput, ListWebhooksError>;
fn poll_for_jobs(
&self,
input: PollForJobsInput,
) -> RusotoFuture<PollForJobsOutput, PollForJobsError>;
fn poll_for_third_party_jobs(
&self,
input: PollForThirdPartyJobsInput,
) -> RusotoFuture<PollForThirdPartyJobsOutput, PollForThirdPartyJobsError>;
fn put_action_revision(
&self,
input: PutActionRevisionInput,
) -> RusotoFuture<PutActionRevisionOutput, PutActionRevisionError>;
fn put_approval_result(
&self,
input: PutApprovalResultInput,
) -> RusotoFuture<PutApprovalResultOutput, PutApprovalResultError>;
fn put_job_failure_result(
&self,
input: PutJobFailureResultInput,
) -> RusotoFuture<(), PutJobFailureResultError>;
fn put_job_success_result(
&self,
input: PutJobSuccessResultInput,
) -> RusotoFuture<(), PutJobSuccessResultError>;
fn put_third_party_job_failure_result(
&self,
input: PutThirdPartyJobFailureResultInput,
) -> RusotoFuture<(), PutThirdPartyJobFailureResultError>;
fn put_third_party_job_success_result(
&self,
input: PutThirdPartyJobSuccessResultInput,
) -> RusotoFuture<(), PutThirdPartyJobSuccessResultError>;
fn put_webhook(
&self,
input: PutWebhookInput,
) -> RusotoFuture<PutWebhookOutput, PutWebhookError>;
fn register_webhook_with_third_party(
&self,
input: RegisterWebhookWithThirdPartyInput,
) -> RusotoFuture<RegisterWebhookWithThirdPartyOutput, RegisterWebhookWithThirdPartyError>;
fn retry_stage_execution(
&self,
input: RetryStageExecutionInput,
) -> RusotoFuture<RetryStageExecutionOutput, RetryStageExecutionError>;
fn start_pipeline_execution(
&self,
input: StartPipelineExecutionInput,
) -> RusotoFuture<StartPipelineExecutionOutput, StartPipelineExecutionError>;
fn update_pipeline(
&self,
input: UpdatePipelineInput,
) -> RusotoFuture<UpdatePipelineOutput, UpdatePipelineError>;
}
pub struct CodePipelineClient {
client: Client,
region: region::Region,
}
impl CodePipelineClient {
pub fn new(region: region::Region) -> CodePipelineClient {
CodePipelineClient {
client: Client::shared(),
region: region,
}
}
pub fn new_with<P, D>(
request_dispatcher: D,
credentials_provider: P,
region: region::Region,
) -> CodePipelineClient
where
P: ProvideAwsCredentials + Send + Sync + 'static,
P::Future: Send,
D: DispatchSignedRequest + Send + Sync + 'static,
D::Future: Send,
{
CodePipelineClient {
client: Client::new_with(credentials_provider, request_dispatcher),
region: region,
}
}
}
impl CodePipeline for CodePipelineClient {
fn acknowledge_job(
&self,
input: AcknowledgeJobInput,
) -> RusotoFuture<AcknowledgeJobOutput, AcknowledgeJobError> {
let mut request = SignedRequest::new("POST", "codepipeline", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "CodePipeline_20150709.AcknowledgeJob");
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::<AcknowledgeJobOutput>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(AcknowledgeJobError::from_response(response))),
)
}
})
}
fn acknowledge_third_party_job(
&self,
input: AcknowledgeThirdPartyJobInput,
) -> RusotoFuture<AcknowledgeThirdPartyJobOutput, AcknowledgeThirdPartyJobError> {
let mut request = SignedRequest::new("POST", "codepipeline", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"CodePipeline_20150709.AcknowledgeThirdPartyJob",
);
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::<AcknowledgeThirdPartyJobOutput>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(AcknowledgeThirdPartyJobError::from_response(response))
}))
}
})
}
fn create_custom_action_type(
&self,
input: CreateCustomActionTypeInput,
) -> RusotoFuture<CreateCustomActionTypeOutput, CreateCustomActionTypeError> {
let mut request = SignedRequest::new("POST", "codepipeline", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"CodePipeline_20150709.CreateCustomActionType",
);
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::<CreateCustomActionTypeOutput>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(CreateCustomActionTypeError::from_response(response))
}),
)
}
})
}
fn create_pipeline(
&self,
input: CreatePipelineInput,
) -> RusotoFuture<CreatePipelineOutput, CreatePipelineError> {
let mut request = SignedRequest::new("POST", "codepipeline", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "CodePipeline_20150709.CreatePipeline");
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::<CreatePipelineOutput>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(CreatePipelineError::from_response(response))),
)
}
})
}
fn delete_custom_action_type(
&self,
input: DeleteCustomActionTypeInput,
) -> RusotoFuture<(), DeleteCustomActionTypeError> {
let mut request = SignedRequest::new("POST", "codepipeline", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"CodePipeline_20150709.DeleteCustomActionType",
);
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(future::ok(::std::mem::drop(response)))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(DeleteCustomActionTypeError::from_response(response))
}),
)
}
})
}
fn delete_pipeline(&self, input: DeletePipelineInput) -> RusotoFuture<(), DeletePipelineError> {
let mut request = SignedRequest::new("POST", "codepipeline", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "CodePipeline_20150709.DeletePipeline");
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(future::ok(::std::mem::drop(response)))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(DeletePipelineError::from_response(response))),
)
}
})
}
fn delete_webhook(
&self,
input: DeleteWebhookInput,
) -> RusotoFuture<DeleteWebhookOutput, DeleteWebhookError> {
let mut request = SignedRequest::new("POST", "codepipeline", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "CodePipeline_20150709.DeleteWebhook");
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::<DeleteWebhookOutput>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(DeleteWebhookError::from_response(response))),
)
}
})
}
fn deregister_webhook_with_third_party(
&self,
input: DeregisterWebhookWithThirdPartyInput,
) -> RusotoFuture<DeregisterWebhookWithThirdPartyOutput, DeregisterWebhookWithThirdPartyError>
{
let mut request = SignedRequest::new("POST", "codepipeline", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"CodePipeline_20150709.DeregisterWebhookWithThirdParty",
);
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::<DeregisterWebhookWithThirdPartyOutput>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(DeregisterWebhookWithThirdPartyError::from_response(
response,
))
}))
}
})
}
fn disable_stage_transition(
&self,
input: DisableStageTransitionInput,
) -> RusotoFuture<(), DisableStageTransitionError> {
let mut request = SignedRequest::new("POST", "codepipeline", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"CodePipeline_20150709.DisableStageTransition",
);
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(future::ok(::std::mem::drop(response)))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(DisableStageTransitionError::from_response(response))
}),
)
}
})
}
fn enable_stage_transition(
&self,
input: EnableStageTransitionInput,
) -> RusotoFuture<(), EnableStageTransitionError> {
let mut request = SignedRequest::new("POST", "codepipeline", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"CodePipeline_20150709.EnableStageTransition",
);
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(future::ok(::std::mem::drop(response)))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(EnableStageTransitionError::from_response(response))
}),
)
}
})
}
fn get_job_details(
&self,
input: GetJobDetailsInput,
) -> RusotoFuture<GetJobDetailsOutput, GetJobDetailsError> {
let mut request = SignedRequest::new("POST", "codepipeline", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "CodePipeline_20150709.GetJobDetails");
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::<GetJobDetailsOutput>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(GetJobDetailsError::from_response(response))),
)
}
})
}
fn get_pipeline(
&self,
input: GetPipelineInput,
) -> RusotoFuture<GetPipelineOutput, GetPipelineError> {
let mut request = SignedRequest::new("POST", "codepipeline", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "CodePipeline_20150709.GetPipeline");
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::<GetPipelineOutput>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(GetPipelineError::from_response(response))),
)
}
})
}
fn get_pipeline_execution(
&self,
input: GetPipelineExecutionInput,
) -> RusotoFuture<GetPipelineExecutionOutput, GetPipelineExecutionError> {
let mut request = SignedRequest::new("POST", "codepipeline", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "CodePipeline_20150709.GetPipelineExecution");
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::<GetPipelineExecutionOutput>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(GetPipelineExecutionError::from_response(response))
}),
)
}
})
}
fn get_pipeline_state(
&self,
input: GetPipelineStateInput,
) -> RusotoFuture<GetPipelineStateOutput, GetPipelineStateError> {
let mut request = SignedRequest::new("POST", "codepipeline", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "CodePipeline_20150709.GetPipelineState");
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::<GetPipelineStateOutput>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(GetPipelineStateError::from_response(response))),
)
}
})
}
fn get_third_party_job_details(
&self,
input: GetThirdPartyJobDetailsInput,
) -> RusotoFuture<GetThirdPartyJobDetailsOutput, GetThirdPartyJobDetailsError> {
let mut request = SignedRequest::new("POST", "codepipeline", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"CodePipeline_20150709.GetThirdPartyJobDetails",
);
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::<GetThirdPartyJobDetailsOutput>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(GetThirdPartyJobDetailsError::from_response(response))
}))
}
})
}
fn list_action_types(
&self,
input: ListActionTypesInput,
) -> RusotoFuture<ListActionTypesOutput, ListActionTypesError> {
let mut request = SignedRequest::new("POST", "codepipeline", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "CodePipeline_20150709.ListActionTypes");
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::<ListActionTypesOutput>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(ListActionTypesError::from_response(response))),
)
}
})
}
fn list_pipeline_executions(
&self,
input: ListPipelineExecutionsInput,
) -> RusotoFuture<ListPipelineExecutionsOutput, ListPipelineExecutionsError> {
let mut request = SignedRequest::new("POST", "codepipeline", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"CodePipeline_20150709.ListPipelineExecutions",
);
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::<ListPipelineExecutionsOutput>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(ListPipelineExecutionsError::from_response(response))
}),
)
}
})
}
fn list_pipelines(
&self,
input: ListPipelinesInput,
) -> RusotoFuture<ListPipelinesOutput, ListPipelinesError> {
let mut request = SignedRequest::new("POST", "codepipeline", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "CodePipeline_20150709.ListPipelines");
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::<ListPipelinesOutput>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(ListPipelinesError::from_response(response))),
)
}
})
}
fn list_webhooks(
&self,
input: ListWebhooksInput,
) -> RusotoFuture<ListWebhooksOutput, ListWebhooksError> {
let mut request = SignedRequest::new("POST", "codepipeline", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "CodePipeline_20150709.ListWebhooks");
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::<ListWebhooksOutput>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(ListWebhooksError::from_response(response))),
)
}
})
}
fn poll_for_jobs(
&self,
input: PollForJobsInput,
) -> RusotoFuture<PollForJobsOutput, PollForJobsError> {
let mut request = SignedRequest::new("POST", "codepipeline", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "CodePipeline_20150709.PollForJobs");
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::<PollForJobsOutput>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(PollForJobsError::from_response(response))),
)
}
})
}
fn poll_for_third_party_jobs(
&self,
input: PollForThirdPartyJobsInput,
) -> RusotoFuture<PollForThirdPartyJobsOutput, PollForThirdPartyJobsError> {
let mut request = SignedRequest::new("POST", "codepipeline", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"CodePipeline_20150709.PollForThirdPartyJobs",
);
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::<PollForThirdPartyJobsOutput>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(PollForThirdPartyJobsError::from_response(response))
}),
)
}
})
}
fn put_action_revision(
&self,
input: PutActionRevisionInput,
) -> RusotoFuture<PutActionRevisionOutput, PutActionRevisionError> {
let mut request = SignedRequest::new("POST", "codepipeline", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "CodePipeline_20150709.PutActionRevision");
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::<PutActionRevisionOutput>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(PutActionRevisionError::from_response(response))),
)
}
})
}
fn put_approval_result(
&self,
input: PutApprovalResultInput,
) -> RusotoFuture<PutApprovalResultOutput, PutApprovalResultError> {
let mut request = SignedRequest::new("POST", "codepipeline", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "CodePipeline_20150709.PutApprovalResult");
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::<PutApprovalResultOutput>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(PutApprovalResultError::from_response(response))),
)
}
})
}
fn put_job_failure_result(
&self,
input: PutJobFailureResultInput,
) -> RusotoFuture<(), PutJobFailureResultError> {
let mut request = SignedRequest::new("POST", "codepipeline", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "CodePipeline_20150709.PutJobFailureResult");
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(future::ok(::std::mem::drop(response)))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(PutJobFailureResultError::from_response(response))
}),
)
}
})
}
fn put_job_success_result(
&self,
input: PutJobSuccessResultInput,
) -> RusotoFuture<(), PutJobSuccessResultError> {
let mut request = SignedRequest::new("POST", "codepipeline", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "CodePipeline_20150709.PutJobSuccessResult");
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(future::ok(::std::mem::drop(response)))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(PutJobSuccessResultError::from_response(response))
}),
)
}
})
}
fn put_third_party_job_failure_result(
&self,
input: PutThirdPartyJobFailureResultInput,
) -> RusotoFuture<(), PutThirdPartyJobFailureResultError> {
let mut request = SignedRequest::new("POST", "codepipeline", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"CodePipeline_20150709.PutThirdPartyJobFailureResult",
);
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(future::ok(::std::mem::drop(response)))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(PutThirdPartyJobFailureResultError::from_response(response))
}))
}
})
}
fn put_third_party_job_success_result(
&self,
input: PutThirdPartyJobSuccessResultInput,
) -> RusotoFuture<(), PutThirdPartyJobSuccessResultError> {
let mut request = SignedRequest::new("POST", "codepipeline", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"CodePipeline_20150709.PutThirdPartyJobSuccessResult",
);
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(future::ok(::std::mem::drop(response)))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(PutThirdPartyJobSuccessResultError::from_response(response))
}))
}
})
}
fn put_webhook(
&self,
input: PutWebhookInput,
) -> RusotoFuture<PutWebhookOutput, PutWebhookError> {
let mut request = SignedRequest::new("POST", "codepipeline", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "CodePipeline_20150709.PutWebhook");
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::<PutWebhookOutput>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(PutWebhookError::from_response(response))),
)
}
})
}
fn register_webhook_with_third_party(
&self,
input: RegisterWebhookWithThirdPartyInput,
) -> RusotoFuture<RegisterWebhookWithThirdPartyOutput, RegisterWebhookWithThirdPartyError> {
let mut request = SignedRequest::new("POST", "codepipeline", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"CodePipeline_20150709.RegisterWebhookWithThirdParty",
);
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::<RegisterWebhookWithThirdPartyOutput>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(RegisterWebhookWithThirdPartyError::from_response(response))
}))
}
})
}
fn retry_stage_execution(
&self,
input: RetryStageExecutionInput,
) -> RusotoFuture<RetryStageExecutionOutput, RetryStageExecutionError> {
let mut request = SignedRequest::new("POST", "codepipeline", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "CodePipeline_20150709.RetryStageExecution");
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::<RetryStageExecutionOutput>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(RetryStageExecutionError::from_response(response))
}),
)
}
})
}
fn start_pipeline_execution(
&self,
input: StartPipelineExecutionInput,
) -> RusotoFuture<StartPipelineExecutionOutput, StartPipelineExecutionError> {
let mut request = SignedRequest::new("POST", "codepipeline", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"CodePipeline_20150709.StartPipelineExecution",
);
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::<StartPipelineExecutionOutput>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(StartPipelineExecutionError::from_response(response))
}),
)
}
})
}
fn update_pipeline(
&self,
input: UpdatePipelineInput,
) -> RusotoFuture<UpdatePipelineOutput, UpdatePipelineError> {
let mut request = SignedRequest::new("POST", "codepipeline", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "CodePipeline_20150709.UpdatePipeline");
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::<UpdatePipelineOutput>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(UpdatePipelineError::from_response(response))),
)
}
})
}
}
#[cfg(test)]
mod protocol_tests {}