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 AssociateTeamMemberRequest {
#[serde(rename = "clientRequestToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub client_request_token: Option<String>,
#[serde(rename = "projectId")]
pub project_id: String,
#[serde(rename = "projectRole")]
pub project_role: String,
#[serde(rename = "remoteAccessAllowed")]
#[serde(skip_serializing_if = "Option::is_none")]
pub remote_access_allowed: Option<bool>,
#[serde(rename = "userArn")]
pub user_arn: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct AssociateTeamMemberResult {
#[serde(rename = "clientRequestToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub client_request_token: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct Code {
#[serde(rename = "destination")]
pub destination: CodeDestination,
#[serde(rename = "source")]
pub source: CodeSource,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct CodeCommitCodeDestination {
#[serde(rename = "name")]
pub name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct CodeDestination {
#[serde(rename = "codeCommit")]
#[serde(skip_serializing_if = "Option::is_none")]
pub code_commit: Option<CodeCommitCodeDestination>,
#[serde(rename = "gitHub")]
#[serde(skip_serializing_if = "Option::is_none")]
pub git_hub: Option<GitHubCodeDestination>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct CodeSource {
#[serde(rename = "s3")]
pub s_3: S3Location,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct CreateProjectRequest {
#[serde(rename = "clientRequestToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub client_request_token: Option<String>,
#[serde(rename = "description")]
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[serde(rename = "id")]
pub id: String,
#[serde(rename = "name")]
pub name: String,
#[serde(rename = "sourceCode")]
#[serde(skip_serializing_if = "Option::is_none")]
pub source_code: Option<Vec<Code>>,
#[serde(rename = "tags")]
#[serde(skip_serializing_if = "Option::is_none")]
pub tags: Option<::std::collections::HashMap<String, String>>,
#[serde(rename = "toolchain")]
#[serde(skip_serializing_if = "Option::is_none")]
pub toolchain: Option<Toolchain>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct CreateProjectResult {
#[serde(rename = "arn")]
pub arn: String,
#[serde(rename = "clientRequestToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub client_request_token: Option<String>,
#[serde(rename = "id")]
pub id: String,
#[serde(rename = "projectTemplateId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub project_template_id: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct CreateUserProfileRequest {
#[serde(rename = "displayName")]
pub display_name: String,
#[serde(rename = "emailAddress")]
pub email_address: String,
#[serde(rename = "sshPublicKey")]
#[serde(skip_serializing_if = "Option::is_none")]
pub ssh_public_key: Option<String>,
#[serde(rename = "userArn")]
pub user_arn: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct CreateUserProfileResult {
#[serde(rename = "createdTimestamp")]
#[serde(skip_serializing_if = "Option::is_none")]
pub created_timestamp: Option<f64>,
#[serde(rename = "displayName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub display_name: Option<String>,
#[serde(rename = "emailAddress")]
#[serde(skip_serializing_if = "Option::is_none")]
pub email_address: Option<String>,
#[serde(rename = "lastModifiedTimestamp")]
#[serde(skip_serializing_if = "Option::is_none")]
pub last_modified_timestamp: Option<f64>,
#[serde(rename = "sshPublicKey")]
#[serde(skip_serializing_if = "Option::is_none")]
pub ssh_public_key: Option<String>,
#[serde(rename = "userArn")]
pub user_arn: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DeleteProjectRequest {
#[serde(rename = "clientRequestToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub client_request_token: Option<String>,
#[serde(rename = "deleteStack")]
#[serde(skip_serializing_if = "Option::is_none")]
pub delete_stack: Option<bool>,
#[serde(rename = "id")]
pub id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DeleteProjectResult {
#[serde(rename = "projectArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub project_arn: Option<String>,
#[serde(rename = "stackId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub stack_id: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DeleteUserProfileRequest {
#[serde(rename = "userArn")]
pub user_arn: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DeleteUserProfileResult {
#[serde(rename = "userArn")]
pub user_arn: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DescribeProjectRequest {
#[serde(rename = "id")]
pub id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DescribeProjectResult {
#[serde(rename = "arn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub arn: Option<String>,
#[serde(rename = "clientRequestToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub client_request_token: Option<String>,
#[serde(rename = "createdTimeStamp")]
#[serde(skip_serializing_if = "Option::is_none")]
pub created_time_stamp: Option<f64>,
#[serde(rename = "description")]
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[serde(rename = "id")]
#[serde(skip_serializing_if = "Option::is_none")]
pub id: Option<String>,
#[serde(rename = "name")]
#[serde(skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
#[serde(rename = "projectTemplateId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub project_template_id: Option<String>,
#[serde(rename = "stackId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub stack_id: Option<String>,
#[serde(rename = "status")]
#[serde(skip_serializing_if = "Option::is_none")]
pub status: Option<ProjectStatus>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DescribeUserProfileRequest {
#[serde(rename = "userArn")]
pub user_arn: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DescribeUserProfileResult {
#[serde(rename = "createdTimestamp")]
pub created_timestamp: f64,
#[serde(rename = "displayName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub display_name: Option<String>,
#[serde(rename = "emailAddress")]
#[serde(skip_serializing_if = "Option::is_none")]
pub email_address: Option<String>,
#[serde(rename = "lastModifiedTimestamp")]
pub last_modified_timestamp: f64,
#[serde(rename = "sshPublicKey")]
#[serde(skip_serializing_if = "Option::is_none")]
pub ssh_public_key: Option<String>,
#[serde(rename = "userArn")]
pub user_arn: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DisassociateTeamMemberRequest {
#[serde(rename = "projectId")]
pub project_id: String,
#[serde(rename = "userArn")]
pub user_arn: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DisassociateTeamMemberResult {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GitHubCodeDestination {
#[serde(rename = "description")]
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[serde(rename = "issuesEnabled")]
pub issues_enabled: bool,
#[serde(rename = "name")]
pub name: String,
#[serde(rename = "owner")]
pub owner: String,
#[serde(rename = "privateRepository")]
pub private_repository: bool,
#[serde(rename = "token")]
pub token: String,
#[serde(rename = "type")]
pub type_: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ListProjectsRequest {
#[serde(rename = "maxResults")]
#[serde(skip_serializing_if = "Option::is_none")]
pub max_results: Option<i64>,
#[serde(rename = "nextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ListProjectsResult {
#[serde(rename = "nextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "projects")]
pub projects: Vec<ProjectSummary>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ListResourcesRequest {
#[serde(rename = "maxResults")]
#[serde(skip_serializing_if = "Option::is_none")]
pub max_results: Option<i64>,
#[serde(rename = "nextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "projectId")]
pub project_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ListResourcesResult {
#[serde(rename = "nextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "resources")]
#[serde(skip_serializing_if = "Option::is_none")]
pub resources: Option<Vec<Resource>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ListTagsForProjectRequest {
#[serde(rename = "id")]
pub id: String,
#[serde(rename = "maxResults")]
#[serde(skip_serializing_if = "Option::is_none")]
pub max_results: Option<i64>,
#[serde(rename = "nextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ListTagsForProjectResult {
#[serde(rename = "nextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "tags")]
#[serde(skip_serializing_if = "Option::is_none")]
pub tags: Option<::std::collections::HashMap<String, String>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ListTeamMembersRequest {
#[serde(rename = "maxResults")]
#[serde(skip_serializing_if = "Option::is_none")]
pub max_results: Option<i64>,
#[serde(rename = "nextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "projectId")]
pub project_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ListTeamMembersResult {
#[serde(rename = "nextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "teamMembers")]
pub team_members: Vec<TeamMember>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ListUserProfilesRequest {
#[serde(rename = "maxResults")]
#[serde(skip_serializing_if = "Option::is_none")]
pub max_results: Option<i64>,
#[serde(rename = "nextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ListUserProfilesResult {
#[serde(rename = "nextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "userProfiles")]
pub user_profiles: Vec<UserProfileSummary>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ProjectStatus {
#[serde(rename = "reason")]
#[serde(skip_serializing_if = "Option::is_none")]
pub reason: Option<String>,
#[serde(rename = "state")]
pub state: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ProjectSummary {
#[serde(rename = "projectArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub project_arn: Option<String>,
#[serde(rename = "projectId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub project_id: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct Resource {
#[serde(rename = "id")]
pub id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct S3Location {
#[serde(rename = "bucketKey")]
#[serde(skip_serializing_if = "Option::is_none")]
pub bucket_key: Option<String>,
#[serde(rename = "bucketName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub bucket_name: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct TagProjectRequest {
#[serde(rename = "id")]
pub id: String,
#[serde(rename = "tags")]
pub tags: ::std::collections::HashMap<String, String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct TagProjectResult {
#[serde(rename = "tags")]
#[serde(skip_serializing_if = "Option::is_none")]
pub tags: Option<::std::collections::HashMap<String, String>>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct TeamMember {
#[serde(rename = "projectRole")]
pub project_role: String,
#[serde(rename = "remoteAccessAllowed")]
#[serde(skip_serializing_if = "Option::is_none")]
pub remote_access_allowed: Option<bool>,
#[serde(rename = "userArn")]
pub user_arn: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct Toolchain {
#[serde(rename = "roleArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub role_arn: Option<String>,
#[serde(rename = "source")]
pub source: ToolchainSource,
#[serde(rename = "stackParameters")]
#[serde(skip_serializing_if = "Option::is_none")]
pub stack_parameters: Option<::std::collections::HashMap<String, String>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ToolchainSource {
#[serde(rename = "s3")]
pub s_3: S3Location,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct UntagProjectRequest {
#[serde(rename = "id")]
pub id: String,
#[serde(rename = "tags")]
pub tags: Vec<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct UntagProjectResult {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct UpdateProjectRequest {
#[serde(rename = "description")]
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[serde(rename = "id")]
pub id: String,
#[serde(rename = "name")]
#[serde(skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct UpdateProjectResult {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct UpdateTeamMemberRequest {
#[serde(rename = "projectId")]
pub project_id: String,
#[serde(rename = "projectRole")]
#[serde(skip_serializing_if = "Option::is_none")]
pub project_role: Option<String>,
#[serde(rename = "remoteAccessAllowed")]
#[serde(skip_serializing_if = "Option::is_none")]
pub remote_access_allowed: Option<bool>,
#[serde(rename = "userArn")]
pub user_arn: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct UpdateTeamMemberResult {
#[serde(rename = "projectRole")]
#[serde(skip_serializing_if = "Option::is_none")]
pub project_role: Option<String>,
#[serde(rename = "remoteAccessAllowed")]
#[serde(skip_serializing_if = "Option::is_none")]
pub remote_access_allowed: Option<bool>,
#[serde(rename = "userArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub user_arn: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct UpdateUserProfileRequest {
#[serde(rename = "displayName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub display_name: Option<String>,
#[serde(rename = "emailAddress")]
#[serde(skip_serializing_if = "Option::is_none")]
pub email_address: Option<String>,
#[serde(rename = "sshPublicKey")]
#[serde(skip_serializing_if = "Option::is_none")]
pub ssh_public_key: Option<String>,
#[serde(rename = "userArn")]
pub user_arn: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct UpdateUserProfileResult {
#[serde(rename = "createdTimestamp")]
#[serde(skip_serializing_if = "Option::is_none")]
pub created_timestamp: Option<f64>,
#[serde(rename = "displayName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub display_name: Option<String>,
#[serde(rename = "emailAddress")]
#[serde(skip_serializing_if = "Option::is_none")]
pub email_address: Option<String>,
#[serde(rename = "lastModifiedTimestamp")]
#[serde(skip_serializing_if = "Option::is_none")]
pub last_modified_timestamp: Option<f64>,
#[serde(rename = "sshPublicKey")]
#[serde(skip_serializing_if = "Option::is_none")]
pub ssh_public_key: Option<String>,
#[serde(rename = "userArn")]
pub user_arn: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct UserProfileSummary {
#[serde(rename = "displayName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub display_name: Option<String>,
#[serde(rename = "emailAddress")]
#[serde(skip_serializing_if = "Option::is_none")]
pub email_address: Option<String>,
#[serde(rename = "sshPublicKey")]
#[serde(skip_serializing_if = "Option::is_none")]
pub ssh_public_key: Option<String>,
#[serde(rename = "userArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub user_arn: Option<String>,
}
#[derive(Debug, PartialEq)]
pub enum AssociateTeamMemberError {
ConcurrentModification(String),
InvalidServiceRole(String),
LimitExceeded(String),
ProjectConfiguration(String),
ProjectNotFound(String),
TeamMemberAlreadyAssociated(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl AssociateTeamMemberError {
pub fn from_response(res: BufferedHttpResponse) -> AssociateTeamMemberError {
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 {
"ConcurrentModificationException" => {
return AssociateTeamMemberError::ConcurrentModification(String::from(
error_message,
));
}
"InvalidServiceRoleException" => {
return AssociateTeamMemberError::InvalidServiceRole(String::from(error_message));
}
"LimitExceededException" => {
return AssociateTeamMemberError::LimitExceeded(String::from(error_message));
}
"ProjectConfigurationException" => {
return AssociateTeamMemberError::ProjectConfiguration(String::from(
error_message,
));
}
"ProjectNotFoundException" => {
return AssociateTeamMemberError::ProjectNotFound(String::from(error_message));
}
"TeamMemberAlreadyAssociatedException" => {
return AssociateTeamMemberError::TeamMemberAlreadyAssociated(String::from(
error_message,
));
}
"ValidationException" => {
return AssociateTeamMemberError::Validation(error_message.to_string());
}
_ => {}
}
}
return AssociateTeamMemberError::Unknown(res);
}
}
impl From<serde_json::error::Error> for AssociateTeamMemberError {
fn from(err: serde_json::error::Error) -> AssociateTeamMemberError {
AssociateTeamMemberError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for AssociateTeamMemberError {
fn from(err: CredentialsError) -> AssociateTeamMemberError {
AssociateTeamMemberError::Credentials(err)
}
}
impl From<HttpDispatchError> for AssociateTeamMemberError {
fn from(err: HttpDispatchError) -> AssociateTeamMemberError {
AssociateTeamMemberError::HttpDispatch(err)
}
}
impl From<io::Error> for AssociateTeamMemberError {
fn from(err: io::Error) -> AssociateTeamMemberError {
AssociateTeamMemberError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for AssociateTeamMemberError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for AssociateTeamMemberError {
fn description(&self) -> &str {
match *self {
AssociateTeamMemberError::ConcurrentModification(ref cause) => cause,
AssociateTeamMemberError::InvalidServiceRole(ref cause) => cause,
AssociateTeamMemberError::LimitExceeded(ref cause) => cause,
AssociateTeamMemberError::ProjectConfiguration(ref cause) => cause,
AssociateTeamMemberError::ProjectNotFound(ref cause) => cause,
AssociateTeamMemberError::TeamMemberAlreadyAssociated(ref cause) => cause,
AssociateTeamMemberError::Validation(ref cause) => cause,
AssociateTeamMemberError::Credentials(ref err) => err.description(),
AssociateTeamMemberError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
AssociateTeamMemberError::ParseError(ref cause) => cause,
AssociateTeamMemberError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum CreateProjectError {
ConcurrentModification(String),
InvalidServiceRole(String),
LimitExceeded(String),
ProjectAlreadyExists(String),
ProjectConfiguration(String),
ProjectCreationFailed(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 {
"ConcurrentModificationException" => {
return CreateProjectError::ConcurrentModification(String::from(error_message));
}
"InvalidServiceRoleException" => {
return CreateProjectError::InvalidServiceRole(String::from(error_message));
}
"LimitExceededException" => {
return CreateProjectError::LimitExceeded(String::from(error_message));
}
"ProjectAlreadyExistsException" => {
return CreateProjectError::ProjectAlreadyExists(String::from(error_message));
}
"ProjectConfigurationException" => {
return CreateProjectError::ProjectConfiguration(String::from(error_message));
}
"ProjectCreationFailedException" => {
return CreateProjectError::ProjectCreationFailed(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::ConcurrentModification(ref cause) => cause,
CreateProjectError::InvalidServiceRole(ref cause) => cause,
CreateProjectError::LimitExceeded(ref cause) => cause,
CreateProjectError::ProjectAlreadyExists(ref cause) => cause,
CreateProjectError::ProjectConfiguration(ref cause) => cause,
CreateProjectError::ProjectCreationFailed(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 CreateUserProfileError {
UserProfileAlreadyExists(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl CreateUserProfileError {
pub fn from_response(res: BufferedHttpResponse) -> CreateUserProfileError {
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 {
"UserProfileAlreadyExistsException" => {
return CreateUserProfileError::UserProfileAlreadyExists(String::from(
error_message,
));
}
"ValidationException" => {
return CreateUserProfileError::Validation(error_message.to_string());
}
_ => {}
}
}
return CreateUserProfileError::Unknown(res);
}
}
impl From<serde_json::error::Error> for CreateUserProfileError {
fn from(err: serde_json::error::Error) -> CreateUserProfileError {
CreateUserProfileError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for CreateUserProfileError {
fn from(err: CredentialsError) -> CreateUserProfileError {
CreateUserProfileError::Credentials(err)
}
}
impl From<HttpDispatchError> for CreateUserProfileError {
fn from(err: HttpDispatchError) -> CreateUserProfileError {
CreateUserProfileError::HttpDispatch(err)
}
}
impl From<io::Error> for CreateUserProfileError {
fn from(err: io::Error) -> CreateUserProfileError {
CreateUserProfileError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for CreateUserProfileError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for CreateUserProfileError {
fn description(&self) -> &str {
match *self {
CreateUserProfileError::UserProfileAlreadyExists(ref cause) => cause,
CreateUserProfileError::Validation(ref cause) => cause,
CreateUserProfileError::Credentials(ref err) => err.description(),
CreateUserProfileError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
CreateUserProfileError::ParseError(ref cause) => cause,
CreateUserProfileError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DeleteProjectError {
ConcurrentModification(String),
InvalidServiceRole(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 {
"ConcurrentModificationException" => {
return DeleteProjectError::ConcurrentModification(String::from(error_message));
}
"InvalidServiceRoleException" => {
return DeleteProjectError::InvalidServiceRole(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::ConcurrentModification(ref cause) => cause,
DeleteProjectError::InvalidServiceRole(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 DeleteUserProfileError {
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DeleteUserProfileError {
pub fn from_response(res: BufferedHttpResponse) -> DeleteUserProfileError {
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 DeleteUserProfileError::Validation(error_message.to_string());
}
_ => {}
}
}
return DeleteUserProfileError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DeleteUserProfileError {
fn from(err: serde_json::error::Error) -> DeleteUserProfileError {
DeleteUserProfileError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DeleteUserProfileError {
fn from(err: CredentialsError) -> DeleteUserProfileError {
DeleteUserProfileError::Credentials(err)
}
}
impl From<HttpDispatchError> for DeleteUserProfileError {
fn from(err: HttpDispatchError) -> DeleteUserProfileError {
DeleteUserProfileError::HttpDispatch(err)
}
}
impl From<io::Error> for DeleteUserProfileError {
fn from(err: io::Error) -> DeleteUserProfileError {
DeleteUserProfileError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DeleteUserProfileError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DeleteUserProfileError {
fn description(&self) -> &str {
match *self {
DeleteUserProfileError::Validation(ref cause) => cause,
DeleteUserProfileError::Credentials(ref err) => err.description(),
DeleteUserProfileError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
DeleteUserProfileError::ParseError(ref cause) => cause,
DeleteUserProfileError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DescribeProjectError {
ConcurrentModification(String),
InvalidServiceRole(String),
ProjectConfiguration(String),
ProjectNotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DescribeProjectError {
pub fn from_response(res: BufferedHttpResponse) -> DescribeProjectError {
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 {
"ConcurrentModificationException" => {
return DescribeProjectError::ConcurrentModification(String::from(error_message));
}
"InvalidServiceRoleException" => {
return DescribeProjectError::InvalidServiceRole(String::from(error_message));
}
"ProjectConfigurationException" => {
return DescribeProjectError::ProjectConfiguration(String::from(error_message));
}
"ProjectNotFoundException" => {
return DescribeProjectError::ProjectNotFound(String::from(error_message));
}
"ValidationException" => {
return DescribeProjectError::Validation(error_message.to_string());
}
_ => {}
}
}
return DescribeProjectError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DescribeProjectError {
fn from(err: serde_json::error::Error) -> DescribeProjectError {
DescribeProjectError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DescribeProjectError {
fn from(err: CredentialsError) -> DescribeProjectError {
DescribeProjectError::Credentials(err)
}
}
impl From<HttpDispatchError> for DescribeProjectError {
fn from(err: HttpDispatchError) -> DescribeProjectError {
DescribeProjectError::HttpDispatch(err)
}
}
impl From<io::Error> for DescribeProjectError {
fn from(err: io::Error) -> DescribeProjectError {
DescribeProjectError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DescribeProjectError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DescribeProjectError {
fn description(&self) -> &str {
match *self {
DescribeProjectError::ConcurrentModification(ref cause) => cause,
DescribeProjectError::InvalidServiceRole(ref cause) => cause,
DescribeProjectError::ProjectConfiguration(ref cause) => cause,
DescribeProjectError::ProjectNotFound(ref cause) => cause,
DescribeProjectError::Validation(ref cause) => cause,
DescribeProjectError::Credentials(ref err) => err.description(),
DescribeProjectError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
DescribeProjectError::ParseError(ref cause) => cause,
DescribeProjectError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DescribeUserProfileError {
UserProfileNotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DescribeUserProfileError {
pub fn from_response(res: BufferedHttpResponse) -> DescribeUserProfileError {
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 {
"UserProfileNotFoundException" => {
return DescribeUserProfileError::UserProfileNotFound(String::from(
error_message,
));
}
"ValidationException" => {
return DescribeUserProfileError::Validation(error_message.to_string());
}
_ => {}
}
}
return DescribeUserProfileError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DescribeUserProfileError {
fn from(err: serde_json::error::Error) -> DescribeUserProfileError {
DescribeUserProfileError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DescribeUserProfileError {
fn from(err: CredentialsError) -> DescribeUserProfileError {
DescribeUserProfileError::Credentials(err)
}
}
impl From<HttpDispatchError> for DescribeUserProfileError {
fn from(err: HttpDispatchError) -> DescribeUserProfileError {
DescribeUserProfileError::HttpDispatch(err)
}
}
impl From<io::Error> for DescribeUserProfileError {
fn from(err: io::Error) -> DescribeUserProfileError {
DescribeUserProfileError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DescribeUserProfileError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DescribeUserProfileError {
fn description(&self) -> &str {
match *self {
DescribeUserProfileError::UserProfileNotFound(ref cause) => cause,
DescribeUserProfileError::Validation(ref cause) => cause,
DescribeUserProfileError::Credentials(ref err) => err.description(),
DescribeUserProfileError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
DescribeUserProfileError::ParseError(ref cause) => cause,
DescribeUserProfileError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DisassociateTeamMemberError {
ConcurrentModification(String),
InvalidServiceRole(String),
ProjectNotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DisassociateTeamMemberError {
pub fn from_response(res: BufferedHttpResponse) -> DisassociateTeamMemberError {
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 {
"ConcurrentModificationException" => {
return DisassociateTeamMemberError::ConcurrentModification(String::from(
error_message,
));
}
"InvalidServiceRoleException" => {
return DisassociateTeamMemberError::InvalidServiceRole(String::from(
error_message,
));
}
"ProjectNotFoundException" => {
return DisassociateTeamMemberError::ProjectNotFound(String::from(error_message));
}
"ValidationException" => {
return DisassociateTeamMemberError::Validation(error_message.to_string());
}
_ => {}
}
}
return DisassociateTeamMemberError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DisassociateTeamMemberError {
fn from(err: serde_json::error::Error) -> DisassociateTeamMemberError {
DisassociateTeamMemberError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DisassociateTeamMemberError {
fn from(err: CredentialsError) -> DisassociateTeamMemberError {
DisassociateTeamMemberError::Credentials(err)
}
}
impl From<HttpDispatchError> for DisassociateTeamMemberError {
fn from(err: HttpDispatchError) -> DisassociateTeamMemberError {
DisassociateTeamMemberError::HttpDispatch(err)
}
}
impl From<io::Error> for DisassociateTeamMemberError {
fn from(err: io::Error) -> DisassociateTeamMemberError {
DisassociateTeamMemberError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DisassociateTeamMemberError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DisassociateTeamMemberError {
fn description(&self) -> &str {
match *self {
DisassociateTeamMemberError::ConcurrentModification(ref cause) => cause,
DisassociateTeamMemberError::InvalidServiceRole(ref cause) => cause,
DisassociateTeamMemberError::ProjectNotFound(ref cause) => cause,
DisassociateTeamMemberError::Validation(ref cause) => cause,
DisassociateTeamMemberError::Credentials(ref err) => err.description(),
DisassociateTeamMemberError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
DisassociateTeamMemberError::ParseError(ref cause) => cause,
DisassociateTeamMemberError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListProjectsError {
InvalidNextToken(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 {
"InvalidNextTokenException" => {
return ListProjectsError::InvalidNextToken(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::InvalidNextToken(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 ListResourcesError {
InvalidNextToken(String),
ProjectNotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ListResourcesError {
pub fn from_response(res: BufferedHttpResponse) -> ListResourcesError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"InvalidNextTokenException" => {
return ListResourcesError::InvalidNextToken(String::from(error_message));
}
"ProjectNotFoundException" => {
return ListResourcesError::ProjectNotFound(String::from(error_message));
}
"ValidationException" => {
return ListResourcesError::Validation(error_message.to_string());
}
_ => {}
}
}
return ListResourcesError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ListResourcesError {
fn from(err: serde_json::error::Error) -> ListResourcesError {
ListResourcesError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ListResourcesError {
fn from(err: CredentialsError) -> ListResourcesError {
ListResourcesError::Credentials(err)
}
}
impl From<HttpDispatchError> for ListResourcesError {
fn from(err: HttpDispatchError) -> ListResourcesError {
ListResourcesError::HttpDispatch(err)
}
}
impl From<io::Error> for ListResourcesError {
fn from(err: io::Error) -> ListResourcesError {
ListResourcesError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ListResourcesError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListResourcesError {
fn description(&self) -> &str {
match *self {
ListResourcesError::InvalidNextToken(ref cause) => cause,
ListResourcesError::ProjectNotFound(ref cause) => cause,
ListResourcesError::Validation(ref cause) => cause,
ListResourcesError::Credentials(ref err) => err.description(),
ListResourcesError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
ListResourcesError::ParseError(ref cause) => cause,
ListResourcesError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListTagsForProjectError {
InvalidNextToken(String),
ProjectNotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ListTagsForProjectError {
pub fn from_response(res: BufferedHttpResponse) -> ListTagsForProjectError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"InvalidNextTokenException" => {
return ListTagsForProjectError::InvalidNextToken(String::from(error_message));
}
"ProjectNotFoundException" => {
return ListTagsForProjectError::ProjectNotFound(String::from(error_message));
}
"ValidationException" => {
return ListTagsForProjectError::Validation(error_message.to_string());
}
_ => {}
}
}
return ListTagsForProjectError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ListTagsForProjectError {
fn from(err: serde_json::error::Error) -> ListTagsForProjectError {
ListTagsForProjectError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ListTagsForProjectError {
fn from(err: CredentialsError) -> ListTagsForProjectError {
ListTagsForProjectError::Credentials(err)
}
}
impl From<HttpDispatchError> for ListTagsForProjectError {
fn from(err: HttpDispatchError) -> ListTagsForProjectError {
ListTagsForProjectError::HttpDispatch(err)
}
}
impl From<io::Error> for ListTagsForProjectError {
fn from(err: io::Error) -> ListTagsForProjectError {
ListTagsForProjectError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ListTagsForProjectError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListTagsForProjectError {
fn description(&self) -> &str {
match *self {
ListTagsForProjectError::InvalidNextToken(ref cause) => cause,
ListTagsForProjectError::ProjectNotFound(ref cause) => cause,
ListTagsForProjectError::Validation(ref cause) => cause,
ListTagsForProjectError::Credentials(ref err) => err.description(),
ListTagsForProjectError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
ListTagsForProjectError::ParseError(ref cause) => cause,
ListTagsForProjectError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListTeamMembersError {
InvalidNextToken(String),
ProjectNotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ListTeamMembersError {
pub fn from_response(res: BufferedHttpResponse) -> ListTeamMembersError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"InvalidNextTokenException" => {
return ListTeamMembersError::InvalidNextToken(String::from(error_message));
}
"ProjectNotFoundException" => {
return ListTeamMembersError::ProjectNotFound(String::from(error_message));
}
"ValidationException" => {
return ListTeamMembersError::Validation(error_message.to_string());
}
_ => {}
}
}
return ListTeamMembersError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ListTeamMembersError {
fn from(err: serde_json::error::Error) -> ListTeamMembersError {
ListTeamMembersError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ListTeamMembersError {
fn from(err: CredentialsError) -> ListTeamMembersError {
ListTeamMembersError::Credentials(err)
}
}
impl From<HttpDispatchError> for ListTeamMembersError {
fn from(err: HttpDispatchError) -> ListTeamMembersError {
ListTeamMembersError::HttpDispatch(err)
}
}
impl From<io::Error> for ListTeamMembersError {
fn from(err: io::Error) -> ListTeamMembersError {
ListTeamMembersError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ListTeamMembersError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListTeamMembersError {
fn description(&self) -> &str {
match *self {
ListTeamMembersError::InvalidNextToken(ref cause) => cause,
ListTeamMembersError::ProjectNotFound(ref cause) => cause,
ListTeamMembersError::Validation(ref cause) => cause,
ListTeamMembersError::Credentials(ref err) => err.description(),
ListTeamMembersError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
ListTeamMembersError::ParseError(ref cause) => cause,
ListTeamMembersError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListUserProfilesError {
InvalidNextToken(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ListUserProfilesError {
pub fn from_response(res: BufferedHttpResponse) -> ListUserProfilesError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"InvalidNextTokenException" => {
return ListUserProfilesError::InvalidNextToken(String::from(error_message));
}
"ValidationException" => {
return ListUserProfilesError::Validation(error_message.to_string());
}
_ => {}
}
}
return ListUserProfilesError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ListUserProfilesError {
fn from(err: serde_json::error::Error) -> ListUserProfilesError {
ListUserProfilesError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ListUserProfilesError {
fn from(err: CredentialsError) -> ListUserProfilesError {
ListUserProfilesError::Credentials(err)
}
}
impl From<HttpDispatchError> for ListUserProfilesError {
fn from(err: HttpDispatchError) -> ListUserProfilesError {
ListUserProfilesError::HttpDispatch(err)
}
}
impl From<io::Error> for ListUserProfilesError {
fn from(err: io::Error) -> ListUserProfilesError {
ListUserProfilesError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ListUserProfilesError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListUserProfilesError {
fn description(&self) -> &str {
match *self {
ListUserProfilesError::InvalidNextToken(ref cause) => cause,
ListUserProfilesError::Validation(ref cause) => cause,
ListUserProfilesError::Credentials(ref err) => err.description(),
ListUserProfilesError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
ListUserProfilesError::ParseError(ref cause) => cause,
ListUserProfilesError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum TagProjectError {
ConcurrentModification(String),
LimitExceeded(String),
ProjectNotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl TagProjectError {
pub fn from_response(res: BufferedHttpResponse) -> TagProjectError {
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 {
"ConcurrentModificationException" => {
return TagProjectError::ConcurrentModification(String::from(error_message));
}
"LimitExceededException" => {
return TagProjectError::LimitExceeded(String::from(error_message));
}
"ProjectNotFoundException" => {
return TagProjectError::ProjectNotFound(String::from(error_message));
}
"ValidationException" => {
return TagProjectError::Validation(error_message.to_string());
}
_ => {}
}
}
return TagProjectError::Unknown(res);
}
}
impl From<serde_json::error::Error> for TagProjectError {
fn from(err: serde_json::error::Error) -> TagProjectError {
TagProjectError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for TagProjectError {
fn from(err: CredentialsError) -> TagProjectError {
TagProjectError::Credentials(err)
}
}
impl From<HttpDispatchError> for TagProjectError {
fn from(err: HttpDispatchError) -> TagProjectError {
TagProjectError::HttpDispatch(err)
}
}
impl From<io::Error> for TagProjectError {
fn from(err: io::Error) -> TagProjectError {
TagProjectError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for TagProjectError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for TagProjectError {
fn description(&self) -> &str {
match *self {
TagProjectError::ConcurrentModification(ref cause) => cause,
TagProjectError::LimitExceeded(ref cause) => cause,
TagProjectError::ProjectNotFound(ref cause) => cause,
TagProjectError::Validation(ref cause) => cause,
TagProjectError::Credentials(ref err) => err.description(),
TagProjectError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
TagProjectError::ParseError(ref cause) => cause,
TagProjectError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum UntagProjectError {
ConcurrentModification(String),
LimitExceeded(String),
ProjectNotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl UntagProjectError {
pub fn from_response(res: BufferedHttpResponse) -> UntagProjectError {
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 {
"ConcurrentModificationException" => {
return UntagProjectError::ConcurrentModification(String::from(error_message));
}
"LimitExceededException" => {
return UntagProjectError::LimitExceeded(String::from(error_message));
}
"ProjectNotFoundException" => {
return UntagProjectError::ProjectNotFound(String::from(error_message));
}
"ValidationException" => {
return UntagProjectError::Validation(error_message.to_string());
}
_ => {}
}
}
return UntagProjectError::Unknown(res);
}
}
impl From<serde_json::error::Error> for UntagProjectError {
fn from(err: serde_json::error::Error) -> UntagProjectError {
UntagProjectError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for UntagProjectError {
fn from(err: CredentialsError) -> UntagProjectError {
UntagProjectError::Credentials(err)
}
}
impl From<HttpDispatchError> for UntagProjectError {
fn from(err: HttpDispatchError) -> UntagProjectError {
UntagProjectError::HttpDispatch(err)
}
}
impl From<io::Error> for UntagProjectError {
fn from(err: io::Error) -> UntagProjectError {
UntagProjectError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for UntagProjectError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for UntagProjectError {
fn description(&self) -> &str {
match *self {
UntagProjectError::ConcurrentModification(ref cause) => cause,
UntagProjectError::LimitExceeded(ref cause) => cause,
UntagProjectError::ProjectNotFound(ref cause) => cause,
UntagProjectError::Validation(ref cause) => cause,
UntagProjectError::Credentials(ref err) => err.description(),
UntagProjectError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
UntagProjectError::ParseError(ref cause) => cause,
UntagProjectError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum UpdateProjectError {
ProjectNotFound(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 {
"ProjectNotFoundException" => {
return UpdateProjectError::ProjectNotFound(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::ProjectNotFound(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 UpdateTeamMemberError {
ConcurrentModification(String),
InvalidServiceRole(String),
LimitExceeded(String),
ProjectConfiguration(String),
ProjectNotFound(String),
TeamMemberNotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl UpdateTeamMemberError {
pub fn from_response(res: BufferedHttpResponse) -> UpdateTeamMemberError {
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 {
"ConcurrentModificationException" => {
return UpdateTeamMemberError::ConcurrentModification(String::from(
error_message,
));
}
"InvalidServiceRoleException" => {
return UpdateTeamMemberError::InvalidServiceRole(String::from(error_message));
}
"LimitExceededException" => {
return UpdateTeamMemberError::LimitExceeded(String::from(error_message));
}
"ProjectConfigurationException" => {
return UpdateTeamMemberError::ProjectConfiguration(String::from(error_message));
}
"ProjectNotFoundException" => {
return UpdateTeamMemberError::ProjectNotFound(String::from(error_message));
}
"TeamMemberNotFoundException" => {
return UpdateTeamMemberError::TeamMemberNotFound(String::from(error_message));
}
"ValidationException" => {
return UpdateTeamMemberError::Validation(error_message.to_string());
}
_ => {}
}
}
return UpdateTeamMemberError::Unknown(res);
}
}
impl From<serde_json::error::Error> for UpdateTeamMemberError {
fn from(err: serde_json::error::Error) -> UpdateTeamMemberError {
UpdateTeamMemberError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for UpdateTeamMemberError {
fn from(err: CredentialsError) -> UpdateTeamMemberError {
UpdateTeamMemberError::Credentials(err)
}
}
impl From<HttpDispatchError> for UpdateTeamMemberError {
fn from(err: HttpDispatchError) -> UpdateTeamMemberError {
UpdateTeamMemberError::HttpDispatch(err)
}
}
impl From<io::Error> for UpdateTeamMemberError {
fn from(err: io::Error) -> UpdateTeamMemberError {
UpdateTeamMemberError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for UpdateTeamMemberError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for UpdateTeamMemberError {
fn description(&self) -> &str {
match *self {
UpdateTeamMemberError::ConcurrentModification(ref cause) => cause,
UpdateTeamMemberError::InvalidServiceRole(ref cause) => cause,
UpdateTeamMemberError::LimitExceeded(ref cause) => cause,
UpdateTeamMemberError::ProjectConfiguration(ref cause) => cause,
UpdateTeamMemberError::ProjectNotFound(ref cause) => cause,
UpdateTeamMemberError::TeamMemberNotFound(ref cause) => cause,
UpdateTeamMemberError::Validation(ref cause) => cause,
UpdateTeamMemberError::Credentials(ref err) => err.description(),
UpdateTeamMemberError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
UpdateTeamMemberError::ParseError(ref cause) => cause,
UpdateTeamMemberError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum UpdateUserProfileError {
UserProfileNotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl UpdateUserProfileError {
pub fn from_response(res: BufferedHttpResponse) -> UpdateUserProfileError {
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 {
"UserProfileNotFoundException" => {
return UpdateUserProfileError::UserProfileNotFound(String::from(error_message));
}
"ValidationException" => {
return UpdateUserProfileError::Validation(error_message.to_string());
}
_ => {}
}
}
return UpdateUserProfileError::Unknown(res);
}
}
impl From<serde_json::error::Error> for UpdateUserProfileError {
fn from(err: serde_json::error::Error) -> UpdateUserProfileError {
UpdateUserProfileError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for UpdateUserProfileError {
fn from(err: CredentialsError) -> UpdateUserProfileError {
UpdateUserProfileError::Credentials(err)
}
}
impl From<HttpDispatchError> for UpdateUserProfileError {
fn from(err: HttpDispatchError) -> UpdateUserProfileError {
UpdateUserProfileError::HttpDispatch(err)
}
}
impl From<io::Error> for UpdateUserProfileError {
fn from(err: io::Error) -> UpdateUserProfileError {
UpdateUserProfileError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for UpdateUserProfileError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for UpdateUserProfileError {
fn description(&self) -> &str {
match *self {
UpdateUserProfileError::UserProfileNotFound(ref cause) => cause,
UpdateUserProfileError::Validation(ref cause) => cause,
UpdateUserProfileError::Credentials(ref err) => err.description(),
UpdateUserProfileError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
UpdateUserProfileError::ParseError(ref cause) => cause,
UpdateUserProfileError::Unknown(_) => "unknown error",
}
}
}
pub trait CodeStar {
fn associate_team_member(
&self,
input: AssociateTeamMemberRequest,
) -> RusotoFuture<AssociateTeamMemberResult, AssociateTeamMemberError>;
fn create_project(
&self,
input: CreateProjectRequest,
) -> RusotoFuture<CreateProjectResult, CreateProjectError>;
fn create_user_profile(
&self,
input: CreateUserProfileRequest,
) -> RusotoFuture<CreateUserProfileResult, CreateUserProfileError>;
fn delete_project(
&self,
input: DeleteProjectRequest,
) -> RusotoFuture<DeleteProjectResult, DeleteProjectError>;
fn delete_user_profile(
&self,
input: DeleteUserProfileRequest,
) -> RusotoFuture<DeleteUserProfileResult, DeleteUserProfileError>;
fn describe_project(
&self,
input: DescribeProjectRequest,
) -> RusotoFuture<DescribeProjectResult, DescribeProjectError>;
fn describe_user_profile(
&self,
input: DescribeUserProfileRequest,
) -> RusotoFuture<DescribeUserProfileResult, DescribeUserProfileError>;
fn disassociate_team_member(
&self,
input: DisassociateTeamMemberRequest,
) -> RusotoFuture<DisassociateTeamMemberResult, DisassociateTeamMemberError>;
fn list_projects(
&self,
input: ListProjectsRequest,
) -> RusotoFuture<ListProjectsResult, ListProjectsError>;
fn list_resources(
&self,
input: ListResourcesRequest,
) -> RusotoFuture<ListResourcesResult, ListResourcesError>;
fn list_tags_for_project(
&self,
input: ListTagsForProjectRequest,
) -> RusotoFuture<ListTagsForProjectResult, ListTagsForProjectError>;
fn list_team_members(
&self,
input: ListTeamMembersRequest,
) -> RusotoFuture<ListTeamMembersResult, ListTeamMembersError>;
fn list_user_profiles(
&self,
input: ListUserProfilesRequest,
) -> RusotoFuture<ListUserProfilesResult, ListUserProfilesError>;
fn tag_project(
&self,
input: TagProjectRequest,
) -> RusotoFuture<TagProjectResult, TagProjectError>;
fn untag_project(
&self,
input: UntagProjectRequest,
) -> RusotoFuture<UntagProjectResult, UntagProjectError>;
fn update_project(
&self,
input: UpdateProjectRequest,
) -> RusotoFuture<UpdateProjectResult, UpdateProjectError>;
fn update_team_member(
&self,
input: UpdateTeamMemberRequest,
) -> RusotoFuture<UpdateTeamMemberResult, UpdateTeamMemberError>;
fn update_user_profile(
&self,
input: UpdateUserProfileRequest,
) -> RusotoFuture<UpdateUserProfileResult, UpdateUserProfileError>;
}
#[derive(Clone)]
pub struct CodeStarClient {
client: Client,
region: region::Region,
}
impl CodeStarClient {
pub fn new(region: region::Region) -> CodeStarClient {
CodeStarClient {
client: Client::shared(),
region: region,
}
}
pub fn new_with<P, D>(
request_dispatcher: D,
credentials_provider: P,
region: region::Region,
) -> CodeStarClient
where
P: ProvideAwsCredentials + Send + Sync + 'static,
P::Future: Send,
D: DispatchSignedRequest + Send + Sync + 'static,
D::Future: Send,
{
CodeStarClient {
client: Client::new_with(credentials_provider, request_dispatcher),
region: region,
}
}
}
impl CodeStar for CodeStarClient {
fn associate_team_member(
&self,
input: AssociateTeamMemberRequest,
) -> RusotoFuture<AssociateTeamMemberResult, AssociateTeamMemberError> {
let mut request = SignedRequest::new("POST", "codestar", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "CodeStar_20170419.AssociateTeamMember");
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::<AssociateTeamMemberResult>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(AssociateTeamMemberError::from_response(response))
}),
)
}
})
}
fn create_project(
&self,
input: CreateProjectRequest,
) -> RusotoFuture<CreateProjectResult, CreateProjectError> {
let mut request = SignedRequest::new("POST", "codestar", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "CodeStar_20170419.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::<CreateProjectResult>(
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_user_profile(
&self,
input: CreateUserProfileRequest,
) -> RusotoFuture<CreateUserProfileResult, CreateUserProfileError> {
let mut request = SignedRequest::new("POST", "codestar", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "CodeStar_20170419.CreateUserProfile");
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::<CreateUserProfileResult>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(CreateUserProfileError::from_response(response))),
)
}
})
}
fn delete_project(
&self,
input: DeleteProjectRequest,
) -> RusotoFuture<DeleteProjectResult, DeleteProjectError> {
let mut request = SignedRequest::new("POST", "codestar", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "CodeStar_20170419.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::<DeleteProjectResult>(
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_user_profile(
&self,
input: DeleteUserProfileRequest,
) -> RusotoFuture<DeleteUserProfileResult, DeleteUserProfileError> {
let mut request = SignedRequest::new("POST", "codestar", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "CodeStar_20170419.DeleteUserProfile");
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::<DeleteUserProfileResult>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(DeleteUserProfileError::from_response(response))),
)
}
})
}
fn describe_project(
&self,
input: DescribeProjectRequest,
) -> RusotoFuture<DescribeProjectResult, DescribeProjectError> {
let mut request = SignedRequest::new("POST", "codestar", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "CodeStar_20170419.DescribeProject");
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::<DescribeProjectResult>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(DescribeProjectError::from_response(response))),
)
}
})
}
fn describe_user_profile(
&self,
input: DescribeUserProfileRequest,
) -> RusotoFuture<DescribeUserProfileResult, DescribeUserProfileError> {
let mut request = SignedRequest::new("POST", "codestar", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "CodeStar_20170419.DescribeUserProfile");
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::<DescribeUserProfileResult>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(DescribeUserProfileError::from_response(response))
}),
)
}
})
}
fn disassociate_team_member(
&self,
input: DisassociateTeamMemberRequest,
) -> RusotoFuture<DisassociateTeamMemberResult, DisassociateTeamMemberError> {
let mut request = SignedRequest::new("POST", "codestar", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "CodeStar_20170419.DisassociateTeamMember");
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::<DisassociateTeamMemberResult>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(DisassociateTeamMemberError::from_response(response))
}),
)
}
})
}
fn list_projects(
&self,
input: ListProjectsRequest,
) -> RusotoFuture<ListProjectsResult, ListProjectsError> {
let mut request = SignedRequest::new("POST", "codestar", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "CodeStar_20170419.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::<ListProjectsResult>(
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_resources(
&self,
input: ListResourcesRequest,
) -> RusotoFuture<ListResourcesResult, ListResourcesError> {
let mut request = SignedRequest::new("POST", "codestar", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "CodeStar_20170419.ListResources");
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::<ListResourcesResult>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(ListResourcesError::from_response(response))),
)
}
})
}
fn list_tags_for_project(
&self,
input: ListTagsForProjectRequest,
) -> RusotoFuture<ListTagsForProjectResult, ListTagsForProjectError> {
let mut request = SignedRequest::new("POST", "codestar", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "CodeStar_20170419.ListTagsForProject");
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::<ListTagsForProjectResult>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(ListTagsForProjectError::from_response(response))),
)
}
})
}
fn list_team_members(
&self,
input: ListTeamMembersRequest,
) -> RusotoFuture<ListTeamMembersResult, ListTeamMembersError> {
let mut request = SignedRequest::new("POST", "codestar", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "CodeStar_20170419.ListTeamMembers");
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::<ListTeamMembersResult>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(ListTeamMembersError::from_response(response))),
)
}
})
}
fn list_user_profiles(
&self,
input: ListUserProfilesRequest,
) -> RusotoFuture<ListUserProfilesResult, ListUserProfilesError> {
let mut request = SignedRequest::new("POST", "codestar", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "CodeStar_20170419.ListUserProfiles");
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::<ListUserProfilesResult>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(ListUserProfilesError::from_response(response))),
)
}
})
}
fn tag_project(
&self,
input: TagProjectRequest,
) -> RusotoFuture<TagProjectResult, TagProjectError> {
let mut request = SignedRequest::new("POST", "codestar", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "CodeStar_20170419.TagProject");
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::<TagProjectResult>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(TagProjectError::from_response(response))),
)
}
})
}
fn untag_project(
&self,
input: UntagProjectRequest,
) -> RusotoFuture<UntagProjectResult, UntagProjectError> {
let mut request = SignedRequest::new("POST", "codestar", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "CodeStar_20170419.UntagProject");
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::<UntagProjectResult>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(UntagProjectError::from_response(response))),
)
}
})
}
fn update_project(
&self,
input: UpdateProjectRequest,
) -> RusotoFuture<UpdateProjectResult, UpdateProjectError> {
let mut request = SignedRequest::new("POST", "codestar", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "CodeStar_20170419.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::<UpdateProjectResult>(
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_team_member(
&self,
input: UpdateTeamMemberRequest,
) -> RusotoFuture<UpdateTeamMemberResult, UpdateTeamMemberError> {
let mut request = SignedRequest::new("POST", "codestar", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "CodeStar_20170419.UpdateTeamMember");
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::<UpdateTeamMemberResult>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(UpdateTeamMemberError::from_response(response))),
)
}
})
}
fn update_user_profile(
&self,
input: UpdateUserProfileRequest,
) -> RusotoFuture<UpdateUserProfileResult, UpdateUserProfileError> {
let mut request = SignedRequest::new("POST", "codestar", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "CodeStar_20170419.UpdateUserProfile");
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::<UpdateUserProfileResult>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(UpdateUserProfileError::from_response(response))),
)
}
})
}
}
#[cfg(test)]
mod protocol_tests {}