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, Serialize)]
pub struct BatchDeleteBuildsInput {
#[serde(rename = "ids")]
pub ids: Vec<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct BatchDeleteBuildsOutput {
#[serde(rename = "buildsDeleted")]
#[serde(skip_serializing_if = "Option::is_none")]
pub builds_deleted: Option<Vec<String>>,
#[serde(rename = "buildsNotDeleted")]
#[serde(skip_serializing_if = "Option::is_none")]
pub builds_not_deleted: Option<Vec<BuildNotDeleted>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct BatchGetBuildsInput {
#[serde(rename = "ids")]
pub ids: Vec<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct BatchGetBuildsOutput {
#[serde(rename = "builds")]
#[serde(skip_serializing_if = "Option::is_none")]
pub builds: Option<Vec<Build>>,
#[serde(rename = "buildsNotFound")]
#[serde(skip_serializing_if = "Option::is_none")]
pub builds_not_found: Option<Vec<String>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct BatchGetProjectsInput {
#[serde(rename = "names")]
pub names: Vec<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct BatchGetProjectsOutput {
#[serde(rename = "projects")]
#[serde(skip_serializing_if = "Option::is_none")]
pub projects: Option<Vec<Project>>,
#[serde(rename = "projectsNotFound")]
#[serde(skip_serializing_if = "Option::is_none")]
pub projects_not_found: Option<Vec<String>>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct Build {
#[serde(rename = "arn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub arn: Option<String>,
#[serde(rename = "artifacts")]
#[serde(skip_serializing_if = "Option::is_none")]
pub artifacts: Option<BuildArtifacts>,
#[serde(rename = "buildComplete")]
#[serde(skip_serializing_if = "Option::is_none")]
pub build_complete: Option<bool>,
#[serde(rename = "buildStatus")]
#[serde(skip_serializing_if = "Option::is_none")]
pub build_status: Option<String>,
#[serde(rename = "cache")]
#[serde(skip_serializing_if = "Option::is_none")]
pub cache: Option<ProjectCache>,
#[serde(rename = "currentPhase")]
#[serde(skip_serializing_if = "Option::is_none")]
pub current_phase: Option<String>,
#[serde(rename = "encryptionKey")]
#[serde(skip_serializing_if = "Option::is_none")]
pub encryption_key: Option<String>,
#[serde(rename = "endTime")]
#[serde(skip_serializing_if = "Option::is_none")]
pub end_time: Option<f64>,
#[serde(rename = "environment")]
#[serde(skip_serializing_if = "Option::is_none")]
pub environment: Option<ProjectEnvironment>,
#[serde(rename = "id")]
#[serde(skip_serializing_if = "Option::is_none")]
pub id: Option<String>,
#[serde(rename = "initiator")]
#[serde(skip_serializing_if = "Option::is_none")]
pub initiator: Option<String>,
#[serde(rename = "logs")]
#[serde(skip_serializing_if = "Option::is_none")]
pub logs: Option<LogsLocation>,
#[serde(rename = "networkInterface")]
#[serde(skip_serializing_if = "Option::is_none")]
pub network_interface: Option<NetworkInterface>,
#[serde(rename = "phases")]
#[serde(skip_serializing_if = "Option::is_none")]
pub phases: Option<Vec<BuildPhase>>,
#[serde(rename = "projectName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub project_name: Option<String>,
#[serde(rename = "queuedTimeoutInMinutes")]
#[serde(skip_serializing_if = "Option::is_none")]
pub queued_timeout_in_minutes: Option<i64>,
#[serde(rename = "resolvedSourceVersion")]
#[serde(skip_serializing_if = "Option::is_none")]
pub resolved_source_version: Option<String>,
#[serde(rename = "secondaryArtifacts")]
#[serde(skip_serializing_if = "Option::is_none")]
pub secondary_artifacts: Option<Vec<BuildArtifacts>>,
#[serde(rename = "secondarySourceVersions")]
#[serde(skip_serializing_if = "Option::is_none")]
pub secondary_source_versions: Option<Vec<ProjectSourceVersion>>,
#[serde(rename = "secondarySources")]
#[serde(skip_serializing_if = "Option::is_none")]
pub secondary_sources: Option<Vec<ProjectSource>>,
#[serde(rename = "serviceRole")]
#[serde(skip_serializing_if = "Option::is_none")]
pub service_role: Option<String>,
#[serde(rename = "source")]
#[serde(skip_serializing_if = "Option::is_none")]
pub source: Option<ProjectSource>,
#[serde(rename = "sourceVersion")]
#[serde(skip_serializing_if = "Option::is_none")]
pub source_version: Option<String>,
#[serde(rename = "startTime")]
#[serde(skip_serializing_if = "Option::is_none")]
pub start_time: Option<f64>,
#[serde(rename = "timeoutInMinutes")]
#[serde(skip_serializing_if = "Option::is_none")]
pub timeout_in_minutes: Option<i64>,
#[serde(rename = "vpcConfig")]
#[serde(skip_serializing_if = "Option::is_none")]
pub vpc_config: Option<VpcConfig>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct BuildArtifacts {
#[serde(rename = "artifactIdentifier")]
#[serde(skip_serializing_if = "Option::is_none")]
pub artifact_identifier: Option<String>,
#[serde(rename = "encryptionDisabled")]
#[serde(skip_serializing_if = "Option::is_none")]
pub encryption_disabled: Option<bool>,
#[serde(rename = "location")]
#[serde(skip_serializing_if = "Option::is_none")]
pub location: Option<String>,
#[serde(rename = "md5sum")]
#[serde(skip_serializing_if = "Option::is_none")]
pub md_5sum: Option<String>,
#[serde(rename = "overrideArtifactName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub override_artifact_name: Option<bool>,
#[serde(rename = "sha256sum")]
#[serde(skip_serializing_if = "Option::is_none")]
pub sha_25_6sum: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct BuildNotDeleted {
#[serde(rename = "id")]
#[serde(skip_serializing_if = "Option::is_none")]
pub id: Option<String>,
#[serde(rename = "statusCode")]
#[serde(skip_serializing_if = "Option::is_none")]
pub status_code: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct BuildPhase {
#[serde(rename = "contexts")]
#[serde(skip_serializing_if = "Option::is_none")]
pub contexts: Option<Vec<PhaseContext>>,
#[serde(rename = "durationInSeconds")]
#[serde(skip_serializing_if = "Option::is_none")]
pub duration_in_seconds: Option<i64>,
#[serde(rename = "endTime")]
#[serde(skip_serializing_if = "Option::is_none")]
pub end_time: Option<f64>,
#[serde(rename = "phaseStatus")]
#[serde(skip_serializing_if = "Option::is_none")]
pub phase_status: Option<String>,
#[serde(rename = "phaseType")]
#[serde(skip_serializing_if = "Option::is_none")]
pub phase_type: Option<String>,
#[serde(rename = "startTime")]
#[serde(skip_serializing_if = "Option::is_none")]
pub start_time: Option<f64>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct CloudWatchLogsConfig {
#[serde(rename = "groupName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub group_name: Option<String>,
#[serde(rename = "status")]
pub status: String,
#[serde(rename = "streamName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub stream_name: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct CreateProjectInput {
#[serde(rename = "artifacts")]
pub artifacts: ProjectArtifacts,
#[serde(rename = "badgeEnabled")]
#[serde(skip_serializing_if = "Option::is_none")]
pub badge_enabled: Option<bool>,
#[serde(rename = "cache")]
#[serde(skip_serializing_if = "Option::is_none")]
pub cache: Option<ProjectCache>,
#[serde(rename = "description")]
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[serde(rename = "encryptionKey")]
#[serde(skip_serializing_if = "Option::is_none")]
pub encryption_key: Option<String>,
#[serde(rename = "environment")]
pub environment: ProjectEnvironment,
#[serde(rename = "logsConfig")]
#[serde(skip_serializing_if = "Option::is_none")]
pub logs_config: Option<LogsConfig>,
#[serde(rename = "name")]
pub name: String,
#[serde(rename = "queuedTimeoutInMinutes")]
#[serde(skip_serializing_if = "Option::is_none")]
pub queued_timeout_in_minutes: Option<i64>,
#[serde(rename = "secondaryArtifacts")]
#[serde(skip_serializing_if = "Option::is_none")]
pub secondary_artifacts: Option<Vec<ProjectArtifacts>>,
#[serde(rename = "secondarySources")]
#[serde(skip_serializing_if = "Option::is_none")]
pub secondary_sources: Option<Vec<ProjectSource>>,
#[serde(rename = "serviceRole")]
pub service_role: String,
#[serde(rename = "source")]
pub source: ProjectSource,
#[serde(rename = "tags")]
#[serde(skip_serializing_if = "Option::is_none")]
pub tags: Option<Vec<Tag>>,
#[serde(rename = "timeoutInMinutes")]
#[serde(skip_serializing_if = "Option::is_none")]
pub timeout_in_minutes: Option<i64>,
#[serde(rename = "vpcConfig")]
#[serde(skip_serializing_if = "Option::is_none")]
pub vpc_config: Option<VpcConfig>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct CreateProjectOutput {
#[serde(rename = "project")]
#[serde(skip_serializing_if = "Option::is_none")]
pub project: Option<Project>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct CreateWebhookInput {
#[serde(rename = "branchFilter")]
#[serde(skip_serializing_if = "Option::is_none")]
pub branch_filter: Option<String>,
#[serde(rename = "filterGroups")]
#[serde(skip_serializing_if = "Option::is_none")]
pub filter_groups: Option<Vec<Vec<WebhookFilter>>>,
#[serde(rename = "projectName")]
pub project_name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct CreateWebhookOutput {
#[serde(rename = "webhook")]
#[serde(skip_serializing_if = "Option::is_none")]
pub webhook: Option<Webhook>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DeleteProjectInput {
#[serde(rename = "name")]
pub name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DeleteProjectOutput {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DeleteSourceCredentialsInput {
#[serde(rename = "arn")]
pub arn: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DeleteSourceCredentialsOutput {
#[serde(rename = "arn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub arn: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DeleteWebhookInput {
#[serde(rename = "projectName")]
pub project_name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DeleteWebhookOutput {}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct EnvironmentImage {
#[serde(rename = "description")]
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[serde(rename = "name")]
#[serde(skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
#[serde(rename = "versions")]
#[serde(skip_serializing_if = "Option::is_none")]
pub versions: Option<Vec<String>>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct EnvironmentLanguage {
#[serde(rename = "images")]
#[serde(skip_serializing_if = "Option::is_none")]
pub images: Option<Vec<EnvironmentImage>>,
#[serde(rename = "language")]
#[serde(skip_serializing_if = "Option::is_none")]
pub language: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct EnvironmentPlatform {
#[serde(rename = "languages")]
#[serde(skip_serializing_if = "Option::is_none")]
pub languages: Option<Vec<EnvironmentLanguage>>,
#[serde(rename = "platform")]
#[serde(skip_serializing_if = "Option::is_none")]
pub platform: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct EnvironmentVariable {
#[serde(rename = "name")]
pub name: String,
#[serde(rename = "type")]
#[serde(skip_serializing_if = "Option::is_none")]
pub type_: Option<String>,
#[serde(rename = "value")]
pub value: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ImportSourceCredentialsInput {
#[serde(rename = "authType")]
pub auth_type: String,
#[serde(rename = "serverType")]
pub server_type: String,
#[serde(rename = "token")]
pub token: String,
#[serde(rename = "username")]
#[serde(skip_serializing_if = "Option::is_none")]
pub username: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ImportSourceCredentialsOutput {
#[serde(rename = "arn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub arn: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct InvalidateProjectCacheInput {
#[serde(rename = "projectName")]
pub project_name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct InvalidateProjectCacheOutput {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ListBuildsForProjectInput {
#[serde(rename = "nextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "projectName")]
pub project_name: String,
#[serde(rename = "sortOrder")]
#[serde(skip_serializing_if = "Option::is_none")]
pub sort_order: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ListBuildsForProjectOutput {
#[serde(rename = "ids")]
#[serde(skip_serializing_if = "Option::is_none")]
pub ids: Option<Vec<String>>,
#[serde(rename = "nextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ListBuildsInput {
#[serde(rename = "nextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "sortOrder")]
#[serde(skip_serializing_if = "Option::is_none")]
pub sort_order: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ListBuildsOutput {
#[serde(rename = "ids")]
#[serde(skip_serializing_if = "Option::is_none")]
pub ids: Option<Vec<String>>,
#[serde(rename = "nextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ListCuratedEnvironmentImagesInput {}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ListCuratedEnvironmentImagesOutput {
#[serde(rename = "platforms")]
#[serde(skip_serializing_if = "Option::is_none")]
pub platforms: Option<Vec<EnvironmentPlatform>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ListProjectsInput {
#[serde(rename = "nextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "sortBy")]
#[serde(skip_serializing_if = "Option::is_none")]
pub sort_by: Option<String>,
#[serde(rename = "sortOrder")]
#[serde(skip_serializing_if = "Option::is_none")]
pub sort_order: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ListProjectsOutput {
#[serde(rename = "nextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "projects")]
#[serde(skip_serializing_if = "Option::is_none")]
pub projects: Option<Vec<String>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ListSourceCredentialsInput {}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ListSourceCredentialsOutput {
#[serde(rename = "sourceCredentialsInfos")]
#[serde(skip_serializing_if = "Option::is_none")]
pub source_credentials_infos: Option<Vec<SourceCredentialsInfo>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct LogsConfig {
#[serde(rename = "cloudWatchLogs")]
#[serde(skip_serializing_if = "Option::is_none")]
pub cloud_watch_logs: Option<CloudWatchLogsConfig>,
#[serde(rename = "s3Logs")]
#[serde(skip_serializing_if = "Option::is_none")]
pub s_3_logs: Option<S3LogsConfig>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct LogsLocation {
#[serde(rename = "cloudWatchLogs")]
#[serde(skip_serializing_if = "Option::is_none")]
pub cloud_watch_logs: Option<CloudWatchLogsConfig>,
#[serde(rename = "deepLink")]
#[serde(skip_serializing_if = "Option::is_none")]
pub deep_link: Option<String>,
#[serde(rename = "groupName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub group_name: Option<String>,
#[serde(rename = "s3DeepLink")]
#[serde(skip_serializing_if = "Option::is_none")]
pub s_3_deep_link: Option<String>,
#[serde(rename = "s3Logs")]
#[serde(skip_serializing_if = "Option::is_none")]
pub s_3_logs: Option<S3LogsConfig>,
#[serde(rename = "streamName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub stream_name: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct NetworkInterface {
#[serde(rename = "networkInterfaceId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub network_interface_id: Option<String>,
#[serde(rename = "subnetId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub subnet_id: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct PhaseContext {
#[serde(rename = "message")]
#[serde(skip_serializing_if = "Option::is_none")]
pub message: Option<String>,
#[serde(rename = "statusCode")]
#[serde(skip_serializing_if = "Option::is_none")]
pub status_code: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct Project {
#[serde(rename = "arn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub arn: Option<String>,
#[serde(rename = "artifacts")]
#[serde(skip_serializing_if = "Option::is_none")]
pub artifacts: Option<ProjectArtifacts>,
#[serde(rename = "badge")]
#[serde(skip_serializing_if = "Option::is_none")]
pub badge: Option<ProjectBadge>,
#[serde(rename = "cache")]
#[serde(skip_serializing_if = "Option::is_none")]
pub cache: Option<ProjectCache>,
#[serde(rename = "created")]
#[serde(skip_serializing_if = "Option::is_none")]
pub created: Option<f64>,
#[serde(rename = "description")]
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[serde(rename = "encryptionKey")]
#[serde(skip_serializing_if = "Option::is_none")]
pub encryption_key: Option<String>,
#[serde(rename = "environment")]
#[serde(skip_serializing_if = "Option::is_none")]
pub environment: Option<ProjectEnvironment>,
#[serde(rename = "lastModified")]
#[serde(skip_serializing_if = "Option::is_none")]
pub last_modified: Option<f64>,
#[serde(rename = "logsConfig")]
#[serde(skip_serializing_if = "Option::is_none")]
pub logs_config: Option<LogsConfig>,
#[serde(rename = "name")]
#[serde(skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
#[serde(rename = "queuedTimeoutInMinutes")]
#[serde(skip_serializing_if = "Option::is_none")]
pub queued_timeout_in_minutes: Option<i64>,
#[serde(rename = "secondaryArtifacts")]
#[serde(skip_serializing_if = "Option::is_none")]
pub secondary_artifacts: Option<Vec<ProjectArtifacts>>,
#[serde(rename = "secondarySources")]
#[serde(skip_serializing_if = "Option::is_none")]
pub secondary_sources: Option<Vec<ProjectSource>>,
#[serde(rename = "serviceRole")]
#[serde(skip_serializing_if = "Option::is_none")]
pub service_role: Option<String>,
#[serde(rename = "source")]
#[serde(skip_serializing_if = "Option::is_none")]
pub source: Option<ProjectSource>,
#[serde(rename = "tags")]
#[serde(skip_serializing_if = "Option::is_none")]
pub tags: Option<Vec<Tag>>,
#[serde(rename = "timeoutInMinutes")]
#[serde(skip_serializing_if = "Option::is_none")]
pub timeout_in_minutes: Option<i64>,
#[serde(rename = "vpcConfig")]
#[serde(skip_serializing_if = "Option::is_none")]
pub vpc_config: Option<VpcConfig>,
#[serde(rename = "webhook")]
#[serde(skip_serializing_if = "Option::is_none")]
pub webhook: Option<Webhook>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct ProjectArtifacts {
#[serde(rename = "artifactIdentifier")]
#[serde(skip_serializing_if = "Option::is_none")]
pub artifact_identifier: Option<String>,
#[serde(rename = "encryptionDisabled")]
#[serde(skip_serializing_if = "Option::is_none")]
pub encryption_disabled: Option<bool>,
#[serde(rename = "location")]
#[serde(skip_serializing_if = "Option::is_none")]
pub location: Option<String>,
#[serde(rename = "name")]
#[serde(skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
#[serde(rename = "namespaceType")]
#[serde(skip_serializing_if = "Option::is_none")]
pub namespace_type: Option<String>,
#[serde(rename = "overrideArtifactName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub override_artifact_name: Option<bool>,
#[serde(rename = "packaging")]
#[serde(skip_serializing_if = "Option::is_none")]
pub packaging: Option<String>,
#[serde(rename = "path")]
#[serde(skip_serializing_if = "Option::is_none")]
pub path: Option<String>,
#[serde(rename = "type")]
pub type_: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ProjectBadge {
#[serde(rename = "badgeEnabled")]
#[serde(skip_serializing_if = "Option::is_none")]
pub badge_enabled: Option<bool>,
#[serde(rename = "badgeRequestUrl")]
#[serde(skip_serializing_if = "Option::is_none")]
pub badge_request_url: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct ProjectCache {
#[serde(rename = "location")]
#[serde(skip_serializing_if = "Option::is_none")]
pub location: Option<String>,
#[serde(rename = "modes")]
#[serde(skip_serializing_if = "Option::is_none")]
pub modes: Option<Vec<String>>,
#[serde(rename = "type")]
pub type_: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct ProjectEnvironment {
#[serde(rename = "certificate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub certificate: Option<String>,
#[serde(rename = "computeType")]
pub compute_type: String,
#[serde(rename = "environmentVariables")]
#[serde(skip_serializing_if = "Option::is_none")]
pub environment_variables: Option<Vec<EnvironmentVariable>>,
#[serde(rename = "image")]
pub image: String,
#[serde(rename = "imagePullCredentialsType")]
#[serde(skip_serializing_if = "Option::is_none")]
pub image_pull_credentials_type: Option<String>,
#[serde(rename = "privilegedMode")]
#[serde(skip_serializing_if = "Option::is_none")]
pub privileged_mode: Option<bool>,
#[serde(rename = "registryCredential")]
#[serde(skip_serializing_if = "Option::is_none")]
pub registry_credential: Option<RegistryCredential>,
#[serde(rename = "type")]
pub type_: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct ProjectSource {
#[serde(rename = "auth")]
#[serde(skip_serializing_if = "Option::is_none")]
pub auth: Option<SourceAuth>,
#[serde(rename = "buildspec")]
#[serde(skip_serializing_if = "Option::is_none")]
pub buildspec: Option<String>,
#[serde(rename = "gitCloneDepth")]
#[serde(skip_serializing_if = "Option::is_none")]
pub git_clone_depth: Option<i64>,
#[serde(rename = "insecureSsl")]
#[serde(skip_serializing_if = "Option::is_none")]
pub insecure_ssl: Option<bool>,
#[serde(rename = "location")]
#[serde(skip_serializing_if = "Option::is_none")]
pub location: Option<String>,
#[serde(rename = "reportBuildStatus")]
#[serde(skip_serializing_if = "Option::is_none")]
pub report_build_status: Option<bool>,
#[serde(rename = "sourceIdentifier")]
#[serde(skip_serializing_if = "Option::is_none")]
pub source_identifier: Option<String>,
#[serde(rename = "type")]
pub type_: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct ProjectSourceVersion {
#[serde(rename = "sourceIdentifier")]
pub source_identifier: String,
#[serde(rename = "sourceVersion")]
pub source_version: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct RegistryCredential {
#[serde(rename = "credential")]
pub credential: String,
#[serde(rename = "credentialProvider")]
pub credential_provider: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct S3LogsConfig {
#[serde(rename = "location")]
#[serde(skip_serializing_if = "Option::is_none")]
pub location: Option<String>,
#[serde(rename = "status")]
pub status: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct SourceAuth {
#[serde(rename = "resource")]
#[serde(skip_serializing_if = "Option::is_none")]
pub resource: Option<String>,
#[serde(rename = "type")]
pub type_: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct SourceCredentialsInfo {
#[serde(rename = "arn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub arn: Option<String>,
#[serde(rename = "authType")]
#[serde(skip_serializing_if = "Option::is_none")]
pub auth_type: Option<String>,
#[serde(rename = "serverType")]
#[serde(skip_serializing_if = "Option::is_none")]
pub server_type: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct StartBuildInput {
#[serde(rename = "artifactsOverride")]
#[serde(skip_serializing_if = "Option::is_none")]
pub artifacts_override: Option<ProjectArtifacts>,
#[serde(rename = "buildspecOverride")]
#[serde(skip_serializing_if = "Option::is_none")]
pub buildspec_override: Option<String>,
#[serde(rename = "cacheOverride")]
#[serde(skip_serializing_if = "Option::is_none")]
pub cache_override: Option<ProjectCache>,
#[serde(rename = "certificateOverride")]
#[serde(skip_serializing_if = "Option::is_none")]
pub certificate_override: Option<String>,
#[serde(rename = "computeTypeOverride")]
#[serde(skip_serializing_if = "Option::is_none")]
pub compute_type_override: Option<String>,
#[serde(rename = "environmentTypeOverride")]
#[serde(skip_serializing_if = "Option::is_none")]
pub environment_type_override: Option<String>,
#[serde(rename = "environmentVariablesOverride")]
#[serde(skip_serializing_if = "Option::is_none")]
pub environment_variables_override: Option<Vec<EnvironmentVariable>>,
#[serde(rename = "gitCloneDepthOverride")]
#[serde(skip_serializing_if = "Option::is_none")]
pub git_clone_depth_override: Option<i64>,
#[serde(rename = "idempotencyToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub idempotency_token: Option<String>,
#[serde(rename = "imageOverride")]
#[serde(skip_serializing_if = "Option::is_none")]
pub image_override: Option<String>,
#[serde(rename = "imagePullCredentialsTypeOverride")]
#[serde(skip_serializing_if = "Option::is_none")]
pub image_pull_credentials_type_override: Option<String>,
#[serde(rename = "insecureSslOverride")]
#[serde(skip_serializing_if = "Option::is_none")]
pub insecure_ssl_override: Option<bool>,
#[serde(rename = "logsConfigOverride")]
#[serde(skip_serializing_if = "Option::is_none")]
pub logs_config_override: Option<LogsConfig>,
#[serde(rename = "privilegedModeOverride")]
#[serde(skip_serializing_if = "Option::is_none")]
pub privileged_mode_override: Option<bool>,
#[serde(rename = "projectName")]
pub project_name: String,
#[serde(rename = "queuedTimeoutInMinutesOverride")]
#[serde(skip_serializing_if = "Option::is_none")]
pub queued_timeout_in_minutes_override: Option<i64>,
#[serde(rename = "registryCredentialOverride")]
#[serde(skip_serializing_if = "Option::is_none")]
pub registry_credential_override: Option<RegistryCredential>,
#[serde(rename = "reportBuildStatusOverride")]
#[serde(skip_serializing_if = "Option::is_none")]
pub report_build_status_override: Option<bool>,
#[serde(rename = "secondaryArtifactsOverride")]
#[serde(skip_serializing_if = "Option::is_none")]
pub secondary_artifacts_override: Option<Vec<ProjectArtifacts>>,
#[serde(rename = "secondarySourcesOverride")]
#[serde(skip_serializing_if = "Option::is_none")]
pub secondary_sources_override: Option<Vec<ProjectSource>>,
#[serde(rename = "secondarySourcesVersionOverride")]
#[serde(skip_serializing_if = "Option::is_none")]
pub secondary_sources_version_override: Option<Vec<ProjectSourceVersion>>,
#[serde(rename = "serviceRoleOverride")]
#[serde(skip_serializing_if = "Option::is_none")]
pub service_role_override: Option<String>,
#[serde(rename = "sourceAuthOverride")]
#[serde(skip_serializing_if = "Option::is_none")]
pub source_auth_override: Option<SourceAuth>,
#[serde(rename = "sourceLocationOverride")]
#[serde(skip_serializing_if = "Option::is_none")]
pub source_location_override: Option<String>,
#[serde(rename = "sourceTypeOverride")]
#[serde(skip_serializing_if = "Option::is_none")]
pub source_type_override: Option<String>,
#[serde(rename = "sourceVersion")]
#[serde(skip_serializing_if = "Option::is_none")]
pub source_version: Option<String>,
#[serde(rename = "timeoutInMinutesOverride")]
#[serde(skip_serializing_if = "Option::is_none")]
pub timeout_in_minutes_override: Option<i64>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct StartBuildOutput {
#[serde(rename = "build")]
#[serde(skip_serializing_if = "Option::is_none")]
pub build: Option<Build>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct StopBuildInput {
#[serde(rename = "id")]
pub id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct StopBuildOutput {
#[serde(rename = "build")]
#[serde(skip_serializing_if = "Option::is_none")]
pub build: Option<Build>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct Tag {
#[serde(rename = "key")]
#[serde(skip_serializing_if = "Option::is_none")]
pub key: Option<String>,
#[serde(rename = "value")]
#[serde(skip_serializing_if = "Option::is_none")]
pub value: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct UpdateProjectInput {
#[serde(rename = "artifacts")]
#[serde(skip_serializing_if = "Option::is_none")]
pub artifacts: Option<ProjectArtifacts>,
#[serde(rename = "badgeEnabled")]
#[serde(skip_serializing_if = "Option::is_none")]
pub badge_enabled: Option<bool>,
#[serde(rename = "cache")]
#[serde(skip_serializing_if = "Option::is_none")]
pub cache: Option<ProjectCache>,
#[serde(rename = "description")]
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[serde(rename = "encryptionKey")]
#[serde(skip_serializing_if = "Option::is_none")]
pub encryption_key: Option<String>,
#[serde(rename = "environment")]
#[serde(skip_serializing_if = "Option::is_none")]
pub environment: Option<ProjectEnvironment>,
#[serde(rename = "logsConfig")]
#[serde(skip_serializing_if = "Option::is_none")]
pub logs_config: Option<LogsConfig>,
#[serde(rename = "name")]
pub name: String,
#[serde(rename = "queuedTimeoutInMinutes")]
#[serde(skip_serializing_if = "Option::is_none")]
pub queued_timeout_in_minutes: Option<i64>,
#[serde(rename = "secondaryArtifacts")]
#[serde(skip_serializing_if = "Option::is_none")]
pub secondary_artifacts: Option<Vec<ProjectArtifacts>>,
#[serde(rename = "secondarySources")]
#[serde(skip_serializing_if = "Option::is_none")]
pub secondary_sources: Option<Vec<ProjectSource>>,
#[serde(rename = "serviceRole")]
#[serde(skip_serializing_if = "Option::is_none")]
pub service_role: Option<String>,
#[serde(rename = "source")]
#[serde(skip_serializing_if = "Option::is_none")]
pub source: Option<ProjectSource>,
#[serde(rename = "tags")]
#[serde(skip_serializing_if = "Option::is_none")]
pub tags: Option<Vec<Tag>>,
#[serde(rename = "timeoutInMinutes")]
#[serde(skip_serializing_if = "Option::is_none")]
pub timeout_in_minutes: Option<i64>,
#[serde(rename = "vpcConfig")]
#[serde(skip_serializing_if = "Option::is_none")]
pub vpc_config: Option<VpcConfig>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct UpdateProjectOutput {
#[serde(rename = "project")]
#[serde(skip_serializing_if = "Option::is_none")]
pub project: Option<Project>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct UpdateWebhookInput {
#[serde(rename = "branchFilter")]
#[serde(skip_serializing_if = "Option::is_none")]
pub branch_filter: Option<String>,
#[serde(rename = "filterGroups")]
#[serde(skip_serializing_if = "Option::is_none")]
pub filter_groups: Option<Vec<Vec<WebhookFilter>>>,
#[serde(rename = "projectName")]
pub project_name: String,
#[serde(rename = "rotateSecret")]
#[serde(skip_serializing_if = "Option::is_none")]
pub rotate_secret: Option<bool>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct UpdateWebhookOutput {
#[serde(rename = "webhook")]
#[serde(skip_serializing_if = "Option::is_none")]
pub webhook: Option<Webhook>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct VpcConfig {
#[serde(rename = "securityGroupIds")]
#[serde(skip_serializing_if = "Option::is_none")]
pub security_group_ids: Option<Vec<String>>,
#[serde(rename = "subnets")]
#[serde(skip_serializing_if = "Option::is_none")]
pub subnets: Option<Vec<String>>,
#[serde(rename = "vpcId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub vpc_id: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct Webhook {
#[serde(rename = "branchFilter")]
#[serde(skip_serializing_if = "Option::is_none")]
pub branch_filter: Option<String>,
#[serde(rename = "filterGroups")]
#[serde(skip_serializing_if = "Option::is_none")]
pub filter_groups: Option<Vec<Vec<WebhookFilter>>>,
#[serde(rename = "lastModifiedSecret")]
#[serde(skip_serializing_if = "Option::is_none")]
pub last_modified_secret: Option<f64>,
#[serde(rename = "payloadUrl")]
#[serde(skip_serializing_if = "Option::is_none")]
pub payload_url: Option<String>,
#[serde(rename = "secret")]
#[serde(skip_serializing_if = "Option::is_none")]
pub secret: Option<String>,
#[serde(rename = "url")]
#[serde(skip_serializing_if = "Option::is_none")]
pub url: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct WebhookFilter {
#[serde(rename = "excludeMatchedPattern")]
#[serde(skip_serializing_if = "Option::is_none")]
pub exclude_matched_pattern: Option<bool>,
#[serde(rename = "pattern")]
pub pattern: String,
#[serde(rename = "type")]
pub type_: String,
}
#[derive(Debug, PartialEq)]
pub enum BatchDeleteBuildsError {
InvalidInput(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl BatchDeleteBuildsError {
pub fn from_response(res: BufferedHttpResponse) -> BatchDeleteBuildsError {
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 {
"InvalidInputException" => {
return BatchDeleteBuildsError::InvalidInput(String::from(error_message));
}
"ValidationException" => {
return BatchDeleteBuildsError::Validation(error_message.to_string());
}
_ => {}
}
}
return BatchDeleteBuildsError::Unknown(res);
}
}
impl From<serde_json::error::Error> for BatchDeleteBuildsError {
fn from(err: serde_json::error::Error) -> BatchDeleteBuildsError {
BatchDeleteBuildsError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for BatchDeleteBuildsError {
fn from(err: CredentialsError) -> BatchDeleteBuildsError {
BatchDeleteBuildsError::Credentials(err)
}
}
impl From<HttpDispatchError> for BatchDeleteBuildsError {
fn from(err: HttpDispatchError) -> BatchDeleteBuildsError {
BatchDeleteBuildsError::HttpDispatch(err)
}
}
impl From<io::Error> for BatchDeleteBuildsError {
fn from(err: io::Error) -> BatchDeleteBuildsError {
BatchDeleteBuildsError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for BatchDeleteBuildsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for BatchDeleteBuildsError {
fn description(&self) -> &str {
match *self {
BatchDeleteBuildsError::InvalidInput(ref cause) => cause,
BatchDeleteBuildsError::Validation(ref cause) => cause,
BatchDeleteBuildsError::Credentials(ref err) => err.description(),
BatchDeleteBuildsError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
BatchDeleteBuildsError::ParseError(ref cause) => cause,
BatchDeleteBuildsError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum BatchGetBuildsError {
InvalidInput(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl BatchGetBuildsError {
pub fn from_response(res: BufferedHttpResponse) -> BatchGetBuildsError {
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 {
"InvalidInputException" => {
return BatchGetBuildsError::InvalidInput(String::from(error_message));
}
"ValidationException" => {
return BatchGetBuildsError::Validation(error_message.to_string());
}
_ => {}
}
}
return BatchGetBuildsError::Unknown(res);
}
}
impl From<serde_json::error::Error> for BatchGetBuildsError {
fn from(err: serde_json::error::Error) -> BatchGetBuildsError {
BatchGetBuildsError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for BatchGetBuildsError {
fn from(err: CredentialsError) -> BatchGetBuildsError {
BatchGetBuildsError::Credentials(err)
}
}
impl From<HttpDispatchError> for BatchGetBuildsError {
fn from(err: HttpDispatchError) -> BatchGetBuildsError {
BatchGetBuildsError::HttpDispatch(err)
}
}
impl From<io::Error> for BatchGetBuildsError {
fn from(err: io::Error) -> BatchGetBuildsError {
BatchGetBuildsError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for BatchGetBuildsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for BatchGetBuildsError {
fn description(&self) -> &str {
match *self {
BatchGetBuildsError::InvalidInput(ref cause) => cause,
BatchGetBuildsError::Validation(ref cause) => cause,
BatchGetBuildsError::Credentials(ref err) => err.description(),
BatchGetBuildsError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
BatchGetBuildsError::ParseError(ref cause) => cause,
BatchGetBuildsError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum BatchGetProjectsError {
InvalidInput(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl BatchGetProjectsError {
pub fn from_response(res: BufferedHttpResponse) -> BatchGetProjectsError {
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 {
"InvalidInputException" => {
return BatchGetProjectsError::InvalidInput(String::from(error_message));
}
"ValidationException" => {
return BatchGetProjectsError::Validation(error_message.to_string());
}
_ => {}
}
}
return BatchGetProjectsError::Unknown(res);
}
}
impl From<serde_json::error::Error> for BatchGetProjectsError {
fn from(err: serde_json::error::Error) -> BatchGetProjectsError {
BatchGetProjectsError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for BatchGetProjectsError {
fn from(err: CredentialsError) -> BatchGetProjectsError {
BatchGetProjectsError::Credentials(err)
}
}
impl From<HttpDispatchError> for BatchGetProjectsError {
fn from(err: HttpDispatchError) -> BatchGetProjectsError {
BatchGetProjectsError::HttpDispatch(err)
}
}
impl From<io::Error> for BatchGetProjectsError {
fn from(err: io::Error) -> BatchGetProjectsError {
BatchGetProjectsError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for BatchGetProjectsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for BatchGetProjectsError {
fn description(&self) -> &str {
match *self {
BatchGetProjectsError::InvalidInput(ref cause) => cause,
BatchGetProjectsError::Validation(ref cause) => cause,
BatchGetProjectsError::Credentials(ref err) => err.description(),
BatchGetProjectsError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
BatchGetProjectsError::ParseError(ref cause) => cause,
BatchGetProjectsError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum CreateProjectError {
AccountLimitExceeded(String),
InvalidInput(String),
ResourceAlreadyExists(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl CreateProjectError {
pub fn from_response(res: BufferedHttpResponse) -> CreateProjectError {
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 {
"AccountLimitExceededException" => {
return CreateProjectError::AccountLimitExceeded(String::from(error_message));
}
"InvalidInputException" => {
return CreateProjectError::InvalidInput(String::from(error_message));
}
"ResourceAlreadyExistsException" => {
return CreateProjectError::ResourceAlreadyExists(String::from(error_message));
}
"ValidationException" => {
return CreateProjectError::Validation(error_message.to_string());
}
_ => {}
}
}
return CreateProjectError::Unknown(res);
}
}
impl From<serde_json::error::Error> for CreateProjectError {
fn from(err: serde_json::error::Error) -> CreateProjectError {
CreateProjectError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for CreateProjectError {
fn from(err: CredentialsError) -> CreateProjectError {
CreateProjectError::Credentials(err)
}
}
impl From<HttpDispatchError> for CreateProjectError {
fn from(err: HttpDispatchError) -> CreateProjectError {
CreateProjectError::HttpDispatch(err)
}
}
impl From<io::Error> for CreateProjectError {
fn from(err: io::Error) -> CreateProjectError {
CreateProjectError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for CreateProjectError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for CreateProjectError {
fn description(&self) -> &str {
match *self {
CreateProjectError::AccountLimitExceeded(ref cause) => cause,
CreateProjectError::InvalidInput(ref cause) => cause,
CreateProjectError::ResourceAlreadyExists(ref cause) => cause,
CreateProjectError::Validation(ref cause) => cause,
CreateProjectError::Credentials(ref err) => err.description(),
CreateProjectError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
CreateProjectError::ParseError(ref cause) => cause,
CreateProjectError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum CreateWebhookError {
InvalidInput(String),
OAuthProvider(String),
ResourceAlreadyExists(String),
ResourceNotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl CreateWebhookError {
pub fn from_response(res: BufferedHttpResponse) -> CreateWebhookError {
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 {
"InvalidInputException" => {
return CreateWebhookError::InvalidInput(String::from(error_message));
}
"OAuthProviderException" => {
return CreateWebhookError::OAuthProvider(String::from(error_message));
}
"ResourceAlreadyExistsException" => {
return CreateWebhookError::ResourceAlreadyExists(String::from(error_message));
}
"ResourceNotFoundException" => {
return CreateWebhookError::ResourceNotFound(String::from(error_message));
}
"ValidationException" => {
return CreateWebhookError::Validation(error_message.to_string());
}
_ => {}
}
}
return CreateWebhookError::Unknown(res);
}
}
impl From<serde_json::error::Error> for CreateWebhookError {
fn from(err: serde_json::error::Error) -> CreateWebhookError {
CreateWebhookError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for CreateWebhookError {
fn from(err: CredentialsError) -> CreateWebhookError {
CreateWebhookError::Credentials(err)
}
}
impl From<HttpDispatchError> for CreateWebhookError {
fn from(err: HttpDispatchError) -> CreateWebhookError {
CreateWebhookError::HttpDispatch(err)
}
}
impl From<io::Error> for CreateWebhookError {
fn from(err: io::Error) -> CreateWebhookError {
CreateWebhookError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for CreateWebhookError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for CreateWebhookError {
fn description(&self) -> &str {
match *self {
CreateWebhookError::InvalidInput(ref cause) => cause,
CreateWebhookError::OAuthProvider(ref cause) => cause,
CreateWebhookError::ResourceAlreadyExists(ref cause) => cause,
CreateWebhookError::ResourceNotFound(ref cause) => cause,
CreateWebhookError::Validation(ref cause) => cause,
CreateWebhookError::Credentials(ref err) => err.description(),
CreateWebhookError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
CreateWebhookError::ParseError(ref cause) => cause,
CreateWebhookError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DeleteProjectError {
InvalidInput(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DeleteProjectError {
pub fn from_response(res: BufferedHttpResponse) -> DeleteProjectError {
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 {
"InvalidInputException" => {
return DeleteProjectError::InvalidInput(String::from(error_message));
}
"ValidationException" => {
return DeleteProjectError::Validation(error_message.to_string());
}
_ => {}
}
}
return DeleteProjectError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DeleteProjectError {
fn from(err: serde_json::error::Error) -> DeleteProjectError {
DeleteProjectError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DeleteProjectError {
fn from(err: CredentialsError) -> DeleteProjectError {
DeleteProjectError::Credentials(err)
}
}
impl From<HttpDispatchError> for DeleteProjectError {
fn from(err: HttpDispatchError) -> DeleteProjectError {
DeleteProjectError::HttpDispatch(err)
}
}
impl From<io::Error> for DeleteProjectError {
fn from(err: io::Error) -> DeleteProjectError {
DeleteProjectError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DeleteProjectError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DeleteProjectError {
fn description(&self) -> &str {
match *self {
DeleteProjectError::InvalidInput(ref cause) => cause,
DeleteProjectError::Validation(ref cause) => cause,
DeleteProjectError::Credentials(ref err) => err.description(),
DeleteProjectError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
DeleteProjectError::ParseError(ref cause) => cause,
DeleteProjectError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DeleteSourceCredentialsError {
InvalidInput(String),
ResourceNotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DeleteSourceCredentialsError {
pub fn from_response(res: BufferedHttpResponse) -> DeleteSourceCredentialsError {
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 {
"InvalidInputException" => {
return DeleteSourceCredentialsError::InvalidInput(String::from(error_message));
}
"ResourceNotFoundException" => {
return DeleteSourceCredentialsError::ResourceNotFound(String::from(
error_message,
));
}
"ValidationException" => {
return DeleteSourceCredentialsError::Validation(error_message.to_string());
}
_ => {}
}
}
return DeleteSourceCredentialsError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DeleteSourceCredentialsError {
fn from(err: serde_json::error::Error) -> DeleteSourceCredentialsError {
DeleteSourceCredentialsError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DeleteSourceCredentialsError {
fn from(err: CredentialsError) -> DeleteSourceCredentialsError {
DeleteSourceCredentialsError::Credentials(err)
}
}
impl From<HttpDispatchError> for DeleteSourceCredentialsError {
fn from(err: HttpDispatchError) -> DeleteSourceCredentialsError {
DeleteSourceCredentialsError::HttpDispatch(err)
}
}
impl From<io::Error> for DeleteSourceCredentialsError {
fn from(err: io::Error) -> DeleteSourceCredentialsError {
DeleteSourceCredentialsError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DeleteSourceCredentialsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DeleteSourceCredentialsError {
fn description(&self) -> &str {
match *self {
DeleteSourceCredentialsError::InvalidInput(ref cause) => cause,
DeleteSourceCredentialsError::ResourceNotFound(ref cause) => cause,
DeleteSourceCredentialsError::Validation(ref cause) => cause,
DeleteSourceCredentialsError::Credentials(ref err) => err.description(),
DeleteSourceCredentialsError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
DeleteSourceCredentialsError::ParseError(ref cause) => cause,
DeleteSourceCredentialsError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DeleteWebhookError {
InvalidInput(String),
OAuthProvider(String),
ResourceNotFound(String),
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 {
"InvalidInputException" => {
return DeleteWebhookError::InvalidInput(String::from(error_message));
}
"OAuthProviderException" => {
return DeleteWebhookError::OAuthProvider(String::from(error_message));
}
"ResourceNotFoundException" => {
return DeleteWebhookError::ResourceNotFound(String::from(error_message));
}
"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::InvalidInput(ref cause) => cause,
DeleteWebhookError::OAuthProvider(ref cause) => cause,
DeleteWebhookError::ResourceNotFound(ref cause) => cause,
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 ImportSourceCredentialsError {
AccountLimitExceeded(String),
InvalidInput(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ImportSourceCredentialsError {
pub fn from_response(res: BufferedHttpResponse) -> ImportSourceCredentialsError {
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 {
"AccountLimitExceededException" => {
return ImportSourceCredentialsError::AccountLimitExceeded(String::from(
error_message,
));
}
"InvalidInputException" => {
return ImportSourceCredentialsError::InvalidInput(String::from(error_message));
}
"ValidationException" => {
return ImportSourceCredentialsError::Validation(error_message.to_string());
}
_ => {}
}
}
return ImportSourceCredentialsError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ImportSourceCredentialsError {
fn from(err: serde_json::error::Error) -> ImportSourceCredentialsError {
ImportSourceCredentialsError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ImportSourceCredentialsError {
fn from(err: CredentialsError) -> ImportSourceCredentialsError {
ImportSourceCredentialsError::Credentials(err)
}
}
impl From<HttpDispatchError> for ImportSourceCredentialsError {
fn from(err: HttpDispatchError) -> ImportSourceCredentialsError {
ImportSourceCredentialsError::HttpDispatch(err)
}
}
impl From<io::Error> for ImportSourceCredentialsError {
fn from(err: io::Error) -> ImportSourceCredentialsError {
ImportSourceCredentialsError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ImportSourceCredentialsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ImportSourceCredentialsError {
fn description(&self) -> &str {
match *self {
ImportSourceCredentialsError::AccountLimitExceeded(ref cause) => cause,
ImportSourceCredentialsError::InvalidInput(ref cause) => cause,
ImportSourceCredentialsError::Validation(ref cause) => cause,
ImportSourceCredentialsError::Credentials(ref err) => err.description(),
ImportSourceCredentialsError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
ImportSourceCredentialsError::ParseError(ref cause) => cause,
ImportSourceCredentialsError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum InvalidateProjectCacheError {
InvalidInput(String),
ResourceNotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl InvalidateProjectCacheError {
pub fn from_response(res: BufferedHttpResponse) -> InvalidateProjectCacheError {
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 {
"InvalidInputException" => {
return InvalidateProjectCacheError::InvalidInput(String::from(error_message));
}
"ResourceNotFoundException" => {
return InvalidateProjectCacheError::ResourceNotFound(String::from(
error_message,
));
}
"ValidationException" => {
return InvalidateProjectCacheError::Validation(error_message.to_string());
}
_ => {}
}
}
return InvalidateProjectCacheError::Unknown(res);
}
}
impl From<serde_json::error::Error> for InvalidateProjectCacheError {
fn from(err: serde_json::error::Error) -> InvalidateProjectCacheError {
InvalidateProjectCacheError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for InvalidateProjectCacheError {
fn from(err: CredentialsError) -> InvalidateProjectCacheError {
InvalidateProjectCacheError::Credentials(err)
}
}
impl From<HttpDispatchError> for InvalidateProjectCacheError {
fn from(err: HttpDispatchError) -> InvalidateProjectCacheError {
InvalidateProjectCacheError::HttpDispatch(err)
}
}
impl From<io::Error> for InvalidateProjectCacheError {
fn from(err: io::Error) -> InvalidateProjectCacheError {
InvalidateProjectCacheError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for InvalidateProjectCacheError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for InvalidateProjectCacheError {
fn description(&self) -> &str {
match *self {
InvalidateProjectCacheError::InvalidInput(ref cause) => cause,
InvalidateProjectCacheError::ResourceNotFound(ref cause) => cause,
InvalidateProjectCacheError::Validation(ref cause) => cause,
InvalidateProjectCacheError::Credentials(ref err) => err.description(),
InvalidateProjectCacheError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
InvalidateProjectCacheError::ParseError(ref cause) => cause,
InvalidateProjectCacheError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListBuildsError {
InvalidInput(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ListBuildsError {
pub fn from_response(res: BufferedHttpResponse) -> ListBuildsError {
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 {
"InvalidInputException" => {
return ListBuildsError::InvalidInput(String::from(error_message));
}
"ValidationException" => {
return ListBuildsError::Validation(error_message.to_string());
}
_ => {}
}
}
return ListBuildsError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ListBuildsError {
fn from(err: serde_json::error::Error) -> ListBuildsError {
ListBuildsError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ListBuildsError {
fn from(err: CredentialsError) -> ListBuildsError {
ListBuildsError::Credentials(err)
}
}
impl From<HttpDispatchError> for ListBuildsError {
fn from(err: HttpDispatchError) -> ListBuildsError {
ListBuildsError::HttpDispatch(err)
}
}
impl From<io::Error> for ListBuildsError {
fn from(err: io::Error) -> ListBuildsError {
ListBuildsError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ListBuildsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListBuildsError {
fn description(&self) -> &str {
match *self {
ListBuildsError::InvalidInput(ref cause) => cause,
ListBuildsError::Validation(ref cause) => cause,
ListBuildsError::Credentials(ref err) => err.description(),
ListBuildsError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
ListBuildsError::ParseError(ref cause) => cause,
ListBuildsError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListBuildsForProjectError {
InvalidInput(String),
ResourceNotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ListBuildsForProjectError {
pub fn from_response(res: BufferedHttpResponse) -> ListBuildsForProjectError {
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 {
"InvalidInputException" => {
return ListBuildsForProjectError::InvalidInput(String::from(error_message));
}
"ResourceNotFoundException" => {
return ListBuildsForProjectError::ResourceNotFound(String::from(error_message));
}
"ValidationException" => {
return ListBuildsForProjectError::Validation(error_message.to_string());
}
_ => {}
}
}
return ListBuildsForProjectError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ListBuildsForProjectError {
fn from(err: serde_json::error::Error) -> ListBuildsForProjectError {
ListBuildsForProjectError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ListBuildsForProjectError {
fn from(err: CredentialsError) -> ListBuildsForProjectError {
ListBuildsForProjectError::Credentials(err)
}
}
impl From<HttpDispatchError> for ListBuildsForProjectError {
fn from(err: HttpDispatchError) -> ListBuildsForProjectError {
ListBuildsForProjectError::HttpDispatch(err)
}
}
impl From<io::Error> for ListBuildsForProjectError {
fn from(err: io::Error) -> ListBuildsForProjectError {
ListBuildsForProjectError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ListBuildsForProjectError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListBuildsForProjectError {
fn description(&self) -> &str {
match *self {
ListBuildsForProjectError::InvalidInput(ref cause) => cause,
ListBuildsForProjectError::ResourceNotFound(ref cause) => cause,
ListBuildsForProjectError::Validation(ref cause) => cause,
ListBuildsForProjectError::Credentials(ref err) => err.description(),
ListBuildsForProjectError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
ListBuildsForProjectError::ParseError(ref cause) => cause,
ListBuildsForProjectError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListCuratedEnvironmentImagesError {
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ListCuratedEnvironmentImagesError {
pub fn from_response(res: BufferedHttpResponse) -> ListCuratedEnvironmentImagesError {
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 ListCuratedEnvironmentImagesError::Validation(error_message.to_string());
}
_ => {}
}
}
return ListCuratedEnvironmentImagesError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ListCuratedEnvironmentImagesError {
fn from(err: serde_json::error::Error) -> ListCuratedEnvironmentImagesError {
ListCuratedEnvironmentImagesError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ListCuratedEnvironmentImagesError {
fn from(err: CredentialsError) -> ListCuratedEnvironmentImagesError {
ListCuratedEnvironmentImagesError::Credentials(err)
}
}
impl From<HttpDispatchError> for ListCuratedEnvironmentImagesError {
fn from(err: HttpDispatchError) -> ListCuratedEnvironmentImagesError {
ListCuratedEnvironmentImagesError::HttpDispatch(err)
}
}
impl From<io::Error> for ListCuratedEnvironmentImagesError {
fn from(err: io::Error) -> ListCuratedEnvironmentImagesError {
ListCuratedEnvironmentImagesError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ListCuratedEnvironmentImagesError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListCuratedEnvironmentImagesError {
fn description(&self) -> &str {
match *self {
ListCuratedEnvironmentImagesError::Validation(ref cause) => cause,
ListCuratedEnvironmentImagesError::Credentials(ref err) => err.description(),
ListCuratedEnvironmentImagesError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
ListCuratedEnvironmentImagesError::ParseError(ref cause) => cause,
ListCuratedEnvironmentImagesError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListProjectsError {
InvalidInput(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ListProjectsError {
pub fn from_response(res: BufferedHttpResponse) -> ListProjectsError {
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 {
"InvalidInputException" => {
return ListProjectsError::InvalidInput(String::from(error_message));
}
"ValidationException" => {
return ListProjectsError::Validation(error_message.to_string());
}
_ => {}
}
}
return ListProjectsError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ListProjectsError {
fn from(err: serde_json::error::Error) -> ListProjectsError {
ListProjectsError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ListProjectsError {
fn from(err: CredentialsError) -> ListProjectsError {
ListProjectsError::Credentials(err)
}
}
impl From<HttpDispatchError> for ListProjectsError {
fn from(err: HttpDispatchError) -> ListProjectsError {
ListProjectsError::HttpDispatch(err)
}
}
impl From<io::Error> for ListProjectsError {
fn from(err: io::Error) -> ListProjectsError {
ListProjectsError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ListProjectsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListProjectsError {
fn description(&self) -> &str {
match *self {
ListProjectsError::InvalidInput(ref cause) => cause,
ListProjectsError::Validation(ref cause) => cause,
ListProjectsError::Credentials(ref err) => err.description(),
ListProjectsError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
ListProjectsError::ParseError(ref cause) => cause,
ListProjectsError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListSourceCredentialsError {
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ListSourceCredentialsError {
pub fn from_response(res: BufferedHttpResponse) -> ListSourceCredentialsError {
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 ListSourceCredentialsError::Validation(error_message.to_string());
}
_ => {}
}
}
return ListSourceCredentialsError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ListSourceCredentialsError {
fn from(err: serde_json::error::Error) -> ListSourceCredentialsError {
ListSourceCredentialsError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ListSourceCredentialsError {
fn from(err: CredentialsError) -> ListSourceCredentialsError {
ListSourceCredentialsError::Credentials(err)
}
}
impl From<HttpDispatchError> for ListSourceCredentialsError {
fn from(err: HttpDispatchError) -> ListSourceCredentialsError {
ListSourceCredentialsError::HttpDispatch(err)
}
}
impl From<io::Error> for ListSourceCredentialsError {
fn from(err: io::Error) -> ListSourceCredentialsError {
ListSourceCredentialsError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ListSourceCredentialsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListSourceCredentialsError {
fn description(&self) -> &str {
match *self {
ListSourceCredentialsError::Validation(ref cause) => cause,
ListSourceCredentialsError::Credentials(ref err) => err.description(),
ListSourceCredentialsError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
ListSourceCredentialsError::ParseError(ref cause) => cause,
ListSourceCredentialsError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum StartBuildError {
AccountLimitExceeded(String),
InvalidInput(String),
ResourceNotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl StartBuildError {
pub fn from_response(res: BufferedHttpResponse) -> StartBuildError {
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 {
"AccountLimitExceededException" => {
return StartBuildError::AccountLimitExceeded(String::from(error_message));
}
"InvalidInputException" => {
return StartBuildError::InvalidInput(String::from(error_message));
}
"ResourceNotFoundException" => {
return StartBuildError::ResourceNotFound(String::from(error_message));
}
"ValidationException" => {
return StartBuildError::Validation(error_message.to_string());
}
_ => {}
}
}
return StartBuildError::Unknown(res);
}
}
impl From<serde_json::error::Error> for StartBuildError {
fn from(err: serde_json::error::Error) -> StartBuildError {
StartBuildError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for StartBuildError {
fn from(err: CredentialsError) -> StartBuildError {
StartBuildError::Credentials(err)
}
}
impl From<HttpDispatchError> for StartBuildError {
fn from(err: HttpDispatchError) -> StartBuildError {
StartBuildError::HttpDispatch(err)
}
}
impl From<io::Error> for StartBuildError {
fn from(err: io::Error) -> StartBuildError {
StartBuildError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for StartBuildError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for StartBuildError {
fn description(&self) -> &str {
match *self {
StartBuildError::AccountLimitExceeded(ref cause) => cause,
StartBuildError::InvalidInput(ref cause) => cause,
StartBuildError::ResourceNotFound(ref cause) => cause,
StartBuildError::Validation(ref cause) => cause,
StartBuildError::Credentials(ref err) => err.description(),
StartBuildError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
StartBuildError::ParseError(ref cause) => cause,
StartBuildError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum StopBuildError {
InvalidInput(String),
ResourceNotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl StopBuildError {
pub fn from_response(res: BufferedHttpResponse) -> StopBuildError {
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 {
"InvalidInputException" => {
return StopBuildError::InvalidInput(String::from(error_message));
}
"ResourceNotFoundException" => {
return StopBuildError::ResourceNotFound(String::from(error_message));
}
"ValidationException" => {
return StopBuildError::Validation(error_message.to_string());
}
_ => {}
}
}
return StopBuildError::Unknown(res);
}
}
impl From<serde_json::error::Error> for StopBuildError {
fn from(err: serde_json::error::Error) -> StopBuildError {
StopBuildError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for StopBuildError {
fn from(err: CredentialsError) -> StopBuildError {
StopBuildError::Credentials(err)
}
}
impl From<HttpDispatchError> for StopBuildError {
fn from(err: HttpDispatchError) -> StopBuildError {
StopBuildError::HttpDispatch(err)
}
}
impl From<io::Error> for StopBuildError {
fn from(err: io::Error) -> StopBuildError {
StopBuildError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for StopBuildError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for StopBuildError {
fn description(&self) -> &str {
match *self {
StopBuildError::InvalidInput(ref cause) => cause,
StopBuildError::ResourceNotFound(ref cause) => cause,
StopBuildError::Validation(ref cause) => cause,
StopBuildError::Credentials(ref err) => err.description(),
StopBuildError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
StopBuildError::ParseError(ref cause) => cause,
StopBuildError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum UpdateProjectError {
InvalidInput(String),
ResourceNotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl UpdateProjectError {
pub fn from_response(res: BufferedHttpResponse) -> UpdateProjectError {
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 {
"InvalidInputException" => {
return UpdateProjectError::InvalidInput(String::from(error_message));
}
"ResourceNotFoundException" => {
return UpdateProjectError::ResourceNotFound(String::from(error_message));
}
"ValidationException" => {
return UpdateProjectError::Validation(error_message.to_string());
}
_ => {}
}
}
return UpdateProjectError::Unknown(res);
}
}
impl From<serde_json::error::Error> for UpdateProjectError {
fn from(err: serde_json::error::Error) -> UpdateProjectError {
UpdateProjectError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for UpdateProjectError {
fn from(err: CredentialsError) -> UpdateProjectError {
UpdateProjectError::Credentials(err)
}
}
impl From<HttpDispatchError> for UpdateProjectError {
fn from(err: HttpDispatchError) -> UpdateProjectError {
UpdateProjectError::HttpDispatch(err)
}
}
impl From<io::Error> for UpdateProjectError {
fn from(err: io::Error) -> UpdateProjectError {
UpdateProjectError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for UpdateProjectError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for UpdateProjectError {
fn description(&self) -> &str {
match *self {
UpdateProjectError::InvalidInput(ref cause) => cause,
UpdateProjectError::ResourceNotFound(ref cause) => cause,
UpdateProjectError::Validation(ref cause) => cause,
UpdateProjectError::Credentials(ref err) => err.description(),
UpdateProjectError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
UpdateProjectError::ParseError(ref cause) => cause,
UpdateProjectError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum UpdateWebhookError {
InvalidInput(String),
OAuthProvider(String),
ResourceNotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl UpdateWebhookError {
pub fn from_response(res: BufferedHttpResponse) -> UpdateWebhookError {
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 {
"InvalidInputException" => {
return UpdateWebhookError::InvalidInput(String::from(error_message));
}
"OAuthProviderException" => {
return UpdateWebhookError::OAuthProvider(String::from(error_message));
}
"ResourceNotFoundException" => {
return UpdateWebhookError::ResourceNotFound(String::from(error_message));
}
"ValidationException" => {
return UpdateWebhookError::Validation(error_message.to_string());
}
_ => {}
}
}
return UpdateWebhookError::Unknown(res);
}
}
impl From<serde_json::error::Error> for UpdateWebhookError {
fn from(err: serde_json::error::Error) -> UpdateWebhookError {
UpdateWebhookError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for UpdateWebhookError {
fn from(err: CredentialsError) -> UpdateWebhookError {
UpdateWebhookError::Credentials(err)
}
}
impl From<HttpDispatchError> for UpdateWebhookError {
fn from(err: HttpDispatchError) -> UpdateWebhookError {
UpdateWebhookError::HttpDispatch(err)
}
}
impl From<io::Error> for UpdateWebhookError {
fn from(err: io::Error) -> UpdateWebhookError {
UpdateWebhookError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for UpdateWebhookError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for UpdateWebhookError {
fn description(&self) -> &str {
match *self {
UpdateWebhookError::InvalidInput(ref cause) => cause,
UpdateWebhookError::OAuthProvider(ref cause) => cause,
UpdateWebhookError::ResourceNotFound(ref cause) => cause,
UpdateWebhookError::Validation(ref cause) => cause,
UpdateWebhookError::Credentials(ref err) => err.description(),
UpdateWebhookError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
UpdateWebhookError::ParseError(ref cause) => cause,
UpdateWebhookError::Unknown(_) => "unknown error",
}
}
}
pub trait CodeBuild {
fn batch_delete_builds(
&self,
input: BatchDeleteBuildsInput,
) -> RusotoFuture<BatchDeleteBuildsOutput, BatchDeleteBuildsError>;
fn batch_get_builds(
&self,
input: BatchGetBuildsInput,
) -> RusotoFuture<BatchGetBuildsOutput, BatchGetBuildsError>;
fn batch_get_projects(
&self,
input: BatchGetProjectsInput,
) -> RusotoFuture<BatchGetProjectsOutput, BatchGetProjectsError>;
fn create_project(
&self,
input: CreateProjectInput,
) -> RusotoFuture<CreateProjectOutput, CreateProjectError>;
fn create_webhook(
&self,
input: CreateWebhookInput,
) -> RusotoFuture<CreateWebhookOutput, CreateWebhookError>;
fn delete_project(
&self,
input: DeleteProjectInput,
) -> RusotoFuture<DeleteProjectOutput, DeleteProjectError>;
fn delete_source_credentials(
&self,
input: DeleteSourceCredentialsInput,
) -> RusotoFuture<DeleteSourceCredentialsOutput, DeleteSourceCredentialsError>;
fn delete_webhook(
&self,
input: DeleteWebhookInput,
) -> RusotoFuture<DeleteWebhookOutput, DeleteWebhookError>;
fn import_source_credentials(
&self,
input: ImportSourceCredentialsInput,
) -> RusotoFuture<ImportSourceCredentialsOutput, ImportSourceCredentialsError>;
fn invalidate_project_cache(
&self,
input: InvalidateProjectCacheInput,
) -> RusotoFuture<InvalidateProjectCacheOutput, InvalidateProjectCacheError>;
fn list_builds(
&self,
input: ListBuildsInput,
) -> RusotoFuture<ListBuildsOutput, ListBuildsError>;
fn list_builds_for_project(
&self,
input: ListBuildsForProjectInput,
) -> RusotoFuture<ListBuildsForProjectOutput, ListBuildsForProjectError>;
fn list_curated_environment_images(
&self,
) -> RusotoFuture<ListCuratedEnvironmentImagesOutput, ListCuratedEnvironmentImagesError>;
fn list_projects(
&self,
input: ListProjectsInput,
) -> RusotoFuture<ListProjectsOutput, ListProjectsError>;
fn list_source_credentials(
&self,
) -> RusotoFuture<ListSourceCredentialsOutput, ListSourceCredentialsError>;
fn start_build(
&self,
input: StartBuildInput,
) -> RusotoFuture<StartBuildOutput, StartBuildError>;
fn stop_build(&self, input: StopBuildInput) -> RusotoFuture<StopBuildOutput, StopBuildError>;
fn update_project(
&self,
input: UpdateProjectInput,
) -> RusotoFuture<UpdateProjectOutput, UpdateProjectError>;
fn update_webhook(
&self,
input: UpdateWebhookInput,
) -> RusotoFuture<UpdateWebhookOutput, UpdateWebhookError>;
}
#[derive(Clone)]
pub struct CodeBuildClient {
client: Client,
region: region::Region,
}
impl CodeBuildClient {
pub fn new(region: region::Region) -> CodeBuildClient {
CodeBuildClient {
client: Client::shared(),
region: region,
}
}
pub fn new_with<P, D>(
request_dispatcher: D,
credentials_provider: P,
region: region::Region,
) -> CodeBuildClient
where
P: ProvideAwsCredentials + Send + Sync + 'static,
P::Future: Send,
D: DispatchSignedRequest + Send + Sync + 'static,
D::Future: Send,
{
CodeBuildClient {
client: Client::new_with(credentials_provider, request_dispatcher),
region: region,
}
}
}
impl CodeBuild for CodeBuildClient {
fn batch_delete_builds(
&self,
input: BatchDeleteBuildsInput,
) -> RusotoFuture<BatchDeleteBuildsOutput, BatchDeleteBuildsError> {
let mut request = SignedRequest::new("POST", "codebuild", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "CodeBuild_20161006.BatchDeleteBuilds");
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::<BatchDeleteBuildsOutput>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(BatchDeleteBuildsError::from_response(response))),
)
}
})
}
fn batch_get_builds(
&self,
input: BatchGetBuildsInput,
) -> RusotoFuture<BatchGetBuildsOutput, BatchGetBuildsError> {
let mut request = SignedRequest::new("POST", "codebuild", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "CodeBuild_20161006.BatchGetBuilds");
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::<BatchGetBuildsOutput>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(BatchGetBuildsError::from_response(response))),
)
}
})
}
fn batch_get_projects(
&self,
input: BatchGetProjectsInput,
) -> RusotoFuture<BatchGetProjectsOutput, BatchGetProjectsError> {
let mut request = SignedRequest::new("POST", "codebuild", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "CodeBuild_20161006.BatchGetProjects");
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::<BatchGetProjectsOutput>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(BatchGetProjectsError::from_response(response))),
)
}
})
}
fn create_project(
&self,
input: CreateProjectInput,
) -> RusotoFuture<CreateProjectOutput, CreateProjectError> {
let mut request = SignedRequest::new("POST", "codebuild", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "CodeBuild_20161006.CreateProject");
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::<CreateProjectOutput>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(CreateProjectError::from_response(response))),
)
}
})
}
fn create_webhook(
&self,
input: CreateWebhookInput,
) -> RusotoFuture<CreateWebhookOutput, CreateWebhookError> {
let mut request = SignedRequest::new("POST", "codebuild", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "CodeBuild_20161006.CreateWebhook");
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::<CreateWebhookOutput>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(CreateWebhookError::from_response(response))),
)
}
})
}
fn delete_project(
&self,
input: DeleteProjectInput,
) -> RusotoFuture<DeleteProjectOutput, DeleteProjectError> {
let mut request = SignedRequest::new("POST", "codebuild", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "CodeBuild_20161006.DeleteProject");
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::<DeleteProjectOutput>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(DeleteProjectError::from_response(response))),
)
}
})
}
fn delete_source_credentials(
&self,
input: DeleteSourceCredentialsInput,
) -> RusotoFuture<DeleteSourceCredentialsOutput, DeleteSourceCredentialsError> {
let mut request = SignedRequest::new("POST", "codebuild", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "CodeBuild_20161006.DeleteSourceCredentials");
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::<DeleteSourceCredentialsOutput>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(DeleteSourceCredentialsError::from_response(response))
}))
}
})
}
fn delete_webhook(
&self,
input: DeleteWebhookInput,
) -> RusotoFuture<DeleteWebhookOutput, DeleteWebhookError> {
let mut request = SignedRequest::new("POST", "codebuild", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "CodeBuild_20161006.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 import_source_credentials(
&self,
input: ImportSourceCredentialsInput,
) -> RusotoFuture<ImportSourceCredentialsOutput, ImportSourceCredentialsError> {
let mut request = SignedRequest::new("POST", "codebuild", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "CodeBuild_20161006.ImportSourceCredentials");
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::<ImportSourceCredentialsOutput>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(ImportSourceCredentialsError::from_response(response))
}))
}
})
}
fn invalidate_project_cache(
&self,
input: InvalidateProjectCacheInput,
) -> RusotoFuture<InvalidateProjectCacheOutput, InvalidateProjectCacheError> {
let mut request = SignedRequest::new("POST", "codebuild", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "CodeBuild_20161006.InvalidateProjectCache");
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::<InvalidateProjectCacheOutput>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(InvalidateProjectCacheError::from_response(response))
}),
)
}
})
}
fn list_builds(
&self,
input: ListBuildsInput,
) -> RusotoFuture<ListBuildsOutput, ListBuildsError> {
let mut request = SignedRequest::new("POST", "codebuild", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "CodeBuild_20161006.ListBuilds");
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::<ListBuildsOutput>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(ListBuildsError::from_response(response))),
)
}
})
}
fn list_builds_for_project(
&self,
input: ListBuildsForProjectInput,
) -> RusotoFuture<ListBuildsForProjectOutput, ListBuildsForProjectError> {
let mut request = SignedRequest::new("POST", "codebuild", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "CodeBuild_20161006.ListBuildsForProject");
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::<ListBuildsForProjectOutput>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(ListBuildsForProjectError::from_response(response))
}),
)
}
})
}
fn list_curated_environment_images(
&self,
) -> RusotoFuture<ListCuratedEnvironmentImagesOutput, ListCuratedEnvironmentImagesError> {
let mut request = SignedRequest::new("POST", "codebuild", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"CodeBuild_20161006.ListCuratedEnvironmentImages",
);
request.set_payload(Some(b"{}".to_vec()));
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::<ListCuratedEnvironmentImagesOutput>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(ListCuratedEnvironmentImagesError::from_response(response))
}))
}
})
}
fn list_projects(
&self,
input: ListProjectsInput,
) -> RusotoFuture<ListProjectsOutput, ListProjectsError> {
let mut request = SignedRequest::new("POST", "codebuild", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "CodeBuild_20161006.ListProjects");
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::<ListProjectsOutput>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(ListProjectsError::from_response(response))),
)
}
})
}
fn list_source_credentials(
&self,
) -> RusotoFuture<ListSourceCredentialsOutput, ListSourceCredentialsError> {
let mut request = SignedRequest::new("POST", "codebuild", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "CodeBuild_20161006.ListSourceCredentials");
request.set_payload(Some(b"{}".to_vec()));
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::<ListSourceCredentialsOutput>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(ListSourceCredentialsError::from_response(response))
}),
)
}
})
}
fn start_build(
&self,
input: StartBuildInput,
) -> RusotoFuture<StartBuildOutput, StartBuildError> {
let mut request = SignedRequest::new("POST", "codebuild", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "CodeBuild_20161006.StartBuild");
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::<StartBuildOutput>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(StartBuildError::from_response(response))),
)
}
})
}
fn stop_build(&self, input: StopBuildInput) -> RusotoFuture<StopBuildOutput, StopBuildError> {
let mut request = SignedRequest::new("POST", "codebuild", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "CodeBuild_20161006.StopBuild");
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::<StopBuildOutput>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(StopBuildError::from_response(response))),
)
}
})
}
fn update_project(
&self,
input: UpdateProjectInput,
) -> RusotoFuture<UpdateProjectOutput, UpdateProjectError> {
let mut request = SignedRequest::new("POST", "codebuild", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "CodeBuild_20161006.UpdateProject");
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::<UpdateProjectOutput>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(UpdateProjectError::from_response(response))),
)
}
})
}
fn update_webhook(
&self,
input: UpdateWebhookInput,
) -> RusotoFuture<UpdateWebhookOutput, UpdateWebhookError> {
let mut request = SignedRequest::new("POST", "codebuild", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "CodeBuild_20161006.UpdateWebhook");
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::<UpdateWebhookOutput>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(UpdateWebhookError::from_response(response))),
)
}
})
}
}
#[cfg(test)]
mod protocol_tests {}