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 BatchGetRepositoriesInput {
#[serde(rename = "repositoryNames")]
pub repository_names: Vec<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct BatchGetRepositoriesOutput {
#[serde(rename = "repositories")]
#[serde(skip_serializing_if = "Option::is_none")]
pub repositories: Option<Vec<RepositoryMetadata>>,
#[serde(rename = "repositoriesNotFound")]
#[serde(skip_serializing_if = "Option::is_none")]
pub repositories_not_found: Option<Vec<String>>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct BlobMetadata {
#[serde(rename = "blobId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub blob_id: Option<String>,
#[serde(rename = "mode")]
#[serde(skip_serializing_if = "Option::is_none")]
pub mode: Option<String>,
#[serde(rename = "path")]
#[serde(skip_serializing_if = "Option::is_none")]
pub path: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct BranchInfo {
#[serde(rename = "branchName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub branch_name: Option<String>,
#[serde(rename = "commitId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub commit_id: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct Comment {
#[serde(rename = "authorArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub author_arn: Option<String>,
#[serde(rename = "clientRequestToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub client_request_token: Option<String>,
#[serde(rename = "commentId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub comment_id: Option<String>,
#[serde(rename = "content")]
#[serde(skip_serializing_if = "Option::is_none")]
pub content: Option<String>,
#[serde(rename = "creationDate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub creation_date: Option<f64>,
#[serde(rename = "deleted")]
#[serde(skip_serializing_if = "Option::is_none")]
pub deleted: Option<bool>,
#[serde(rename = "inReplyTo")]
#[serde(skip_serializing_if = "Option::is_none")]
pub in_reply_to: Option<String>,
#[serde(rename = "lastModifiedDate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub last_modified_date: Option<f64>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct CommentsForComparedCommit {
#[serde(rename = "afterBlobId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub after_blob_id: Option<String>,
#[serde(rename = "afterCommitId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub after_commit_id: Option<String>,
#[serde(rename = "beforeBlobId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub before_blob_id: Option<String>,
#[serde(rename = "beforeCommitId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub before_commit_id: Option<String>,
#[serde(rename = "comments")]
#[serde(skip_serializing_if = "Option::is_none")]
pub comments: Option<Vec<Comment>>,
#[serde(rename = "location")]
#[serde(skip_serializing_if = "Option::is_none")]
pub location: Option<Location>,
#[serde(rename = "repositoryName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub repository_name: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct CommentsForPullRequest {
#[serde(rename = "afterBlobId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub after_blob_id: Option<String>,
#[serde(rename = "afterCommitId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub after_commit_id: Option<String>,
#[serde(rename = "beforeBlobId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub before_blob_id: Option<String>,
#[serde(rename = "beforeCommitId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub before_commit_id: Option<String>,
#[serde(rename = "comments")]
#[serde(skip_serializing_if = "Option::is_none")]
pub comments: Option<Vec<Comment>>,
#[serde(rename = "location")]
#[serde(skip_serializing_if = "Option::is_none")]
pub location: Option<Location>,
#[serde(rename = "pullRequestId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub pull_request_id: Option<String>,
#[serde(rename = "repositoryName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub repository_name: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct Commit {
#[serde(rename = "additionalData")]
#[serde(skip_serializing_if = "Option::is_none")]
pub additional_data: Option<String>,
#[serde(rename = "author")]
#[serde(skip_serializing_if = "Option::is_none")]
pub author: Option<UserInfo>,
#[serde(rename = "commitId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub commit_id: Option<String>,
#[serde(rename = "committer")]
#[serde(skip_serializing_if = "Option::is_none")]
pub committer: Option<UserInfo>,
#[serde(rename = "message")]
#[serde(skip_serializing_if = "Option::is_none")]
pub message: Option<String>,
#[serde(rename = "parents")]
#[serde(skip_serializing_if = "Option::is_none")]
pub parents: Option<Vec<String>>,
#[serde(rename = "treeId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub tree_id: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct CreateBranchInput {
#[serde(rename = "branchName")]
pub branch_name: String,
#[serde(rename = "commitId")]
pub commit_id: String,
#[serde(rename = "repositoryName")]
pub repository_name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct CreateCommitInput {
#[serde(rename = "authorName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub author_name: Option<String>,
#[serde(rename = "branchName")]
pub branch_name: String,
#[serde(rename = "commitMessage")]
#[serde(skip_serializing_if = "Option::is_none")]
pub commit_message: Option<String>,
#[serde(rename = "deleteFiles")]
#[serde(skip_serializing_if = "Option::is_none")]
pub delete_files: Option<Vec<DeleteFileEntry>>,
#[serde(rename = "email")]
#[serde(skip_serializing_if = "Option::is_none")]
pub email: Option<String>,
#[serde(rename = "keepEmptyFolders")]
#[serde(skip_serializing_if = "Option::is_none")]
pub keep_empty_folders: Option<bool>,
#[serde(rename = "parentCommitId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub parent_commit_id: Option<String>,
#[serde(rename = "putFiles")]
#[serde(skip_serializing_if = "Option::is_none")]
pub put_files: Option<Vec<PutFileEntry>>,
#[serde(rename = "repositoryName")]
pub repository_name: String,
#[serde(rename = "setFileModes")]
#[serde(skip_serializing_if = "Option::is_none")]
pub set_file_modes: Option<Vec<SetFileModeEntry>>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct CreateCommitOutput {
#[serde(rename = "commitId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub commit_id: Option<String>,
#[serde(rename = "filesAdded")]
#[serde(skip_serializing_if = "Option::is_none")]
pub files_added: Option<Vec<FileMetadata>>,
#[serde(rename = "filesDeleted")]
#[serde(skip_serializing_if = "Option::is_none")]
pub files_deleted: Option<Vec<FileMetadata>>,
#[serde(rename = "filesUpdated")]
#[serde(skip_serializing_if = "Option::is_none")]
pub files_updated: Option<Vec<FileMetadata>>,
#[serde(rename = "treeId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub tree_id: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct CreatePullRequestInput {
#[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 = "targets")]
pub targets: Vec<Target>,
#[serde(rename = "title")]
pub title: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct CreatePullRequestOutput {
#[serde(rename = "pullRequest")]
pub pull_request: PullRequest,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct CreateRepositoryInput {
#[serde(rename = "repositoryDescription")]
#[serde(skip_serializing_if = "Option::is_none")]
pub repository_description: Option<String>,
#[serde(rename = "repositoryName")]
pub repository_name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct CreateRepositoryOutput {
#[serde(rename = "repositoryMetadata")]
#[serde(skip_serializing_if = "Option::is_none")]
pub repository_metadata: Option<RepositoryMetadata>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DeleteBranchInput {
#[serde(rename = "branchName")]
pub branch_name: String,
#[serde(rename = "repositoryName")]
pub repository_name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DeleteBranchOutput {
#[serde(rename = "deletedBranch")]
#[serde(skip_serializing_if = "Option::is_none")]
pub deleted_branch: Option<BranchInfo>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DeleteCommentContentInput {
#[serde(rename = "commentId")]
pub comment_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DeleteCommentContentOutput {
#[serde(rename = "comment")]
#[serde(skip_serializing_if = "Option::is_none")]
pub comment: Option<Comment>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DeleteFileEntry {
#[serde(rename = "filePath")]
pub file_path: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DeleteFileInput {
#[serde(rename = "branchName")]
pub branch_name: String,
#[serde(rename = "commitMessage")]
#[serde(skip_serializing_if = "Option::is_none")]
pub commit_message: Option<String>,
#[serde(rename = "email")]
#[serde(skip_serializing_if = "Option::is_none")]
pub email: Option<String>,
#[serde(rename = "filePath")]
pub file_path: String,
#[serde(rename = "keepEmptyFolders")]
#[serde(skip_serializing_if = "Option::is_none")]
pub keep_empty_folders: Option<bool>,
#[serde(rename = "name")]
#[serde(skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
#[serde(rename = "parentCommitId")]
pub parent_commit_id: String,
#[serde(rename = "repositoryName")]
pub repository_name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DeleteFileOutput {
#[serde(rename = "blobId")]
pub blob_id: String,
#[serde(rename = "commitId")]
pub commit_id: String,
#[serde(rename = "filePath")]
pub file_path: String,
#[serde(rename = "treeId")]
pub tree_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DeleteRepositoryInput {
#[serde(rename = "repositoryName")]
pub repository_name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DeleteRepositoryOutput {
#[serde(rename = "repositoryId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub repository_id: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DescribePullRequestEventsInput {
#[serde(rename = "actorArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub actor_arn: Option<String>,
#[serde(rename = "maxResults")]
#[serde(skip_serializing_if = "Option::is_none")]
pub max_results: Option<i64>,
#[serde(rename = "nextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "pullRequestEventType")]
#[serde(skip_serializing_if = "Option::is_none")]
pub pull_request_event_type: Option<String>,
#[serde(rename = "pullRequestId")]
pub pull_request_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DescribePullRequestEventsOutput {
#[serde(rename = "nextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "pullRequestEvents")]
pub pull_request_events: Vec<PullRequestEvent>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct Difference {
#[serde(rename = "afterBlob")]
#[serde(skip_serializing_if = "Option::is_none")]
pub after_blob: Option<BlobMetadata>,
#[serde(rename = "beforeBlob")]
#[serde(skip_serializing_if = "Option::is_none")]
pub before_blob: Option<BlobMetadata>,
#[serde(rename = "changeType")]
#[serde(skip_serializing_if = "Option::is_none")]
pub change_type: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct File {
#[serde(rename = "absolutePath")]
#[serde(skip_serializing_if = "Option::is_none")]
pub absolute_path: Option<String>,
#[serde(rename = "blobId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub blob_id: Option<String>,
#[serde(rename = "fileMode")]
#[serde(skip_serializing_if = "Option::is_none")]
pub file_mode: Option<String>,
#[serde(rename = "relativePath")]
#[serde(skip_serializing_if = "Option::is_none")]
pub relative_path: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct FileMetadata {
#[serde(rename = "absolutePath")]
#[serde(skip_serializing_if = "Option::is_none")]
pub absolute_path: Option<String>,
#[serde(rename = "blobId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub blob_id: Option<String>,
#[serde(rename = "fileMode")]
#[serde(skip_serializing_if = "Option::is_none")]
pub file_mode: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct Folder {
#[serde(rename = "absolutePath")]
#[serde(skip_serializing_if = "Option::is_none")]
pub absolute_path: Option<String>,
#[serde(rename = "relativePath")]
#[serde(skip_serializing_if = "Option::is_none")]
pub relative_path: Option<String>,
#[serde(rename = "treeId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub tree_id: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetBlobInput {
#[serde(rename = "blobId")]
pub blob_id: String,
#[serde(rename = "repositoryName")]
pub repository_name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct GetBlobOutput {
#[serde(rename = "content")]
#[serde(
deserialize_with = "::rusoto_core::serialization::SerdeBlob::deserialize_blob",
serialize_with = "::rusoto_core::serialization::SerdeBlob::serialize_blob",
default
)]
pub content: Vec<u8>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetBranchInput {
#[serde(rename = "branchName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub branch_name: Option<String>,
#[serde(rename = "repositoryName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub repository_name: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct GetBranchOutput {
#[serde(rename = "branch")]
#[serde(skip_serializing_if = "Option::is_none")]
pub branch: Option<BranchInfo>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetCommentInput {
#[serde(rename = "commentId")]
pub comment_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct GetCommentOutput {
#[serde(rename = "comment")]
#[serde(skip_serializing_if = "Option::is_none")]
pub comment: Option<Comment>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetCommentsForComparedCommitInput {
#[serde(rename = "afterCommitId")]
pub after_commit_id: String,
#[serde(rename = "beforeCommitId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub before_commit_id: Option<String>,
#[serde(rename = "maxResults")]
#[serde(skip_serializing_if = "Option::is_none")]
pub max_results: Option<i64>,
#[serde(rename = "nextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "repositoryName")]
pub repository_name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct GetCommentsForComparedCommitOutput {
#[serde(rename = "commentsForComparedCommitData")]
#[serde(skip_serializing_if = "Option::is_none")]
pub comments_for_compared_commit_data: Option<Vec<CommentsForComparedCommit>>,
#[serde(rename = "nextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetCommentsForPullRequestInput {
#[serde(rename = "afterCommitId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub after_commit_id: Option<String>,
#[serde(rename = "beforeCommitId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub before_commit_id: Option<String>,
#[serde(rename = "maxResults")]
#[serde(skip_serializing_if = "Option::is_none")]
pub max_results: Option<i64>,
#[serde(rename = "nextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "pullRequestId")]
pub pull_request_id: String,
#[serde(rename = "repositoryName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub repository_name: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct GetCommentsForPullRequestOutput {
#[serde(rename = "commentsForPullRequestData")]
#[serde(skip_serializing_if = "Option::is_none")]
pub comments_for_pull_request_data: Option<Vec<CommentsForPullRequest>>,
#[serde(rename = "nextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetCommitInput {
#[serde(rename = "commitId")]
pub commit_id: String,
#[serde(rename = "repositoryName")]
pub repository_name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct GetCommitOutput {
#[serde(rename = "commit")]
pub commit: Commit,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetDifferencesInput {
#[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 = "afterCommitSpecifier")]
pub after_commit_specifier: String,
#[serde(rename = "afterPath")]
#[serde(skip_serializing_if = "Option::is_none")]
pub after_path: Option<String>,
#[serde(rename = "beforeCommitSpecifier")]
#[serde(skip_serializing_if = "Option::is_none")]
pub before_commit_specifier: Option<String>,
#[serde(rename = "beforePath")]
#[serde(skip_serializing_if = "Option::is_none")]
pub before_path: Option<String>,
#[serde(rename = "repositoryName")]
pub repository_name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct GetDifferencesOutput {
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "differences")]
#[serde(skip_serializing_if = "Option::is_none")]
pub differences: Option<Vec<Difference>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetFileInput {
#[serde(rename = "commitSpecifier")]
#[serde(skip_serializing_if = "Option::is_none")]
pub commit_specifier: Option<String>,
#[serde(rename = "filePath")]
pub file_path: String,
#[serde(rename = "repositoryName")]
pub repository_name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct GetFileOutput {
#[serde(rename = "blobId")]
pub blob_id: String,
#[serde(rename = "commitId")]
pub commit_id: String,
#[serde(rename = "fileContent")]
#[serde(
deserialize_with = "::rusoto_core::serialization::SerdeBlob::deserialize_blob",
serialize_with = "::rusoto_core::serialization::SerdeBlob::serialize_blob",
default
)]
pub file_content: Vec<u8>,
#[serde(rename = "fileMode")]
pub file_mode: String,
#[serde(rename = "filePath")]
pub file_path: String,
#[serde(rename = "fileSize")]
pub file_size: i64,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetFolderInput {
#[serde(rename = "commitSpecifier")]
#[serde(skip_serializing_if = "Option::is_none")]
pub commit_specifier: Option<String>,
#[serde(rename = "folderPath")]
pub folder_path: String,
#[serde(rename = "repositoryName")]
pub repository_name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct GetFolderOutput {
#[serde(rename = "commitId")]
pub commit_id: String,
#[serde(rename = "files")]
#[serde(skip_serializing_if = "Option::is_none")]
pub files: Option<Vec<File>>,
#[serde(rename = "folderPath")]
pub folder_path: String,
#[serde(rename = "subFolders")]
#[serde(skip_serializing_if = "Option::is_none")]
pub sub_folders: Option<Vec<Folder>>,
#[serde(rename = "subModules")]
#[serde(skip_serializing_if = "Option::is_none")]
pub sub_modules: Option<Vec<SubModule>>,
#[serde(rename = "symbolicLinks")]
#[serde(skip_serializing_if = "Option::is_none")]
pub symbolic_links: Option<Vec<SymbolicLink>>,
#[serde(rename = "treeId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub tree_id: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetMergeConflictsInput {
#[serde(rename = "destinationCommitSpecifier")]
pub destination_commit_specifier: String,
#[serde(rename = "mergeOption")]
pub merge_option: String,
#[serde(rename = "repositoryName")]
pub repository_name: String,
#[serde(rename = "sourceCommitSpecifier")]
pub source_commit_specifier: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct GetMergeConflictsOutput {
#[serde(rename = "destinationCommitId")]
pub destination_commit_id: String,
#[serde(rename = "mergeable")]
pub mergeable: bool,
#[serde(rename = "sourceCommitId")]
pub source_commit_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetPullRequestInput {
#[serde(rename = "pullRequestId")]
pub pull_request_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct GetPullRequestOutput {
#[serde(rename = "pullRequest")]
pub pull_request: PullRequest,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetRepositoryInput {
#[serde(rename = "repositoryName")]
pub repository_name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct GetRepositoryOutput {
#[serde(rename = "repositoryMetadata")]
#[serde(skip_serializing_if = "Option::is_none")]
pub repository_metadata: Option<RepositoryMetadata>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetRepositoryTriggersInput {
#[serde(rename = "repositoryName")]
pub repository_name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct GetRepositoryTriggersOutput {
#[serde(rename = "configurationId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub configuration_id: Option<String>,
#[serde(rename = "triggers")]
#[serde(skip_serializing_if = "Option::is_none")]
pub triggers: Option<Vec<RepositoryTrigger>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ListBranchesInput {
#[serde(rename = "nextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "repositoryName")]
pub repository_name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ListBranchesOutput {
#[serde(rename = "branches")]
#[serde(skip_serializing_if = "Option::is_none")]
pub branches: 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 ListPullRequestsInput {
#[serde(rename = "authorArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub author_arn: Option<String>,
#[serde(rename = "maxResults")]
#[serde(skip_serializing_if = "Option::is_none")]
pub max_results: Option<i64>,
#[serde(rename = "nextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "pullRequestStatus")]
#[serde(skip_serializing_if = "Option::is_none")]
pub pull_request_status: Option<String>,
#[serde(rename = "repositoryName")]
pub repository_name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ListPullRequestsOutput {
#[serde(rename = "nextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "pullRequestIds")]
pub pull_request_ids: Vec<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ListRepositoriesInput {
#[serde(rename = "nextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "order")]
#[serde(skip_serializing_if = "Option::is_none")]
pub order: Option<String>,
#[serde(rename = "sortBy")]
#[serde(skip_serializing_if = "Option::is_none")]
pub sort_by: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ListRepositoriesOutput {
#[serde(rename = "nextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "repositories")]
#[serde(skip_serializing_if = "Option::is_none")]
pub repositories: Option<Vec<RepositoryNameIdPair>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct Location {
#[serde(rename = "filePath")]
#[serde(skip_serializing_if = "Option::is_none")]
pub file_path: Option<String>,
#[serde(rename = "filePosition")]
#[serde(skip_serializing_if = "Option::is_none")]
pub file_position: Option<i64>,
#[serde(rename = "relativeFileVersion")]
#[serde(skip_serializing_if = "Option::is_none")]
pub relative_file_version: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct MergeMetadata {
#[serde(rename = "isMerged")]
#[serde(skip_serializing_if = "Option::is_none")]
pub is_merged: Option<bool>,
#[serde(rename = "mergedBy")]
#[serde(skip_serializing_if = "Option::is_none")]
pub merged_by: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct MergePullRequestByFastForwardInput {
#[serde(rename = "pullRequestId")]
pub pull_request_id: String,
#[serde(rename = "repositoryName")]
pub repository_name: String,
#[serde(rename = "sourceCommitId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub source_commit_id: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct MergePullRequestByFastForwardOutput {
#[serde(rename = "pullRequest")]
#[serde(skip_serializing_if = "Option::is_none")]
pub pull_request: Option<PullRequest>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct PostCommentForComparedCommitInput {
#[serde(rename = "afterCommitId")]
pub after_commit_id: String,
#[serde(rename = "beforeCommitId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub before_commit_id: Option<String>,
#[serde(rename = "clientRequestToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub client_request_token: Option<String>,
#[serde(rename = "content")]
pub content: String,
#[serde(rename = "location")]
#[serde(skip_serializing_if = "Option::is_none")]
pub location: Option<Location>,
#[serde(rename = "repositoryName")]
pub repository_name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct PostCommentForComparedCommitOutput {
#[serde(rename = "afterBlobId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub after_blob_id: Option<String>,
#[serde(rename = "afterCommitId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub after_commit_id: Option<String>,
#[serde(rename = "beforeBlobId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub before_blob_id: Option<String>,
#[serde(rename = "beforeCommitId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub before_commit_id: Option<String>,
#[serde(rename = "comment")]
#[serde(skip_serializing_if = "Option::is_none")]
pub comment: Option<Comment>,
#[serde(rename = "location")]
#[serde(skip_serializing_if = "Option::is_none")]
pub location: Option<Location>,
#[serde(rename = "repositoryName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub repository_name: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct PostCommentForPullRequestInput {
#[serde(rename = "afterCommitId")]
pub after_commit_id: String,
#[serde(rename = "beforeCommitId")]
pub before_commit_id: String,
#[serde(rename = "clientRequestToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub client_request_token: Option<String>,
#[serde(rename = "content")]
pub content: String,
#[serde(rename = "location")]
#[serde(skip_serializing_if = "Option::is_none")]
pub location: Option<Location>,
#[serde(rename = "pullRequestId")]
pub pull_request_id: String,
#[serde(rename = "repositoryName")]
pub repository_name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct PostCommentForPullRequestOutput {
#[serde(rename = "afterBlobId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub after_blob_id: Option<String>,
#[serde(rename = "afterCommitId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub after_commit_id: Option<String>,
#[serde(rename = "beforeBlobId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub before_blob_id: Option<String>,
#[serde(rename = "beforeCommitId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub before_commit_id: Option<String>,
#[serde(rename = "comment")]
#[serde(skip_serializing_if = "Option::is_none")]
pub comment: Option<Comment>,
#[serde(rename = "location")]
#[serde(skip_serializing_if = "Option::is_none")]
pub location: Option<Location>,
#[serde(rename = "pullRequestId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub pull_request_id: Option<String>,
#[serde(rename = "repositoryName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub repository_name: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct PostCommentReplyInput {
#[serde(rename = "clientRequestToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub client_request_token: Option<String>,
#[serde(rename = "content")]
pub content: String,
#[serde(rename = "inReplyTo")]
pub in_reply_to: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct PostCommentReplyOutput {
#[serde(rename = "comment")]
#[serde(skip_serializing_if = "Option::is_none")]
pub comment: Option<Comment>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct PullRequest {
#[serde(rename = "authorArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub author_arn: Option<String>,
#[serde(rename = "clientRequestToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub client_request_token: Option<String>,
#[serde(rename = "creationDate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub creation_date: Option<f64>,
#[serde(rename = "description")]
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[serde(rename = "lastActivityDate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub last_activity_date: Option<f64>,
#[serde(rename = "pullRequestId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub pull_request_id: Option<String>,
#[serde(rename = "pullRequestStatus")]
#[serde(skip_serializing_if = "Option::is_none")]
pub pull_request_status: Option<String>,
#[serde(rename = "pullRequestTargets")]
#[serde(skip_serializing_if = "Option::is_none")]
pub pull_request_targets: Option<Vec<PullRequestTarget>>,
#[serde(rename = "title")]
#[serde(skip_serializing_if = "Option::is_none")]
pub title: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct PullRequestCreatedEventMetadata {
#[serde(rename = "destinationCommitId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub destination_commit_id: Option<String>,
#[serde(rename = "mergeBase")]
#[serde(skip_serializing_if = "Option::is_none")]
pub merge_base: Option<String>,
#[serde(rename = "repositoryName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub repository_name: Option<String>,
#[serde(rename = "sourceCommitId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub source_commit_id: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct PullRequestEvent {
#[serde(rename = "actorArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub actor_arn: Option<String>,
#[serde(rename = "eventDate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub event_date: Option<f64>,
#[serde(rename = "pullRequestCreatedEventMetadata")]
#[serde(skip_serializing_if = "Option::is_none")]
pub pull_request_created_event_metadata: Option<PullRequestCreatedEventMetadata>,
#[serde(rename = "pullRequestEventType")]
#[serde(skip_serializing_if = "Option::is_none")]
pub pull_request_event_type: Option<String>,
#[serde(rename = "pullRequestId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub pull_request_id: Option<String>,
#[serde(rename = "pullRequestMergedStateChangedEventMetadata")]
#[serde(skip_serializing_if = "Option::is_none")]
pub pull_request_merged_state_changed_event_metadata:
Option<PullRequestMergedStateChangedEventMetadata>,
#[serde(rename = "pullRequestSourceReferenceUpdatedEventMetadata")]
#[serde(skip_serializing_if = "Option::is_none")]
pub pull_request_source_reference_updated_event_metadata:
Option<PullRequestSourceReferenceUpdatedEventMetadata>,
#[serde(rename = "pullRequestStatusChangedEventMetadata")]
#[serde(skip_serializing_if = "Option::is_none")]
pub pull_request_status_changed_event_metadata: Option<PullRequestStatusChangedEventMetadata>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct PullRequestMergedStateChangedEventMetadata {
#[serde(rename = "destinationReference")]
#[serde(skip_serializing_if = "Option::is_none")]
pub destination_reference: Option<String>,
#[serde(rename = "mergeMetadata")]
#[serde(skip_serializing_if = "Option::is_none")]
pub merge_metadata: Option<MergeMetadata>,
#[serde(rename = "repositoryName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub repository_name: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct PullRequestSourceReferenceUpdatedEventMetadata {
#[serde(rename = "afterCommitId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub after_commit_id: Option<String>,
#[serde(rename = "beforeCommitId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub before_commit_id: Option<String>,
#[serde(rename = "mergeBase")]
#[serde(skip_serializing_if = "Option::is_none")]
pub merge_base: Option<String>,
#[serde(rename = "repositoryName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub repository_name: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct PullRequestStatusChangedEventMetadata {
#[serde(rename = "pullRequestStatus")]
#[serde(skip_serializing_if = "Option::is_none")]
pub pull_request_status: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct PullRequestTarget {
#[serde(rename = "destinationCommit")]
#[serde(skip_serializing_if = "Option::is_none")]
pub destination_commit: Option<String>,
#[serde(rename = "destinationReference")]
#[serde(skip_serializing_if = "Option::is_none")]
pub destination_reference: Option<String>,
#[serde(rename = "mergeBase")]
#[serde(skip_serializing_if = "Option::is_none")]
pub merge_base: Option<String>,
#[serde(rename = "mergeMetadata")]
#[serde(skip_serializing_if = "Option::is_none")]
pub merge_metadata: Option<MergeMetadata>,
#[serde(rename = "repositoryName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub repository_name: Option<String>,
#[serde(rename = "sourceCommit")]
#[serde(skip_serializing_if = "Option::is_none")]
pub source_commit: Option<String>,
#[serde(rename = "sourceReference")]
#[serde(skip_serializing_if = "Option::is_none")]
pub source_reference: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct PutFileEntry {
#[serde(rename = "fileContent")]
#[serde(
deserialize_with = "::rusoto_core::serialization::SerdeBlob::deserialize_blob",
serialize_with = "::rusoto_core::serialization::SerdeBlob::serialize_blob",
default
)]
#[serde(skip_serializing_if = "Option::is_none")]
pub file_content: Option<Vec<u8>>,
#[serde(rename = "fileMode")]
#[serde(skip_serializing_if = "Option::is_none")]
pub file_mode: Option<String>,
#[serde(rename = "filePath")]
pub file_path: String,
#[serde(rename = "sourceFile")]
#[serde(skip_serializing_if = "Option::is_none")]
pub source_file: Option<SourceFileSpecifier>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct PutFileInput {
#[serde(rename = "branchName")]
pub branch_name: String,
#[serde(rename = "commitMessage")]
#[serde(skip_serializing_if = "Option::is_none")]
pub commit_message: Option<String>,
#[serde(rename = "email")]
#[serde(skip_serializing_if = "Option::is_none")]
pub email: Option<String>,
#[serde(rename = "fileContent")]
#[serde(
deserialize_with = "::rusoto_core::serialization::SerdeBlob::deserialize_blob",
serialize_with = "::rusoto_core::serialization::SerdeBlob::serialize_blob",
default
)]
pub file_content: Vec<u8>,
#[serde(rename = "fileMode")]
#[serde(skip_serializing_if = "Option::is_none")]
pub file_mode: Option<String>,
#[serde(rename = "filePath")]
pub file_path: String,
#[serde(rename = "name")]
#[serde(skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
#[serde(rename = "parentCommitId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub parent_commit_id: Option<String>,
#[serde(rename = "repositoryName")]
pub repository_name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct PutFileOutput {
#[serde(rename = "blobId")]
pub blob_id: String,
#[serde(rename = "commitId")]
pub commit_id: String,
#[serde(rename = "treeId")]
pub tree_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct PutRepositoryTriggersInput {
#[serde(rename = "repositoryName")]
pub repository_name: String,
#[serde(rename = "triggers")]
pub triggers: Vec<RepositoryTrigger>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct PutRepositoryTriggersOutput {
#[serde(rename = "configurationId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub configuration_id: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct RepositoryMetadata {
#[serde(rename = "Arn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub arn: Option<String>,
#[serde(rename = "accountId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub account_id: Option<String>,
#[serde(rename = "cloneUrlHttp")]
#[serde(skip_serializing_if = "Option::is_none")]
pub clone_url_http: Option<String>,
#[serde(rename = "cloneUrlSsh")]
#[serde(skip_serializing_if = "Option::is_none")]
pub clone_url_ssh: Option<String>,
#[serde(rename = "creationDate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub creation_date: Option<f64>,
#[serde(rename = "defaultBranch")]
#[serde(skip_serializing_if = "Option::is_none")]
pub default_branch: Option<String>,
#[serde(rename = "lastModifiedDate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub last_modified_date: Option<f64>,
#[serde(rename = "repositoryDescription")]
#[serde(skip_serializing_if = "Option::is_none")]
pub repository_description: Option<String>,
#[serde(rename = "repositoryId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub repository_id: Option<String>,
#[serde(rename = "repositoryName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub repository_name: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct RepositoryNameIdPair {
#[serde(rename = "repositoryId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub repository_id: Option<String>,
#[serde(rename = "repositoryName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub repository_name: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct RepositoryTrigger {
#[serde(rename = "branches")]
#[serde(skip_serializing_if = "Option::is_none")]
pub branches: Option<Vec<String>>,
#[serde(rename = "customData")]
#[serde(skip_serializing_if = "Option::is_none")]
pub custom_data: Option<String>,
#[serde(rename = "destinationArn")]
pub destination_arn: String,
#[serde(rename = "events")]
pub events: Vec<String>,
#[serde(rename = "name")]
pub name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct RepositoryTriggerExecutionFailure {
#[serde(rename = "failureMessage")]
#[serde(skip_serializing_if = "Option::is_none")]
pub failure_message: Option<String>,
#[serde(rename = "trigger")]
#[serde(skip_serializing_if = "Option::is_none")]
pub trigger: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct SetFileModeEntry {
#[serde(rename = "fileMode")]
pub file_mode: String,
#[serde(rename = "filePath")]
pub file_path: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct SourceFileSpecifier {
#[serde(rename = "filePath")]
pub file_path: String,
#[serde(rename = "isMove")]
#[serde(skip_serializing_if = "Option::is_none")]
pub is_move: Option<bool>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct SubModule {
#[serde(rename = "absolutePath")]
#[serde(skip_serializing_if = "Option::is_none")]
pub absolute_path: Option<String>,
#[serde(rename = "commitId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub commit_id: Option<String>,
#[serde(rename = "relativePath")]
#[serde(skip_serializing_if = "Option::is_none")]
pub relative_path: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct SymbolicLink {
#[serde(rename = "absolutePath")]
#[serde(skip_serializing_if = "Option::is_none")]
pub absolute_path: Option<String>,
#[serde(rename = "blobId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub blob_id: Option<String>,
#[serde(rename = "fileMode")]
#[serde(skip_serializing_if = "Option::is_none")]
pub file_mode: Option<String>,
#[serde(rename = "relativePath")]
#[serde(skip_serializing_if = "Option::is_none")]
pub relative_path: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct Target {
#[serde(rename = "destinationReference")]
#[serde(skip_serializing_if = "Option::is_none")]
pub destination_reference: Option<String>,
#[serde(rename = "repositoryName")]
pub repository_name: String,
#[serde(rename = "sourceReference")]
pub source_reference: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct TestRepositoryTriggersInput {
#[serde(rename = "repositoryName")]
pub repository_name: String,
#[serde(rename = "triggers")]
pub triggers: Vec<RepositoryTrigger>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct TestRepositoryTriggersOutput {
#[serde(rename = "failedExecutions")]
#[serde(skip_serializing_if = "Option::is_none")]
pub failed_executions: Option<Vec<RepositoryTriggerExecutionFailure>>,
#[serde(rename = "successfulExecutions")]
#[serde(skip_serializing_if = "Option::is_none")]
pub successful_executions: Option<Vec<String>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct UpdateCommentInput {
#[serde(rename = "commentId")]
pub comment_id: String,
#[serde(rename = "content")]
pub content: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct UpdateCommentOutput {
#[serde(rename = "comment")]
#[serde(skip_serializing_if = "Option::is_none")]
pub comment: Option<Comment>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct UpdateDefaultBranchInput {
#[serde(rename = "defaultBranchName")]
pub default_branch_name: String,
#[serde(rename = "repositoryName")]
pub repository_name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct UpdatePullRequestDescriptionInput {
#[serde(rename = "description")]
pub description: String,
#[serde(rename = "pullRequestId")]
pub pull_request_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct UpdatePullRequestDescriptionOutput {
#[serde(rename = "pullRequest")]
pub pull_request: PullRequest,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct UpdatePullRequestStatusInput {
#[serde(rename = "pullRequestId")]
pub pull_request_id: String,
#[serde(rename = "pullRequestStatus")]
pub pull_request_status: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct UpdatePullRequestStatusOutput {
#[serde(rename = "pullRequest")]
pub pull_request: PullRequest,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct UpdatePullRequestTitleInput {
#[serde(rename = "pullRequestId")]
pub pull_request_id: String,
#[serde(rename = "title")]
pub title: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct UpdatePullRequestTitleOutput {
#[serde(rename = "pullRequest")]
pub pull_request: PullRequest,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct UpdateRepositoryDescriptionInput {
#[serde(rename = "repositoryDescription")]
#[serde(skip_serializing_if = "Option::is_none")]
pub repository_description: Option<String>,
#[serde(rename = "repositoryName")]
pub repository_name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct UpdateRepositoryNameInput {
#[serde(rename = "newName")]
pub new_name: String,
#[serde(rename = "oldName")]
pub old_name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct UserInfo {
#[serde(rename = "date")]
#[serde(skip_serializing_if = "Option::is_none")]
pub date: Option<String>,
#[serde(rename = "email")]
#[serde(skip_serializing_if = "Option::is_none")]
pub email: Option<String>,
#[serde(rename = "name")]
#[serde(skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
}
#[derive(Debug, PartialEq)]
pub enum BatchGetRepositoriesError {
EncryptionIntegrityChecksFailed(String),
EncryptionKeyAccessDenied(String),
EncryptionKeyDisabled(String),
EncryptionKeyNotFound(String),
EncryptionKeyUnavailable(String),
InvalidRepositoryName(String),
MaximumRepositoryNamesExceeded(String),
RepositoryNamesRequired(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl BatchGetRepositoriesError {
pub fn from_response(res: BufferedHttpResponse) -> BatchGetRepositoriesError {
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 {
"EncryptionIntegrityChecksFailedException" => {
return BatchGetRepositoriesError::EncryptionIntegrityChecksFailed(String::from(
error_message,
));
}
"EncryptionKeyAccessDeniedException" => {
return BatchGetRepositoriesError::EncryptionKeyAccessDenied(String::from(
error_message,
));
}
"EncryptionKeyDisabledException" => {
return BatchGetRepositoriesError::EncryptionKeyDisabled(String::from(
error_message,
));
}
"EncryptionKeyNotFoundException" => {
return BatchGetRepositoriesError::EncryptionKeyNotFound(String::from(
error_message,
));
}
"EncryptionKeyUnavailableException" => {
return BatchGetRepositoriesError::EncryptionKeyUnavailable(String::from(
error_message,
));
}
"InvalidRepositoryNameException" => {
return BatchGetRepositoriesError::InvalidRepositoryName(String::from(
error_message,
));
}
"MaximumRepositoryNamesExceededException" => {
return BatchGetRepositoriesError::MaximumRepositoryNamesExceeded(String::from(
error_message,
));
}
"RepositoryNamesRequiredException" => {
return BatchGetRepositoriesError::RepositoryNamesRequired(String::from(
error_message,
));
}
"ValidationException" => {
return BatchGetRepositoriesError::Validation(error_message.to_string());
}
_ => {}
}
}
return BatchGetRepositoriesError::Unknown(res);
}
}
impl From<serde_json::error::Error> for BatchGetRepositoriesError {
fn from(err: serde_json::error::Error) -> BatchGetRepositoriesError {
BatchGetRepositoriesError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for BatchGetRepositoriesError {
fn from(err: CredentialsError) -> BatchGetRepositoriesError {
BatchGetRepositoriesError::Credentials(err)
}
}
impl From<HttpDispatchError> for BatchGetRepositoriesError {
fn from(err: HttpDispatchError) -> BatchGetRepositoriesError {
BatchGetRepositoriesError::HttpDispatch(err)
}
}
impl From<io::Error> for BatchGetRepositoriesError {
fn from(err: io::Error) -> BatchGetRepositoriesError {
BatchGetRepositoriesError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for BatchGetRepositoriesError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for BatchGetRepositoriesError {
fn description(&self) -> &str {
match *self {
BatchGetRepositoriesError::EncryptionIntegrityChecksFailed(ref cause) => cause,
BatchGetRepositoriesError::EncryptionKeyAccessDenied(ref cause) => cause,
BatchGetRepositoriesError::EncryptionKeyDisabled(ref cause) => cause,
BatchGetRepositoriesError::EncryptionKeyNotFound(ref cause) => cause,
BatchGetRepositoriesError::EncryptionKeyUnavailable(ref cause) => cause,
BatchGetRepositoriesError::InvalidRepositoryName(ref cause) => cause,
BatchGetRepositoriesError::MaximumRepositoryNamesExceeded(ref cause) => cause,
BatchGetRepositoriesError::RepositoryNamesRequired(ref cause) => cause,
BatchGetRepositoriesError::Validation(ref cause) => cause,
BatchGetRepositoriesError::Credentials(ref err) => err.description(),
BatchGetRepositoriesError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
BatchGetRepositoriesError::ParseError(ref cause) => cause,
BatchGetRepositoriesError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum CreateBranchError {
BranchNameExists(String),
BranchNameRequired(String),
CommitDoesNotExist(String),
CommitIdRequired(String),
EncryptionIntegrityChecksFailed(String),
EncryptionKeyAccessDenied(String),
EncryptionKeyDisabled(String),
EncryptionKeyNotFound(String),
EncryptionKeyUnavailable(String),
InvalidBranchName(String),
InvalidCommitId(String),
InvalidRepositoryName(String),
RepositoryDoesNotExist(String),
RepositoryNameRequired(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl CreateBranchError {
pub fn from_response(res: BufferedHttpResponse) -> CreateBranchError {
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 {
"BranchNameExistsException" => {
return CreateBranchError::BranchNameExists(String::from(error_message));
}
"BranchNameRequiredException" => {
return CreateBranchError::BranchNameRequired(String::from(error_message));
}
"CommitDoesNotExistException" => {
return CreateBranchError::CommitDoesNotExist(String::from(error_message));
}
"CommitIdRequiredException" => {
return CreateBranchError::CommitIdRequired(String::from(error_message));
}
"EncryptionIntegrityChecksFailedException" => {
return CreateBranchError::EncryptionIntegrityChecksFailed(String::from(
error_message,
));
}
"EncryptionKeyAccessDeniedException" => {
return CreateBranchError::EncryptionKeyAccessDenied(String::from(error_message));
}
"EncryptionKeyDisabledException" => {
return CreateBranchError::EncryptionKeyDisabled(String::from(error_message));
}
"EncryptionKeyNotFoundException" => {
return CreateBranchError::EncryptionKeyNotFound(String::from(error_message));
}
"EncryptionKeyUnavailableException" => {
return CreateBranchError::EncryptionKeyUnavailable(String::from(error_message));
}
"InvalidBranchNameException" => {
return CreateBranchError::InvalidBranchName(String::from(error_message));
}
"InvalidCommitIdException" => {
return CreateBranchError::InvalidCommitId(String::from(error_message));
}
"InvalidRepositoryNameException" => {
return CreateBranchError::InvalidRepositoryName(String::from(error_message));
}
"RepositoryDoesNotExistException" => {
return CreateBranchError::RepositoryDoesNotExist(String::from(error_message));
}
"RepositoryNameRequiredException" => {
return CreateBranchError::RepositoryNameRequired(String::from(error_message));
}
"ValidationException" => {
return CreateBranchError::Validation(error_message.to_string());
}
_ => {}
}
}
return CreateBranchError::Unknown(res);
}
}
impl From<serde_json::error::Error> for CreateBranchError {
fn from(err: serde_json::error::Error) -> CreateBranchError {
CreateBranchError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for CreateBranchError {
fn from(err: CredentialsError) -> CreateBranchError {
CreateBranchError::Credentials(err)
}
}
impl From<HttpDispatchError> for CreateBranchError {
fn from(err: HttpDispatchError) -> CreateBranchError {
CreateBranchError::HttpDispatch(err)
}
}
impl From<io::Error> for CreateBranchError {
fn from(err: io::Error) -> CreateBranchError {
CreateBranchError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for CreateBranchError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for CreateBranchError {
fn description(&self) -> &str {
match *self {
CreateBranchError::BranchNameExists(ref cause) => cause,
CreateBranchError::BranchNameRequired(ref cause) => cause,
CreateBranchError::CommitDoesNotExist(ref cause) => cause,
CreateBranchError::CommitIdRequired(ref cause) => cause,
CreateBranchError::EncryptionIntegrityChecksFailed(ref cause) => cause,
CreateBranchError::EncryptionKeyAccessDenied(ref cause) => cause,
CreateBranchError::EncryptionKeyDisabled(ref cause) => cause,
CreateBranchError::EncryptionKeyNotFound(ref cause) => cause,
CreateBranchError::EncryptionKeyUnavailable(ref cause) => cause,
CreateBranchError::InvalidBranchName(ref cause) => cause,
CreateBranchError::InvalidCommitId(ref cause) => cause,
CreateBranchError::InvalidRepositoryName(ref cause) => cause,
CreateBranchError::RepositoryDoesNotExist(ref cause) => cause,
CreateBranchError::RepositoryNameRequired(ref cause) => cause,
CreateBranchError::Validation(ref cause) => cause,
CreateBranchError::Credentials(ref err) => err.description(),
CreateBranchError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
CreateBranchError::ParseError(ref cause) => cause,
CreateBranchError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum CreateCommitError {
BranchDoesNotExist(String),
BranchNameIsTagName(String),
BranchNameRequired(String),
CommitMessageLengthExceeded(String),
DirectoryNameConflictsWithFileName(String),
EncryptionIntegrityChecksFailed(String),
EncryptionKeyAccessDenied(String),
EncryptionKeyDisabled(String),
EncryptionKeyNotFound(String),
EncryptionKeyUnavailable(String),
FileContentAndSourceFileSpecified(String),
FileContentSizeLimitExceeded(String),
FileDoesNotExist(String),
FileEntryRequired(String),
FileModeRequired(String),
FileNameConflictsWithDirectoryName(String),
FilePathConflictsWithSubmodulePath(String),
FolderContentSizeLimitExceeded(String),
InvalidBranchName(String),
InvalidDeletionParameter(String),
InvalidEmail(String),
InvalidFileMode(String),
InvalidParentCommitId(String),
InvalidPath(String),
InvalidRepositoryName(String),
MaximumFileEntriesExceeded(String),
NameLengthExceeded(String),
NoChange(String),
ParentCommitDoesNotExist(String),
ParentCommitIdOutdated(String),
ParentCommitIdRequired(String),
PathRequired(String),
PutFileEntryConflict(String),
RepositoryDoesNotExist(String),
RepositoryNameRequired(String),
RestrictedSourceFile(String),
SamePathRequest(String),
SourceFileOrContentRequired(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl CreateCommitError {
pub fn from_response(res: BufferedHttpResponse) -> CreateCommitError {
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 {
"BranchDoesNotExistException" => {
return CreateCommitError::BranchDoesNotExist(String::from(error_message));
}
"BranchNameIsTagNameException" => {
return CreateCommitError::BranchNameIsTagName(String::from(error_message));
}
"BranchNameRequiredException" => {
return CreateCommitError::BranchNameRequired(String::from(error_message));
}
"CommitMessageLengthExceededException" => {
return CreateCommitError::CommitMessageLengthExceeded(String::from(
error_message,
));
}
"DirectoryNameConflictsWithFileNameException" => {
return CreateCommitError::DirectoryNameConflictsWithFileName(String::from(
error_message,
));
}
"EncryptionIntegrityChecksFailedException" => {
return CreateCommitError::EncryptionIntegrityChecksFailed(String::from(
error_message,
));
}
"EncryptionKeyAccessDeniedException" => {
return CreateCommitError::EncryptionKeyAccessDenied(String::from(error_message));
}
"EncryptionKeyDisabledException" => {
return CreateCommitError::EncryptionKeyDisabled(String::from(error_message));
}
"EncryptionKeyNotFoundException" => {
return CreateCommitError::EncryptionKeyNotFound(String::from(error_message));
}
"EncryptionKeyUnavailableException" => {
return CreateCommitError::EncryptionKeyUnavailable(String::from(error_message));
}
"FileContentAndSourceFileSpecifiedException" => {
return CreateCommitError::FileContentAndSourceFileSpecified(String::from(
error_message,
));
}
"FileContentSizeLimitExceededException" => {
return CreateCommitError::FileContentSizeLimitExceeded(String::from(
error_message,
));
}
"FileDoesNotExistException" => {
return CreateCommitError::FileDoesNotExist(String::from(error_message));
}
"FileEntryRequiredException" => {
return CreateCommitError::FileEntryRequired(String::from(error_message));
}
"FileModeRequiredException" => {
return CreateCommitError::FileModeRequired(String::from(error_message));
}
"FileNameConflictsWithDirectoryNameException" => {
return CreateCommitError::FileNameConflictsWithDirectoryName(String::from(
error_message,
));
}
"FilePathConflictsWithSubmodulePathException" => {
return CreateCommitError::FilePathConflictsWithSubmodulePath(String::from(
error_message,
));
}
"FolderContentSizeLimitExceededException" => {
return CreateCommitError::FolderContentSizeLimitExceeded(String::from(
error_message,
));
}
"InvalidBranchNameException" => {
return CreateCommitError::InvalidBranchName(String::from(error_message));
}
"InvalidDeletionParameterException" => {
return CreateCommitError::InvalidDeletionParameter(String::from(error_message));
}
"InvalidEmailException" => {
return CreateCommitError::InvalidEmail(String::from(error_message));
}
"InvalidFileModeException" => {
return CreateCommitError::InvalidFileMode(String::from(error_message));
}
"InvalidParentCommitIdException" => {
return CreateCommitError::InvalidParentCommitId(String::from(error_message));
}
"InvalidPathException" => {
return CreateCommitError::InvalidPath(String::from(error_message));
}
"InvalidRepositoryNameException" => {
return CreateCommitError::InvalidRepositoryName(String::from(error_message));
}
"MaximumFileEntriesExceededException" => {
return CreateCommitError::MaximumFileEntriesExceeded(String::from(
error_message,
));
}
"NameLengthExceededException" => {
return CreateCommitError::NameLengthExceeded(String::from(error_message));
}
"NoChangeException" => {
return CreateCommitError::NoChange(String::from(error_message));
}
"ParentCommitDoesNotExistException" => {
return CreateCommitError::ParentCommitDoesNotExist(String::from(error_message));
}
"ParentCommitIdOutdatedException" => {
return CreateCommitError::ParentCommitIdOutdated(String::from(error_message));
}
"ParentCommitIdRequiredException" => {
return CreateCommitError::ParentCommitIdRequired(String::from(error_message));
}
"PathRequiredException" => {
return CreateCommitError::PathRequired(String::from(error_message));
}
"PutFileEntryConflictException" => {
return CreateCommitError::PutFileEntryConflict(String::from(error_message));
}
"RepositoryDoesNotExistException" => {
return CreateCommitError::RepositoryDoesNotExist(String::from(error_message));
}
"RepositoryNameRequiredException" => {
return CreateCommitError::RepositoryNameRequired(String::from(error_message));
}
"RestrictedSourceFileException" => {
return CreateCommitError::RestrictedSourceFile(String::from(error_message));
}
"SamePathRequestException" => {
return CreateCommitError::SamePathRequest(String::from(error_message));
}
"SourceFileOrContentRequiredException" => {
return CreateCommitError::SourceFileOrContentRequired(String::from(
error_message,
));
}
"ValidationException" => {
return CreateCommitError::Validation(error_message.to_string());
}
_ => {}
}
}
return CreateCommitError::Unknown(res);
}
}
impl From<serde_json::error::Error> for CreateCommitError {
fn from(err: serde_json::error::Error) -> CreateCommitError {
CreateCommitError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for CreateCommitError {
fn from(err: CredentialsError) -> CreateCommitError {
CreateCommitError::Credentials(err)
}
}
impl From<HttpDispatchError> for CreateCommitError {
fn from(err: HttpDispatchError) -> CreateCommitError {
CreateCommitError::HttpDispatch(err)
}
}
impl From<io::Error> for CreateCommitError {
fn from(err: io::Error) -> CreateCommitError {
CreateCommitError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for CreateCommitError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for CreateCommitError {
fn description(&self) -> &str {
match *self {
CreateCommitError::BranchDoesNotExist(ref cause) => cause,
CreateCommitError::BranchNameIsTagName(ref cause) => cause,
CreateCommitError::BranchNameRequired(ref cause) => cause,
CreateCommitError::CommitMessageLengthExceeded(ref cause) => cause,
CreateCommitError::DirectoryNameConflictsWithFileName(ref cause) => cause,
CreateCommitError::EncryptionIntegrityChecksFailed(ref cause) => cause,
CreateCommitError::EncryptionKeyAccessDenied(ref cause) => cause,
CreateCommitError::EncryptionKeyDisabled(ref cause) => cause,
CreateCommitError::EncryptionKeyNotFound(ref cause) => cause,
CreateCommitError::EncryptionKeyUnavailable(ref cause) => cause,
CreateCommitError::FileContentAndSourceFileSpecified(ref cause) => cause,
CreateCommitError::FileContentSizeLimitExceeded(ref cause) => cause,
CreateCommitError::FileDoesNotExist(ref cause) => cause,
CreateCommitError::FileEntryRequired(ref cause) => cause,
CreateCommitError::FileModeRequired(ref cause) => cause,
CreateCommitError::FileNameConflictsWithDirectoryName(ref cause) => cause,
CreateCommitError::FilePathConflictsWithSubmodulePath(ref cause) => cause,
CreateCommitError::FolderContentSizeLimitExceeded(ref cause) => cause,
CreateCommitError::InvalidBranchName(ref cause) => cause,
CreateCommitError::InvalidDeletionParameter(ref cause) => cause,
CreateCommitError::InvalidEmail(ref cause) => cause,
CreateCommitError::InvalidFileMode(ref cause) => cause,
CreateCommitError::InvalidParentCommitId(ref cause) => cause,
CreateCommitError::InvalidPath(ref cause) => cause,
CreateCommitError::InvalidRepositoryName(ref cause) => cause,
CreateCommitError::MaximumFileEntriesExceeded(ref cause) => cause,
CreateCommitError::NameLengthExceeded(ref cause) => cause,
CreateCommitError::NoChange(ref cause) => cause,
CreateCommitError::ParentCommitDoesNotExist(ref cause) => cause,
CreateCommitError::ParentCommitIdOutdated(ref cause) => cause,
CreateCommitError::ParentCommitIdRequired(ref cause) => cause,
CreateCommitError::PathRequired(ref cause) => cause,
CreateCommitError::PutFileEntryConflict(ref cause) => cause,
CreateCommitError::RepositoryDoesNotExist(ref cause) => cause,
CreateCommitError::RepositoryNameRequired(ref cause) => cause,
CreateCommitError::RestrictedSourceFile(ref cause) => cause,
CreateCommitError::SamePathRequest(ref cause) => cause,
CreateCommitError::SourceFileOrContentRequired(ref cause) => cause,
CreateCommitError::Validation(ref cause) => cause,
CreateCommitError::Credentials(ref err) => err.description(),
CreateCommitError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
CreateCommitError::ParseError(ref cause) => cause,
CreateCommitError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum CreatePullRequestError {
ClientRequestTokenRequired(String),
EncryptionIntegrityChecksFailed(String),
EncryptionKeyAccessDenied(String),
EncryptionKeyDisabled(String),
EncryptionKeyNotFound(String),
EncryptionKeyUnavailable(String),
IdempotencyParameterMismatch(String),
InvalidClientRequestToken(String),
InvalidDescription(String),
InvalidReferenceName(String),
InvalidRepositoryName(String),
InvalidTarget(String),
InvalidTargets(String),
InvalidTitle(String),
MaximumOpenPullRequestsExceeded(String),
MultipleRepositoriesInPullRequest(String),
ReferenceDoesNotExist(String),
ReferenceNameRequired(String),
ReferenceTypeNotSupported(String),
RepositoryDoesNotExist(String),
RepositoryNameRequired(String),
SourceAndDestinationAreSame(String),
TargetRequired(String),
TargetsRequired(String),
TitleRequired(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl CreatePullRequestError {
pub fn from_response(res: BufferedHttpResponse) -> CreatePullRequestError {
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 {
"ClientRequestTokenRequiredException" => {
return CreatePullRequestError::ClientRequestTokenRequired(String::from(
error_message,
));
}
"EncryptionIntegrityChecksFailedException" => {
return CreatePullRequestError::EncryptionIntegrityChecksFailed(String::from(
error_message,
));
}
"EncryptionKeyAccessDeniedException" => {
return CreatePullRequestError::EncryptionKeyAccessDenied(String::from(
error_message,
));
}
"EncryptionKeyDisabledException" => {
return CreatePullRequestError::EncryptionKeyDisabled(String::from(
error_message,
));
}
"EncryptionKeyNotFoundException" => {
return CreatePullRequestError::EncryptionKeyNotFound(String::from(
error_message,
));
}
"EncryptionKeyUnavailableException" => {
return CreatePullRequestError::EncryptionKeyUnavailable(String::from(
error_message,
));
}
"IdempotencyParameterMismatchException" => {
return CreatePullRequestError::IdempotencyParameterMismatch(String::from(
error_message,
));
}
"InvalidClientRequestTokenException" => {
return CreatePullRequestError::InvalidClientRequestToken(String::from(
error_message,
));
}
"InvalidDescriptionException" => {
return CreatePullRequestError::InvalidDescription(String::from(error_message));
}
"InvalidReferenceNameException" => {
return CreatePullRequestError::InvalidReferenceName(String::from(error_message));
}
"InvalidRepositoryNameException" => {
return CreatePullRequestError::InvalidRepositoryName(String::from(
error_message,
));
}
"InvalidTargetException" => {
return CreatePullRequestError::InvalidTarget(String::from(error_message));
}
"InvalidTargetsException" => {
return CreatePullRequestError::InvalidTargets(String::from(error_message));
}
"InvalidTitleException" => {
return CreatePullRequestError::InvalidTitle(String::from(error_message));
}
"MaximumOpenPullRequestsExceededException" => {
return CreatePullRequestError::MaximumOpenPullRequestsExceeded(String::from(
error_message,
));
}
"MultipleRepositoriesInPullRequestException" => {
return CreatePullRequestError::MultipleRepositoriesInPullRequest(String::from(
error_message,
));
}
"ReferenceDoesNotExistException" => {
return CreatePullRequestError::ReferenceDoesNotExist(String::from(
error_message,
));
}
"ReferenceNameRequiredException" => {
return CreatePullRequestError::ReferenceNameRequired(String::from(
error_message,
));
}
"ReferenceTypeNotSupportedException" => {
return CreatePullRequestError::ReferenceTypeNotSupported(String::from(
error_message,
));
}
"RepositoryDoesNotExistException" => {
return CreatePullRequestError::RepositoryDoesNotExist(String::from(
error_message,
));
}
"RepositoryNameRequiredException" => {
return CreatePullRequestError::RepositoryNameRequired(String::from(
error_message,
));
}
"SourceAndDestinationAreSameException" => {
return CreatePullRequestError::SourceAndDestinationAreSame(String::from(
error_message,
));
}
"TargetRequiredException" => {
return CreatePullRequestError::TargetRequired(String::from(error_message));
}
"TargetsRequiredException" => {
return CreatePullRequestError::TargetsRequired(String::from(error_message));
}
"TitleRequiredException" => {
return CreatePullRequestError::TitleRequired(String::from(error_message));
}
"ValidationException" => {
return CreatePullRequestError::Validation(error_message.to_string());
}
_ => {}
}
}
return CreatePullRequestError::Unknown(res);
}
}
impl From<serde_json::error::Error> for CreatePullRequestError {
fn from(err: serde_json::error::Error) -> CreatePullRequestError {
CreatePullRequestError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for CreatePullRequestError {
fn from(err: CredentialsError) -> CreatePullRequestError {
CreatePullRequestError::Credentials(err)
}
}
impl From<HttpDispatchError> for CreatePullRequestError {
fn from(err: HttpDispatchError) -> CreatePullRequestError {
CreatePullRequestError::HttpDispatch(err)
}
}
impl From<io::Error> for CreatePullRequestError {
fn from(err: io::Error) -> CreatePullRequestError {
CreatePullRequestError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for CreatePullRequestError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for CreatePullRequestError {
fn description(&self) -> &str {
match *self {
CreatePullRequestError::ClientRequestTokenRequired(ref cause) => cause,
CreatePullRequestError::EncryptionIntegrityChecksFailed(ref cause) => cause,
CreatePullRequestError::EncryptionKeyAccessDenied(ref cause) => cause,
CreatePullRequestError::EncryptionKeyDisabled(ref cause) => cause,
CreatePullRequestError::EncryptionKeyNotFound(ref cause) => cause,
CreatePullRequestError::EncryptionKeyUnavailable(ref cause) => cause,
CreatePullRequestError::IdempotencyParameterMismatch(ref cause) => cause,
CreatePullRequestError::InvalidClientRequestToken(ref cause) => cause,
CreatePullRequestError::InvalidDescription(ref cause) => cause,
CreatePullRequestError::InvalidReferenceName(ref cause) => cause,
CreatePullRequestError::InvalidRepositoryName(ref cause) => cause,
CreatePullRequestError::InvalidTarget(ref cause) => cause,
CreatePullRequestError::InvalidTargets(ref cause) => cause,
CreatePullRequestError::InvalidTitle(ref cause) => cause,
CreatePullRequestError::MaximumOpenPullRequestsExceeded(ref cause) => cause,
CreatePullRequestError::MultipleRepositoriesInPullRequest(ref cause) => cause,
CreatePullRequestError::ReferenceDoesNotExist(ref cause) => cause,
CreatePullRequestError::ReferenceNameRequired(ref cause) => cause,
CreatePullRequestError::ReferenceTypeNotSupported(ref cause) => cause,
CreatePullRequestError::RepositoryDoesNotExist(ref cause) => cause,
CreatePullRequestError::RepositoryNameRequired(ref cause) => cause,
CreatePullRequestError::SourceAndDestinationAreSame(ref cause) => cause,
CreatePullRequestError::TargetRequired(ref cause) => cause,
CreatePullRequestError::TargetsRequired(ref cause) => cause,
CreatePullRequestError::TitleRequired(ref cause) => cause,
CreatePullRequestError::Validation(ref cause) => cause,
CreatePullRequestError::Credentials(ref err) => err.description(),
CreatePullRequestError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
CreatePullRequestError::ParseError(ref cause) => cause,
CreatePullRequestError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum CreateRepositoryError {
EncryptionIntegrityChecksFailed(String),
EncryptionKeyAccessDenied(String),
EncryptionKeyDisabled(String),
EncryptionKeyNotFound(String),
EncryptionKeyUnavailable(String),
InvalidRepositoryDescription(String),
InvalidRepositoryName(String),
RepositoryLimitExceeded(String),
RepositoryNameExists(String),
RepositoryNameRequired(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl CreateRepositoryError {
pub fn from_response(res: BufferedHttpResponse) -> CreateRepositoryError {
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 {
"EncryptionIntegrityChecksFailedException" => {
return CreateRepositoryError::EncryptionIntegrityChecksFailed(String::from(
error_message,
));
}
"EncryptionKeyAccessDeniedException" => {
return CreateRepositoryError::EncryptionKeyAccessDenied(String::from(
error_message,
));
}
"EncryptionKeyDisabledException" => {
return CreateRepositoryError::EncryptionKeyDisabled(String::from(error_message));
}
"EncryptionKeyNotFoundException" => {
return CreateRepositoryError::EncryptionKeyNotFound(String::from(error_message));
}
"EncryptionKeyUnavailableException" => {
return CreateRepositoryError::EncryptionKeyUnavailable(String::from(
error_message,
));
}
"InvalidRepositoryDescriptionException" => {
return CreateRepositoryError::InvalidRepositoryDescription(String::from(
error_message,
));
}
"InvalidRepositoryNameException" => {
return CreateRepositoryError::InvalidRepositoryName(String::from(error_message));
}
"RepositoryLimitExceededException" => {
return CreateRepositoryError::RepositoryLimitExceeded(String::from(
error_message,
));
}
"RepositoryNameExistsException" => {
return CreateRepositoryError::RepositoryNameExists(String::from(error_message));
}
"RepositoryNameRequiredException" => {
return CreateRepositoryError::RepositoryNameRequired(String::from(
error_message,
));
}
"ValidationException" => {
return CreateRepositoryError::Validation(error_message.to_string());
}
_ => {}
}
}
return CreateRepositoryError::Unknown(res);
}
}
impl From<serde_json::error::Error> for CreateRepositoryError {
fn from(err: serde_json::error::Error) -> CreateRepositoryError {
CreateRepositoryError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for CreateRepositoryError {
fn from(err: CredentialsError) -> CreateRepositoryError {
CreateRepositoryError::Credentials(err)
}
}
impl From<HttpDispatchError> for CreateRepositoryError {
fn from(err: HttpDispatchError) -> CreateRepositoryError {
CreateRepositoryError::HttpDispatch(err)
}
}
impl From<io::Error> for CreateRepositoryError {
fn from(err: io::Error) -> CreateRepositoryError {
CreateRepositoryError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for CreateRepositoryError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for CreateRepositoryError {
fn description(&self) -> &str {
match *self {
CreateRepositoryError::EncryptionIntegrityChecksFailed(ref cause) => cause,
CreateRepositoryError::EncryptionKeyAccessDenied(ref cause) => cause,
CreateRepositoryError::EncryptionKeyDisabled(ref cause) => cause,
CreateRepositoryError::EncryptionKeyNotFound(ref cause) => cause,
CreateRepositoryError::EncryptionKeyUnavailable(ref cause) => cause,
CreateRepositoryError::InvalidRepositoryDescription(ref cause) => cause,
CreateRepositoryError::InvalidRepositoryName(ref cause) => cause,
CreateRepositoryError::RepositoryLimitExceeded(ref cause) => cause,
CreateRepositoryError::RepositoryNameExists(ref cause) => cause,
CreateRepositoryError::RepositoryNameRequired(ref cause) => cause,
CreateRepositoryError::Validation(ref cause) => cause,
CreateRepositoryError::Credentials(ref err) => err.description(),
CreateRepositoryError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
CreateRepositoryError::ParseError(ref cause) => cause,
CreateRepositoryError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DeleteBranchError {
BranchNameRequired(String),
DefaultBranchCannotBeDeleted(String),
EncryptionIntegrityChecksFailed(String),
EncryptionKeyAccessDenied(String),
EncryptionKeyDisabled(String),
EncryptionKeyNotFound(String),
EncryptionKeyUnavailable(String),
InvalidBranchName(String),
InvalidRepositoryName(String),
RepositoryDoesNotExist(String),
RepositoryNameRequired(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DeleteBranchError {
pub fn from_response(res: BufferedHttpResponse) -> DeleteBranchError {
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 {
"BranchNameRequiredException" => {
return DeleteBranchError::BranchNameRequired(String::from(error_message));
}
"DefaultBranchCannotBeDeletedException" => {
return DeleteBranchError::DefaultBranchCannotBeDeleted(String::from(
error_message,
));
}
"EncryptionIntegrityChecksFailedException" => {
return DeleteBranchError::EncryptionIntegrityChecksFailed(String::from(
error_message,
));
}
"EncryptionKeyAccessDeniedException" => {
return DeleteBranchError::EncryptionKeyAccessDenied(String::from(error_message));
}
"EncryptionKeyDisabledException" => {
return DeleteBranchError::EncryptionKeyDisabled(String::from(error_message));
}
"EncryptionKeyNotFoundException" => {
return DeleteBranchError::EncryptionKeyNotFound(String::from(error_message));
}
"EncryptionKeyUnavailableException" => {
return DeleteBranchError::EncryptionKeyUnavailable(String::from(error_message));
}
"InvalidBranchNameException" => {
return DeleteBranchError::InvalidBranchName(String::from(error_message));
}
"InvalidRepositoryNameException" => {
return DeleteBranchError::InvalidRepositoryName(String::from(error_message));
}
"RepositoryDoesNotExistException" => {
return DeleteBranchError::RepositoryDoesNotExist(String::from(error_message));
}
"RepositoryNameRequiredException" => {
return DeleteBranchError::RepositoryNameRequired(String::from(error_message));
}
"ValidationException" => {
return DeleteBranchError::Validation(error_message.to_string());
}
_ => {}
}
}
return DeleteBranchError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DeleteBranchError {
fn from(err: serde_json::error::Error) -> DeleteBranchError {
DeleteBranchError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DeleteBranchError {
fn from(err: CredentialsError) -> DeleteBranchError {
DeleteBranchError::Credentials(err)
}
}
impl From<HttpDispatchError> for DeleteBranchError {
fn from(err: HttpDispatchError) -> DeleteBranchError {
DeleteBranchError::HttpDispatch(err)
}
}
impl From<io::Error> for DeleteBranchError {
fn from(err: io::Error) -> DeleteBranchError {
DeleteBranchError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DeleteBranchError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DeleteBranchError {
fn description(&self) -> &str {
match *self {
DeleteBranchError::BranchNameRequired(ref cause) => cause,
DeleteBranchError::DefaultBranchCannotBeDeleted(ref cause) => cause,
DeleteBranchError::EncryptionIntegrityChecksFailed(ref cause) => cause,
DeleteBranchError::EncryptionKeyAccessDenied(ref cause) => cause,
DeleteBranchError::EncryptionKeyDisabled(ref cause) => cause,
DeleteBranchError::EncryptionKeyNotFound(ref cause) => cause,
DeleteBranchError::EncryptionKeyUnavailable(ref cause) => cause,
DeleteBranchError::InvalidBranchName(ref cause) => cause,
DeleteBranchError::InvalidRepositoryName(ref cause) => cause,
DeleteBranchError::RepositoryDoesNotExist(ref cause) => cause,
DeleteBranchError::RepositoryNameRequired(ref cause) => cause,
DeleteBranchError::Validation(ref cause) => cause,
DeleteBranchError::Credentials(ref err) => err.description(),
DeleteBranchError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
DeleteBranchError::ParseError(ref cause) => cause,
DeleteBranchError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DeleteCommentContentError {
CommentDeleted(String),
CommentDoesNotExist(String),
CommentIdRequired(String),
InvalidCommentId(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DeleteCommentContentError {
pub fn from_response(res: BufferedHttpResponse) -> DeleteCommentContentError {
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 {
"CommentDeletedException" => {
return DeleteCommentContentError::CommentDeleted(String::from(error_message));
}
"CommentDoesNotExistException" => {
return DeleteCommentContentError::CommentDoesNotExist(String::from(
error_message,
));
}
"CommentIdRequiredException" => {
return DeleteCommentContentError::CommentIdRequired(String::from(error_message));
}
"InvalidCommentIdException" => {
return DeleteCommentContentError::InvalidCommentId(String::from(error_message));
}
"ValidationException" => {
return DeleteCommentContentError::Validation(error_message.to_string());
}
_ => {}
}
}
return DeleteCommentContentError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DeleteCommentContentError {
fn from(err: serde_json::error::Error) -> DeleteCommentContentError {
DeleteCommentContentError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DeleteCommentContentError {
fn from(err: CredentialsError) -> DeleteCommentContentError {
DeleteCommentContentError::Credentials(err)
}
}
impl From<HttpDispatchError> for DeleteCommentContentError {
fn from(err: HttpDispatchError) -> DeleteCommentContentError {
DeleteCommentContentError::HttpDispatch(err)
}
}
impl From<io::Error> for DeleteCommentContentError {
fn from(err: io::Error) -> DeleteCommentContentError {
DeleteCommentContentError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DeleteCommentContentError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DeleteCommentContentError {
fn description(&self) -> &str {
match *self {
DeleteCommentContentError::CommentDeleted(ref cause) => cause,
DeleteCommentContentError::CommentDoesNotExist(ref cause) => cause,
DeleteCommentContentError::CommentIdRequired(ref cause) => cause,
DeleteCommentContentError::InvalidCommentId(ref cause) => cause,
DeleteCommentContentError::Validation(ref cause) => cause,
DeleteCommentContentError::Credentials(ref err) => err.description(),
DeleteCommentContentError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
DeleteCommentContentError::ParseError(ref cause) => cause,
DeleteCommentContentError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DeleteFileError {
BranchDoesNotExist(String),
BranchNameIsTagName(String),
BranchNameRequired(String),
CommitMessageLengthExceeded(String),
EncryptionIntegrityChecksFailed(String),
EncryptionKeyAccessDenied(String),
EncryptionKeyDisabled(String),
EncryptionKeyNotFound(String),
EncryptionKeyUnavailable(String),
FileDoesNotExist(String),
InvalidBranchName(String),
InvalidEmail(String),
InvalidParentCommitId(String),
InvalidPath(String),
InvalidRepositoryName(String),
NameLengthExceeded(String),
ParentCommitDoesNotExist(String),
ParentCommitIdOutdated(String),
ParentCommitIdRequired(String),
PathRequired(String),
RepositoryDoesNotExist(String),
RepositoryNameRequired(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DeleteFileError {
pub fn from_response(res: BufferedHttpResponse) -> DeleteFileError {
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 {
"BranchDoesNotExistException" => {
return DeleteFileError::BranchDoesNotExist(String::from(error_message));
}
"BranchNameIsTagNameException" => {
return DeleteFileError::BranchNameIsTagName(String::from(error_message));
}
"BranchNameRequiredException" => {
return DeleteFileError::BranchNameRequired(String::from(error_message));
}
"CommitMessageLengthExceededException" => {
return DeleteFileError::CommitMessageLengthExceeded(String::from(error_message));
}
"EncryptionIntegrityChecksFailedException" => {
return DeleteFileError::EncryptionIntegrityChecksFailed(String::from(
error_message,
));
}
"EncryptionKeyAccessDeniedException" => {
return DeleteFileError::EncryptionKeyAccessDenied(String::from(error_message));
}
"EncryptionKeyDisabledException" => {
return DeleteFileError::EncryptionKeyDisabled(String::from(error_message));
}
"EncryptionKeyNotFoundException" => {
return DeleteFileError::EncryptionKeyNotFound(String::from(error_message));
}
"EncryptionKeyUnavailableException" => {
return DeleteFileError::EncryptionKeyUnavailable(String::from(error_message));
}
"FileDoesNotExistException" => {
return DeleteFileError::FileDoesNotExist(String::from(error_message));
}
"InvalidBranchNameException" => {
return DeleteFileError::InvalidBranchName(String::from(error_message));
}
"InvalidEmailException" => {
return DeleteFileError::InvalidEmail(String::from(error_message));
}
"InvalidParentCommitIdException" => {
return DeleteFileError::InvalidParentCommitId(String::from(error_message));
}
"InvalidPathException" => {
return DeleteFileError::InvalidPath(String::from(error_message));
}
"InvalidRepositoryNameException" => {
return DeleteFileError::InvalidRepositoryName(String::from(error_message));
}
"NameLengthExceededException" => {
return DeleteFileError::NameLengthExceeded(String::from(error_message));
}
"ParentCommitDoesNotExistException" => {
return DeleteFileError::ParentCommitDoesNotExist(String::from(error_message));
}
"ParentCommitIdOutdatedException" => {
return DeleteFileError::ParentCommitIdOutdated(String::from(error_message));
}
"ParentCommitIdRequiredException" => {
return DeleteFileError::ParentCommitIdRequired(String::from(error_message));
}
"PathRequiredException" => {
return DeleteFileError::PathRequired(String::from(error_message));
}
"RepositoryDoesNotExistException" => {
return DeleteFileError::RepositoryDoesNotExist(String::from(error_message));
}
"RepositoryNameRequiredException" => {
return DeleteFileError::RepositoryNameRequired(String::from(error_message));
}
"ValidationException" => {
return DeleteFileError::Validation(error_message.to_string());
}
_ => {}
}
}
return DeleteFileError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DeleteFileError {
fn from(err: serde_json::error::Error) -> DeleteFileError {
DeleteFileError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DeleteFileError {
fn from(err: CredentialsError) -> DeleteFileError {
DeleteFileError::Credentials(err)
}
}
impl From<HttpDispatchError> for DeleteFileError {
fn from(err: HttpDispatchError) -> DeleteFileError {
DeleteFileError::HttpDispatch(err)
}
}
impl From<io::Error> for DeleteFileError {
fn from(err: io::Error) -> DeleteFileError {
DeleteFileError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DeleteFileError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DeleteFileError {
fn description(&self) -> &str {
match *self {
DeleteFileError::BranchDoesNotExist(ref cause) => cause,
DeleteFileError::BranchNameIsTagName(ref cause) => cause,
DeleteFileError::BranchNameRequired(ref cause) => cause,
DeleteFileError::CommitMessageLengthExceeded(ref cause) => cause,
DeleteFileError::EncryptionIntegrityChecksFailed(ref cause) => cause,
DeleteFileError::EncryptionKeyAccessDenied(ref cause) => cause,
DeleteFileError::EncryptionKeyDisabled(ref cause) => cause,
DeleteFileError::EncryptionKeyNotFound(ref cause) => cause,
DeleteFileError::EncryptionKeyUnavailable(ref cause) => cause,
DeleteFileError::FileDoesNotExist(ref cause) => cause,
DeleteFileError::InvalidBranchName(ref cause) => cause,
DeleteFileError::InvalidEmail(ref cause) => cause,
DeleteFileError::InvalidParentCommitId(ref cause) => cause,
DeleteFileError::InvalidPath(ref cause) => cause,
DeleteFileError::InvalidRepositoryName(ref cause) => cause,
DeleteFileError::NameLengthExceeded(ref cause) => cause,
DeleteFileError::ParentCommitDoesNotExist(ref cause) => cause,
DeleteFileError::ParentCommitIdOutdated(ref cause) => cause,
DeleteFileError::ParentCommitIdRequired(ref cause) => cause,
DeleteFileError::PathRequired(ref cause) => cause,
DeleteFileError::RepositoryDoesNotExist(ref cause) => cause,
DeleteFileError::RepositoryNameRequired(ref cause) => cause,
DeleteFileError::Validation(ref cause) => cause,
DeleteFileError::Credentials(ref err) => err.description(),
DeleteFileError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
DeleteFileError::ParseError(ref cause) => cause,
DeleteFileError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DeleteRepositoryError {
EncryptionIntegrityChecksFailed(String),
EncryptionKeyAccessDenied(String),
EncryptionKeyDisabled(String),
EncryptionKeyNotFound(String),
EncryptionKeyUnavailable(String),
InvalidRepositoryName(String),
RepositoryNameRequired(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DeleteRepositoryError {
pub fn from_response(res: BufferedHttpResponse) -> DeleteRepositoryError {
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 {
"EncryptionIntegrityChecksFailedException" => {
return DeleteRepositoryError::EncryptionIntegrityChecksFailed(String::from(
error_message,
));
}
"EncryptionKeyAccessDeniedException" => {
return DeleteRepositoryError::EncryptionKeyAccessDenied(String::from(
error_message,
));
}
"EncryptionKeyDisabledException" => {
return DeleteRepositoryError::EncryptionKeyDisabled(String::from(error_message));
}
"EncryptionKeyNotFoundException" => {
return DeleteRepositoryError::EncryptionKeyNotFound(String::from(error_message));
}
"EncryptionKeyUnavailableException" => {
return DeleteRepositoryError::EncryptionKeyUnavailable(String::from(
error_message,
));
}
"InvalidRepositoryNameException" => {
return DeleteRepositoryError::InvalidRepositoryName(String::from(error_message));
}
"RepositoryNameRequiredException" => {
return DeleteRepositoryError::RepositoryNameRequired(String::from(
error_message,
));
}
"ValidationException" => {
return DeleteRepositoryError::Validation(error_message.to_string());
}
_ => {}
}
}
return DeleteRepositoryError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DeleteRepositoryError {
fn from(err: serde_json::error::Error) -> DeleteRepositoryError {
DeleteRepositoryError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DeleteRepositoryError {
fn from(err: CredentialsError) -> DeleteRepositoryError {
DeleteRepositoryError::Credentials(err)
}
}
impl From<HttpDispatchError> for DeleteRepositoryError {
fn from(err: HttpDispatchError) -> DeleteRepositoryError {
DeleteRepositoryError::HttpDispatch(err)
}
}
impl From<io::Error> for DeleteRepositoryError {
fn from(err: io::Error) -> DeleteRepositoryError {
DeleteRepositoryError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DeleteRepositoryError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DeleteRepositoryError {
fn description(&self) -> &str {
match *self {
DeleteRepositoryError::EncryptionIntegrityChecksFailed(ref cause) => cause,
DeleteRepositoryError::EncryptionKeyAccessDenied(ref cause) => cause,
DeleteRepositoryError::EncryptionKeyDisabled(ref cause) => cause,
DeleteRepositoryError::EncryptionKeyNotFound(ref cause) => cause,
DeleteRepositoryError::EncryptionKeyUnavailable(ref cause) => cause,
DeleteRepositoryError::InvalidRepositoryName(ref cause) => cause,
DeleteRepositoryError::RepositoryNameRequired(ref cause) => cause,
DeleteRepositoryError::Validation(ref cause) => cause,
DeleteRepositoryError::Credentials(ref err) => err.description(),
DeleteRepositoryError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
DeleteRepositoryError::ParseError(ref cause) => cause,
DeleteRepositoryError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DescribePullRequestEventsError {
ActorDoesNotExist(String),
EncryptionIntegrityChecksFailed(String),
EncryptionKeyAccessDenied(String),
EncryptionKeyDisabled(String),
EncryptionKeyNotFound(String),
EncryptionKeyUnavailable(String),
InvalidActorArn(String),
InvalidContinuationToken(String),
InvalidMaxResults(String),
InvalidPullRequestEventType(String),
InvalidPullRequestId(String),
PullRequestDoesNotExist(String),
PullRequestIdRequired(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DescribePullRequestEventsError {
pub fn from_response(res: BufferedHttpResponse) -> DescribePullRequestEventsError {
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 {
"ActorDoesNotExistException" => {
return DescribePullRequestEventsError::ActorDoesNotExist(String::from(
error_message,
));
}
"EncryptionIntegrityChecksFailedException" => {
return DescribePullRequestEventsError::EncryptionIntegrityChecksFailed(
String::from(error_message),
);
}
"EncryptionKeyAccessDeniedException" => {
return DescribePullRequestEventsError::EncryptionKeyAccessDenied(String::from(
error_message,
));
}
"EncryptionKeyDisabledException" => {
return DescribePullRequestEventsError::EncryptionKeyDisabled(String::from(
error_message,
));
}
"EncryptionKeyNotFoundException" => {
return DescribePullRequestEventsError::EncryptionKeyNotFound(String::from(
error_message,
));
}
"EncryptionKeyUnavailableException" => {
return DescribePullRequestEventsError::EncryptionKeyUnavailable(String::from(
error_message,
));
}
"InvalidActorArnException" => {
return DescribePullRequestEventsError::InvalidActorArn(String::from(
error_message,
));
}
"InvalidContinuationTokenException" => {
return DescribePullRequestEventsError::InvalidContinuationToken(String::from(
error_message,
));
}
"InvalidMaxResultsException" => {
return DescribePullRequestEventsError::InvalidMaxResults(String::from(
error_message,
));
}
"InvalidPullRequestEventTypeException" => {
return DescribePullRequestEventsError::InvalidPullRequestEventType(
String::from(error_message),
);
}
"InvalidPullRequestIdException" => {
return DescribePullRequestEventsError::InvalidPullRequestId(String::from(
error_message,
));
}
"PullRequestDoesNotExistException" => {
return DescribePullRequestEventsError::PullRequestDoesNotExist(String::from(
error_message,
));
}
"PullRequestIdRequiredException" => {
return DescribePullRequestEventsError::PullRequestIdRequired(String::from(
error_message,
));
}
"ValidationException" => {
return DescribePullRequestEventsError::Validation(error_message.to_string());
}
_ => {}
}
}
return DescribePullRequestEventsError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DescribePullRequestEventsError {
fn from(err: serde_json::error::Error) -> DescribePullRequestEventsError {
DescribePullRequestEventsError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DescribePullRequestEventsError {
fn from(err: CredentialsError) -> DescribePullRequestEventsError {
DescribePullRequestEventsError::Credentials(err)
}
}
impl From<HttpDispatchError> for DescribePullRequestEventsError {
fn from(err: HttpDispatchError) -> DescribePullRequestEventsError {
DescribePullRequestEventsError::HttpDispatch(err)
}
}
impl From<io::Error> for DescribePullRequestEventsError {
fn from(err: io::Error) -> DescribePullRequestEventsError {
DescribePullRequestEventsError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DescribePullRequestEventsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DescribePullRequestEventsError {
fn description(&self) -> &str {
match *self {
DescribePullRequestEventsError::ActorDoesNotExist(ref cause) => cause,
DescribePullRequestEventsError::EncryptionIntegrityChecksFailed(ref cause) => cause,
DescribePullRequestEventsError::EncryptionKeyAccessDenied(ref cause) => cause,
DescribePullRequestEventsError::EncryptionKeyDisabled(ref cause) => cause,
DescribePullRequestEventsError::EncryptionKeyNotFound(ref cause) => cause,
DescribePullRequestEventsError::EncryptionKeyUnavailable(ref cause) => cause,
DescribePullRequestEventsError::InvalidActorArn(ref cause) => cause,
DescribePullRequestEventsError::InvalidContinuationToken(ref cause) => cause,
DescribePullRequestEventsError::InvalidMaxResults(ref cause) => cause,
DescribePullRequestEventsError::InvalidPullRequestEventType(ref cause) => cause,
DescribePullRequestEventsError::InvalidPullRequestId(ref cause) => cause,
DescribePullRequestEventsError::PullRequestDoesNotExist(ref cause) => cause,
DescribePullRequestEventsError::PullRequestIdRequired(ref cause) => cause,
DescribePullRequestEventsError::Validation(ref cause) => cause,
DescribePullRequestEventsError::Credentials(ref err) => err.description(),
DescribePullRequestEventsError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
DescribePullRequestEventsError::ParseError(ref cause) => cause,
DescribePullRequestEventsError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetBlobError {
BlobIdDoesNotExist(String),
BlobIdRequired(String),
EncryptionIntegrityChecksFailed(String),
EncryptionKeyAccessDenied(String),
EncryptionKeyDisabled(String),
EncryptionKeyNotFound(String),
EncryptionKeyUnavailable(String),
FileTooLarge(String),
InvalidBlobId(String),
InvalidRepositoryName(String),
RepositoryDoesNotExist(String),
RepositoryNameRequired(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetBlobError {
pub fn from_response(res: BufferedHttpResponse) -> GetBlobError {
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 {
"BlobIdDoesNotExistException" => {
return GetBlobError::BlobIdDoesNotExist(String::from(error_message));
}
"BlobIdRequiredException" => {
return GetBlobError::BlobIdRequired(String::from(error_message));
}
"EncryptionIntegrityChecksFailedException" => {
return GetBlobError::EncryptionIntegrityChecksFailed(String::from(
error_message,
));
}
"EncryptionKeyAccessDeniedException" => {
return GetBlobError::EncryptionKeyAccessDenied(String::from(error_message));
}
"EncryptionKeyDisabledException" => {
return GetBlobError::EncryptionKeyDisabled(String::from(error_message));
}
"EncryptionKeyNotFoundException" => {
return GetBlobError::EncryptionKeyNotFound(String::from(error_message));
}
"EncryptionKeyUnavailableException" => {
return GetBlobError::EncryptionKeyUnavailable(String::from(error_message));
}
"FileTooLargeException" => {
return GetBlobError::FileTooLarge(String::from(error_message));
}
"InvalidBlobIdException" => {
return GetBlobError::InvalidBlobId(String::from(error_message));
}
"InvalidRepositoryNameException" => {
return GetBlobError::InvalidRepositoryName(String::from(error_message));
}
"RepositoryDoesNotExistException" => {
return GetBlobError::RepositoryDoesNotExist(String::from(error_message));
}
"RepositoryNameRequiredException" => {
return GetBlobError::RepositoryNameRequired(String::from(error_message));
}
"ValidationException" => return GetBlobError::Validation(error_message.to_string()),
_ => {}
}
}
return GetBlobError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetBlobError {
fn from(err: serde_json::error::Error) -> GetBlobError {
GetBlobError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetBlobError {
fn from(err: CredentialsError) -> GetBlobError {
GetBlobError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetBlobError {
fn from(err: HttpDispatchError) -> GetBlobError {
GetBlobError::HttpDispatch(err)
}
}
impl From<io::Error> for GetBlobError {
fn from(err: io::Error) -> GetBlobError {
GetBlobError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetBlobError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetBlobError {
fn description(&self) -> &str {
match *self {
GetBlobError::BlobIdDoesNotExist(ref cause) => cause,
GetBlobError::BlobIdRequired(ref cause) => cause,
GetBlobError::EncryptionIntegrityChecksFailed(ref cause) => cause,
GetBlobError::EncryptionKeyAccessDenied(ref cause) => cause,
GetBlobError::EncryptionKeyDisabled(ref cause) => cause,
GetBlobError::EncryptionKeyNotFound(ref cause) => cause,
GetBlobError::EncryptionKeyUnavailable(ref cause) => cause,
GetBlobError::FileTooLarge(ref cause) => cause,
GetBlobError::InvalidBlobId(ref cause) => cause,
GetBlobError::InvalidRepositoryName(ref cause) => cause,
GetBlobError::RepositoryDoesNotExist(ref cause) => cause,
GetBlobError::RepositoryNameRequired(ref cause) => cause,
GetBlobError::Validation(ref cause) => cause,
GetBlobError::Credentials(ref err) => err.description(),
GetBlobError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
GetBlobError::ParseError(ref cause) => cause,
GetBlobError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetBranchError {
BranchDoesNotExist(String),
BranchNameRequired(String),
EncryptionIntegrityChecksFailed(String),
EncryptionKeyAccessDenied(String),
EncryptionKeyDisabled(String),
EncryptionKeyNotFound(String),
EncryptionKeyUnavailable(String),
InvalidBranchName(String),
InvalidRepositoryName(String),
RepositoryDoesNotExist(String),
RepositoryNameRequired(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetBranchError {
pub fn from_response(res: BufferedHttpResponse) -> GetBranchError {
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 {
"BranchDoesNotExistException" => {
return GetBranchError::BranchDoesNotExist(String::from(error_message));
}
"BranchNameRequiredException" => {
return GetBranchError::BranchNameRequired(String::from(error_message));
}
"EncryptionIntegrityChecksFailedException" => {
return GetBranchError::EncryptionIntegrityChecksFailed(String::from(
error_message,
));
}
"EncryptionKeyAccessDeniedException" => {
return GetBranchError::EncryptionKeyAccessDenied(String::from(error_message));
}
"EncryptionKeyDisabledException" => {
return GetBranchError::EncryptionKeyDisabled(String::from(error_message));
}
"EncryptionKeyNotFoundException" => {
return GetBranchError::EncryptionKeyNotFound(String::from(error_message));
}
"EncryptionKeyUnavailableException" => {
return GetBranchError::EncryptionKeyUnavailable(String::from(error_message));
}
"InvalidBranchNameException" => {
return GetBranchError::InvalidBranchName(String::from(error_message));
}
"InvalidRepositoryNameException" => {
return GetBranchError::InvalidRepositoryName(String::from(error_message));
}
"RepositoryDoesNotExistException" => {
return GetBranchError::RepositoryDoesNotExist(String::from(error_message));
}
"RepositoryNameRequiredException" => {
return GetBranchError::RepositoryNameRequired(String::from(error_message));
}
"ValidationException" => {
return GetBranchError::Validation(error_message.to_string());
}
_ => {}
}
}
return GetBranchError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetBranchError {
fn from(err: serde_json::error::Error) -> GetBranchError {
GetBranchError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetBranchError {
fn from(err: CredentialsError) -> GetBranchError {
GetBranchError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetBranchError {
fn from(err: HttpDispatchError) -> GetBranchError {
GetBranchError::HttpDispatch(err)
}
}
impl From<io::Error> for GetBranchError {
fn from(err: io::Error) -> GetBranchError {
GetBranchError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetBranchError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetBranchError {
fn description(&self) -> &str {
match *self {
GetBranchError::BranchDoesNotExist(ref cause) => cause,
GetBranchError::BranchNameRequired(ref cause) => cause,
GetBranchError::EncryptionIntegrityChecksFailed(ref cause) => cause,
GetBranchError::EncryptionKeyAccessDenied(ref cause) => cause,
GetBranchError::EncryptionKeyDisabled(ref cause) => cause,
GetBranchError::EncryptionKeyNotFound(ref cause) => cause,
GetBranchError::EncryptionKeyUnavailable(ref cause) => cause,
GetBranchError::InvalidBranchName(ref cause) => cause,
GetBranchError::InvalidRepositoryName(ref cause) => cause,
GetBranchError::RepositoryDoesNotExist(ref cause) => cause,
GetBranchError::RepositoryNameRequired(ref cause) => cause,
GetBranchError::Validation(ref cause) => cause,
GetBranchError::Credentials(ref err) => err.description(),
GetBranchError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
GetBranchError::ParseError(ref cause) => cause,
GetBranchError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetCommentError {
CommentDeleted(String),
CommentDoesNotExist(String),
CommentIdRequired(String),
InvalidCommentId(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetCommentError {
pub fn from_response(res: BufferedHttpResponse) -> GetCommentError {
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 {
"CommentDeletedException" => {
return GetCommentError::CommentDeleted(String::from(error_message));
}
"CommentDoesNotExistException" => {
return GetCommentError::CommentDoesNotExist(String::from(error_message));
}
"CommentIdRequiredException" => {
return GetCommentError::CommentIdRequired(String::from(error_message));
}
"InvalidCommentIdException" => {
return GetCommentError::InvalidCommentId(String::from(error_message));
}
"ValidationException" => {
return GetCommentError::Validation(error_message.to_string());
}
_ => {}
}
}
return GetCommentError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetCommentError {
fn from(err: serde_json::error::Error) -> GetCommentError {
GetCommentError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetCommentError {
fn from(err: CredentialsError) -> GetCommentError {
GetCommentError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetCommentError {
fn from(err: HttpDispatchError) -> GetCommentError {
GetCommentError::HttpDispatch(err)
}
}
impl From<io::Error> for GetCommentError {
fn from(err: io::Error) -> GetCommentError {
GetCommentError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetCommentError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetCommentError {
fn description(&self) -> &str {
match *self {
GetCommentError::CommentDeleted(ref cause) => cause,
GetCommentError::CommentDoesNotExist(ref cause) => cause,
GetCommentError::CommentIdRequired(ref cause) => cause,
GetCommentError::InvalidCommentId(ref cause) => cause,
GetCommentError::Validation(ref cause) => cause,
GetCommentError::Credentials(ref err) => err.description(),
GetCommentError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
GetCommentError::ParseError(ref cause) => cause,
GetCommentError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetCommentsForComparedCommitError {
CommitDoesNotExist(String),
CommitIdRequired(String),
EncryptionIntegrityChecksFailed(String),
EncryptionKeyAccessDenied(String),
EncryptionKeyDisabled(String),
EncryptionKeyNotFound(String),
EncryptionKeyUnavailable(String),
InvalidCommitId(String),
InvalidContinuationToken(String),
InvalidMaxResults(String),
InvalidRepositoryName(String),
RepositoryDoesNotExist(String),
RepositoryNameRequired(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetCommentsForComparedCommitError {
pub fn from_response(res: BufferedHttpResponse) -> GetCommentsForComparedCommitError {
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 {
"CommitDoesNotExistException" => {
return GetCommentsForComparedCommitError::CommitDoesNotExist(String::from(
error_message,
));
}
"CommitIdRequiredException" => {
return GetCommentsForComparedCommitError::CommitIdRequired(String::from(
error_message,
));
}
"EncryptionIntegrityChecksFailedException" => {
return GetCommentsForComparedCommitError::EncryptionIntegrityChecksFailed(
String::from(error_message),
);
}
"EncryptionKeyAccessDeniedException" => {
return GetCommentsForComparedCommitError::EncryptionKeyAccessDenied(
String::from(error_message),
);
}
"EncryptionKeyDisabledException" => {
return GetCommentsForComparedCommitError::EncryptionKeyDisabled(String::from(
error_message,
));
}
"EncryptionKeyNotFoundException" => {
return GetCommentsForComparedCommitError::EncryptionKeyNotFound(String::from(
error_message,
));
}
"EncryptionKeyUnavailableException" => {
return GetCommentsForComparedCommitError::EncryptionKeyUnavailable(
String::from(error_message),
);
}
"InvalidCommitIdException" => {
return GetCommentsForComparedCommitError::InvalidCommitId(String::from(
error_message,
));
}
"InvalidContinuationTokenException" => {
return GetCommentsForComparedCommitError::InvalidContinuationToken(
String::from(error_message),
);
}
"InvalidMaxResultsException" => {
return GetCommentsForComparedCommitError::InvalidMaxResults(String::from(
error_message,
));
}
"InvalidRepositoryNameException" => {
return GetCommentsForComparedCommitError::InvalidRepositoryName(String::from(
error_message,
));
}
"RepositoryDoesNotExistException" => {
return GetCommentsForComparedCommitError::RepositoryDoesNotExist(String::from(
error_message,
));
}
"RepositoryNameRequiredException" => {
return GetCommentsForComparedCommitError::RepositoryNameRequired(String::from(
error_message,
));
}
"ValidationException" => {
return GetCommentsForComparedCommitError::Validation(error_message.to_string());
}
_ => {}
}
}
return GetCommentsForComparedCommitError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetCommentsForComparedCommitError {
fn from(err: serde_json::error::Error) -> GetCommentsForComparedCommitError {
GetCommentsForComparedCommitError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetCommentsForComparedCommitError {
fn from(err: CredentialsError) -> GetCommentsForComparedCommitError {
GetCommentsForComparedCommitError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetCommentsForComparedCommitError {
fn from(err: HttpDispatchError) -> GetCommentsForComparedCommitError {
GetCommentsForComparedCommitError::HttpDispatch(err)
}
}
impl From<io::Error> for GetCommentsForComparedCommitError {
fn from(err: io::Error) -> GetCommentsForComparedCommitError {
GetCommentsForComparedCommitError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetCommentsForComparedCommitError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetCommentsForComparedCommitError {
fn description(&self) -> &str {
match *self {
GetCommentsForComparedCommitError::CommitDoesNotExist(ref cause) => cause,
GetCommentsForComparedCommitError::CommitIdRequired(ref cause) => cause,
GetCommentsForComparedCommitError::EncryptionIntegrityChecksFailed(ref cause) => cause,
GetCommentsForComparedCommitError::EncryptionKeyAccessDenied(ref cause) => cause,
GetCommentsForComparedCommitError::EncryptionKeyDisabled(ref cause) => cause,
GetCommentsForComparedCommitError::EncryptionKeyNotFound(ref cause) => cause,
GetCommentsForComparedCommitError::EncryptionKeyUnavailable(ref cause) => cause,
GetCommentsForComparedCommitError::InvalidCommitId(ref cause) => cause,
GetCommentsForComparedCommitError::InvalidContinuationToken(ref cause) => cause,
GetCommentsForComparedCommitError::InvalidMaxResults(ref cause) => cause,
GetCommentsForComparedCommitError::InvalidRepositoryName(ref cause) => cause,
GetCommentsForComparedCommitError::RepositoryDoesNotExist(ref cause) => cause,
GetCommentsForComparedCommitError::RepositoryNameRequired(ref cause) => cause,
GetCommentsForComparedCommitError::Validation(ref cause) => cause,
GetCommentsForComparedCommitError::Credentials(ref err) => err.description(),
GetCommentsForComparedCommitError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
GetCommentsForComparedCommitError::ParseError(ref cause) => cause,
GetCommentsForComparedCommitError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetCommentsForPullRequestError {
CommitDoesNotExist(String),
CommitIdRequired(String),
EncryptionIntegrityChecksFailed(String),
EncryptionKeyAccessDenied(String),
EncryptionKeyDisabled(String),
EncryptionKeyNotFound(String),
EncryptionKeyUnavailable(String),
InvalidCommitId(String),
InvalidContinuationToken(String),
InvalidMaxResults(String),
InvalidPullRequestId(String),
InvalidRepositoryName(String),
PullRequestDoesNotExist(String),
PullRequestIdRequired(String),
RepositoryDoesNotExist(String),
RepositoryNameRequired(String),
RepositoryNotAssociatedWithPullRequest(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetCommentsForPullRequestError {
pub fn from_response(res: BufferedHttpResponse) -> GetCommentsForPullRequestError {
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 {
"CommitDoesNotExistException" => {
return GetCommentsForPullRequestError::CommitDoesNotExist(String::from(
error_message,
));
}
"CommitIdRequiredException" => {
return GetCommentsForPullRequestError::CommitIdRequired(String::from(
error_message,
));
}
"EncryptionIntegrityChecksFailedException" => {
return GetCommentsForPullRequestError::EncryptionIntegrityChecksFailed(
String::from(error_message),
);
}
"EncryptionKeyAccessDeniedException" => {
return GetCommentsForPullRequestError::EncryptionKeyAccessDenied(String::from(
error_message,
));
}
"EncryptionKeyDisabledException" => {
return GetCommentsForPullRequestError::EncryptionKeyDisabled(String::from(
error_message,
));
}
"EncryptionKeyNotFoundException" => {
return GetCommentsForPullRequestError::EncryptionKeyNotFound(String::from(
error_message,
));
}
"EncryptionKeyUnavailableException" => {
return GetCommentsForPullRequestError::EncryptionKeyUnavailable(String::from(
error_message,
));
}
"InvalidCommitIdException" => {
return GetCommentsForPullRequestError::InvalidCommitId(String::from(
error_message,
));
}
"InvalidContinuationTokenException" => {
return GetCommentsForPullRequestError::InvalidContinuationToken(String::from(
error_message,
));
}
"InvalidMaxResultsException" => {
return GetCommentsForPullRequestError::InvalidMaxResults(String::from(
error_message,
));
}
"InvalidPullRequestIdException" => {
return GetCommentsForPullRequestError::InvalidPullRequestId(String::from(
error_message,
));
}
"InvalidRepositoryNameException" => {
return GetCommentsForPullRequestError::InvalidRepositoryName(String::from(
error_message,
));
}
"PullRequestDoesNotExistException" => {
return GetCommentsForPullRequestError::PullRequestDoesNotExist(String::from(
error_message,
));
}
"PullRequestIdRequiredException" => {
return GetCommentsForPullRequestError::PullRequestIdRequired(String::from(
error_message,
));
}
"RepositoryDoesNotExistException" => {
return GetCommentsForPullRequestError::RepositoryDoesNotExist(String::from(
error_message,
));
}
"RepositoryNameRequiredException" => {
return GetCommentsForPullRequestError::RepositoryNameRequired(String::from(
error_message,
));
}
"RepositoryNotAssociatedWithPullRequestException" => {
return GetCommentsForPullRequestError::RepositoryNotAssociatedWithPullRequest(
String::from(error_message),
);
}
"ValidationException" => {
return GetCommentsForPullRequestError::Validation(error_message.to_string());
}
_ => {}
}
}
return GetCommentsForPullRequestError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetCommentsForPullRequestError {
fn from(err: serde_json::error::Error) -> GetCommentsForPullRequestError {
GetCommentsForPullRequestError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetCommentsForPullRequestError {
fn from(err: CredentialsError) -> GetCommentsForPullRequestError {
GetCommentsForPullRequestError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetCommentsForPullRequestError {
fn from(err: HttpDispatchError) -> GetCommentsForPullRequestError {
GetCommentsForPullRequestError::HttpDispatch(err)
}
}
impl From<io::Error> for GetCommentsForPullRequestError {
fn from(err: io::Error) -> GetCommentsForPullRequestError {
GetCommentsForPullRequestError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetCommentsForPullRequestError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetCommentsForPullRequestError {
fn description(&self) -> &str {
match *self {
GetCommentsForPullRequestError::CommitDoesNotExist(ref cause) => cause,
GetCommentsForPullRequestError::CommitIdRequired(ref cause) => cause,
GetCommentsForPullRequestError::EncryptionIntegrityChecksFailed(ref cause) => cause,
GetCommentsForPullRequestError::EncryptionKeyAccessDenied(ref cause) => cause,
GetCommentsForPullRequestError::EncryptionKeyDisabled(ref cause) => cause,
GetCommentsForPullRequestError::EncryptionKeyNotFound(ref cause) => cause,
GetCommentsForPullRequestError::EncryptionKeyUnavailable(ref cause) => cause,
GetCommentsForPullRequestError::InvalidCommitId(ref cause) => cause,
GetCommentsForPullRequestError::InvalidContinuationToken(ref cause) => cause,
GetCommentsForPullRequestError::InvalidMaxResults(ref cause) => cause,
GetCommentsForPullRequestError::InvalidPullRequestId(ref cause) => cause,
GetCommentsForPullRequestError::InvalidRepositoryName(ref cause) => cause,
GetCommentsForPullRequestError::PullRequestDoesNotExist(ref cause) => cause,
GetCommentsForPullRequestError::PullRequestIdRequired(ref cause) => cause,
GetCommentsForPullRequestError::RepositoryDoesNotExist(ref cause) => cause,
GetCommentsForPullRequestError::RepositoryNameRequired(ref cause) => cause,
GetCommentsForPullRequestError::RepositoryNotAssociatedWithPullRequest(ref cause) => {
cause
}
GetCommentsForPullRequestError::Validation(ref cause) => cause,
GetCommentsForPullRequestError::Credentials(ref err) => err.description(),
GetCommentsForPullRequestError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
GetCommentsForPullRequestError::ParseError(ref cause) => cause,
GetCommentsForPullRequestError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetCommitError {
CommitIdDoesNotExist(String),
CommitIdRequired(String),
EncryptionIntegrityChecksFailed(String),
EncryptionKeyAccessDenied(String),
EncryptionKeyDisabled(String),
EncryptionKeyNotFound(String),
EncryptionKeyUnavailable(String),
InvalidCommitId(String),
InvalidRepositoryName(String),
RepositoryDoesNotExist(String),
RepositoryNameRequired(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetCommitError {
pub fn from_response(res: BufferedHttpResponse) -> GetCommitError {
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 {
"CommitIdDoesNotExistException" => {
return GetCommitError::CommitIdDoesNotExist(String::from(error_message));
}
"CommitIdRequiredException" => {
return GetCommitError::CommitIdRequired(String::from(error_message));
}
"EncryptionIntegrityChecksFailedException" => {
return GetCommitError::EncryptionIntegrityChecksFailed(String::from(
error_message,
));
}
"EncryptionKeyAccessDeniedException" => {
return GetCommitError::EncryptionKeyAccessDenied(String::from(error_message));
}
"EncryptionKeyDisabledException" => {
return GetCommitError::EncryptionKeyDisabled(String::from(error_message));
}
"EncryptionKeyNotFoundException" => {
return GetCommitError::EncryptionKeyNotFound(String::from(error_message));
}
"EncryptionKeyUnavailableException" => {
return GetCommitError::EncryptionKeyUnavailable(String::from(error_message));
}
"InvalidCommitIdException" => {
return GetCommitError::InvalidCommitId(String::from(error_message));
}
"InvalidRepositoryNameException" => {
return GetCommitError::InvalidRepositoryName(String::from(error_message));
}
"RepositoryDoesNotExistException" => {
return GetCommitError::RepositoryDoesNotExist(String::from(error_message));
}
"RepositoryNameRequiredException" => {
return GetCommitError::RepositoryNameRequired(String::from(error_message));
}
"ValidationException" => {
return GetCommitError::Validation(error_message.to_string());
}
_ => {}
}
}
return GetCommitError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetCommitError {
fn from(err: serde_json::error::Error) -> GetCommitError {
GetCommitError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetCommitError {
fn from(err: CredentialsError) -> GetCommitError {
GetCommitError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetCommitError {
fn from(err: HttpDispatchError) -> GetCommitError {
GetCommitError::HttpDispatch(err)
}
}
impl From<io::Error> for GetCommitError {
fn from(err: io::Error) -> GetCommitError {
GetCommitError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetCommitError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetCommitError {
fn description(&self) -> &str {
match *self {
GetCommitError::CommitIdDoesNotExist(ref cause) => cause,
GetCommitError::CommitIdRequired(ref cause) => cause,
GetCommitError::EncryptionIntegrityChecksFailed(ref cause) => cause,
GetCommitError::EncryptionKeyAccessDenied(ref cause) => cause,
GetCommitError::EncryptionKeyDisabled(ref cause) => cause,
GetCommitError::EncryptionKeyNotFound(ref cause) => cause,
GetCommitError::EncryptionKeyUnavailable(ref cause) => cause,
GetCommitError::InvalidCommitId(ref cause) => cause,
GetCommitError::InvalidRepositoryName(ref cause) => cause,
GetCommitError::RepositoryDoesNotExist(ref cause) => cause,
GetCommitError::RepositoryNameRequired(ref cause) => cause,
GetCommitError::Validation(ref cause) => cause,
GetCommitError::Credentials(ref err) => err.description(),
GetCommitError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
GetCommitError::ParseError(ref cause) => cause,
GetCommitError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetDifferencesError {
CommitDoesNotExist(String),
CommitRequired(String),
EncryptionIntegrityChecksFailed(String),
EncryptionKeyAccessDenied(String),
EncryptionKeyDisabled(String),
EncryptionKeyNotFound(String),
EncryptionKeyUnavailable(String),
InvalidCommit(String),
InvalidCommitId(String),
InvalidContinuationToken(String),
InvalidMaxResults(String),
InvalidPath(String),
InvalidRepositoryName(String),
PathDoesNotExist(String),
RepositoryDoesNotExist(String),
RepositoryNameRequired(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetDifferencesError {
pub fn from_response(res: BufferedHttpResponse) -> GetDifferencesError {
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 {
"CommitDoesNotExistException" => {
return GetDifferencesError::CommitDoesNotExist(String::from(error_message));
}
"CommitRequiredException" => {
return GetDifferencesError::CommitRequired(String::from(error_message));
}
"EncryptionIntegrityChecksFailedException" => {
return GetDifferencesError::EncryptionIntegrityChecksFailed(String::from(
error_message,
));
}
"EncryptionKeyAccessDeniedException" => {
return GetDifferencesError::EncryptionKeyAccessDenied(String::from(
error_message,
));
}
"EncryptionKeyDisabledException" => {
return GetDifferencesError::EncryptionKeyDisabled(String::from(error_message));
}
"EncryptionKeyNotFoundException" => {
return GetDifferencesError::EncryptionKeyNotFound(String::from(error_message));
}
"EncryptionKeyUnavailableException" => {
return GetDifferencesError::EncryptionKeyUnavailable(String::from(
error_message,
));
}
"InvalidCommitException" => {
return GetDifferencesError::InvalidCommit(String::from(error_message));
}
"InvalidCommitIdException" => {
return GetDifferencesError::InvalidCommitId(String::from(error_message));
}
"InvalidContinuationTokenException" => {
return GetDifferencesError::InvalidContinuationToken(String::from(
error_message,
));
}
"InvalidMaxResultsException" => {
return GetDifferencesError::InvalidMaxResults(String::from(error_message));
}
"InvalidPathException" => {
return GetDifferencesError::InvalidPath(String::from(error_message));
}
"InvalidRepositoryNameException" => {
return GetDifferencesError::InvalidRepositoryName(String::from(error_message));
}
"PathDoesNotExistException" => {
return GetDifferencesError::PathDoesNotExist(String::from(error_message));
}
"RepositoryDoesNotExistException" => {
return GetDifferencesError::RepositoryDoesNotExist(String::from(error_message));
}
"RepositoryNameRequiredException" => {
return GetDifferencesError::RepositoryNameRequired(String::from(error_message));
}
"ValidationException" => {
return GetDifferencesError::Validation(error_message.to_string());
}
_ => {}
}
}
return GetDifferencesError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetDifferencesError {
fn from(err: serde_json::error::Error) -> GetDifferencesError {
GetDifferencesError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetDifferencesError {
fn from(err: CredentialsError) -> GetDifferencesError {
GetDifferencesError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetDifferencesError {
fn from(err: HttpDispatchError) -> GetDifferencesError {
GetDifferencesError::HttpDispatch(err)
}
}
impl From<io::Error> for GetDifferencesError {
fn from(err: io::Error) -> GetDifferencesError {
GetDifferencesError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetDifferencesError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetDifferencesError {
fn description(&self) -> &str {
match *self {
GetDifferencesError::CommitDoesNotExist(ref cause) => cause,
GetDifferencesError::CommitRequired(ref cause) => cause,
GetDifferencesError::EncryptionIntegrityChecksFailed(ref cause) => cause,
GetDifferencesError::EncryptionKeyAccessDenied(ref cause) => cause,
GetDifferencesError::EncryptionKeyDisabled(ref cause) => cause,
GetDifferencesError::EncryptionKeyNotFound(ref cause) => cause,
GetDifferencesError::EncryptionKeyUnavailable(ref cause) => cause,
GetDifferencesError::InvalidCommit(ref cause) => cause,
GetDifferencesError::InvalidCommitId(ref cause) => cause,
GetDifferencesError::InvalidContinuationToken(ref cause) => cause,
GetDifferencesError::InvalidMaxResults(ref cause) => cause,
GetDifferencesError::InvalidPath(ref cause) => cause,
GetDifferencesError::InvalidRepositoryName(ref cause) => cause,
GetDifferencesError::PathDoesNotExist(ref cause) => cause,
GetDifferencesError::RepositoryDoesNotExist(ref cause) => cause,
GetDifferencesError::RepositoryNameRequired(ref cause) => cause,
GetDifferencesError::Validation(ref cause) => cause,
GetDifferencesError::Credentials(ref err) => err.description(),
GetDifferencesError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
GetDifferencesError::ParseError(ref cause) => cause,
GetDifferencesError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetFileError {
CommitDoesNotExist(String),
EncryptionIntegrityChecksFailed(String),
EncryptionKeyAccessDenied(String),
EncryptionKeyDisabled(String),
EncryptionKeyNotFound(String),
EncryptionKeyUnavailable(String),
FileDoesNotExist(String),
FileTooLarge(String),
InvalidCommit(String),
InvalidPath(String),
InvalidRepositoryName(String),
PathRequired(String),
RepositoryDoesNotExist(String),
RepositoryNameRequired(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetFileError {
pub fn from_response(res: BufferedHttpResponse) -> GetFileError {
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 {
"CommitDoesNotExistException" => {
return GetFileError::CommitDoesNotExist(String::from(error_message));
}
"EncryptionIntegrityChecksFailedException" => {
return GetFileError::EncryptionIntegrityChecksFailed(String::from(
error_message,
));
}
"EncryptionKeyAccessDeniedException" => {
return GetFileError::EncryptionKeyAccessDenied(String::from(error_message));
}
"EncryptionKeyDisabledException" => {
return GetFileError::EncryptionKeyDisabled(String::from(error_message));
}
"EncryptionKeyNotFoundException" => {
return GetFileError::EncryptionKeyNotFound(String::from(error_message));
}
"EncryptionKeyUnavailableException" => {
return GetFileError::EncryptionKeyUnavailable(String::from(error_message));
}
"FileDoesNotExistException" => {
return GetFileError::FileDoesNotExist(String::from(error_message));
}
"FileTooLargeException" => {
return GetFileError::FileTooLarge(String::from(error_message));
}
"InvalidCommitException" => {
return GetFileError::InvalidCommit(String::from(error_message));
}
"InvalidPathException" => {
return GetFileError::InvalidPath(String::from(error_message));
}
"InvalidRepositoryNameException" => {
return GetFileError::InvalidRepositoryName(String::from(error_message));
}
"PathRequiredException" => {
return GetFileError::PathRequired(String::from(error_message));
}
"RepositoryDoesNotExistException" => {
return GetFileError::RepositoryDoesNotExist(String::from(error_message));
}
"RepositoryNameRequiredException" => {
return GetFileError::RepositoryNameRequired(String::from(error_message));
}
"ValidationException" => return GetFileError::Validation(error_message.to_string()),
_ => {}
}
}
return GetFileError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetFileError {
fn from(err: serde_json::error::Error) -> GetFileError {
GetFileError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetFileError {
fn from(err: CredentialsError) -> GetFileError {
GetFileError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetFileError {
fn from(err: HttpDispatchError) -> GetFileError {
GetFileError::HttpDispatch(err)
}
}
impl From<io::Error> for GetFileError {
fn from(err: io::Error) -> GetFileError {
GetFileError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetFileError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetFileError {
fn description(&self) -> &str {
match *self {
GetFileError::CommitDoesNotExist(ref cause) => cause,
GetFileError::EncryptionIntegrityChecksFailed(ref cause) => cause,
GetFileError::EncryptionKeyAccessDenied(ref cause) => cause,
GetFileError::EncryptionKeyDisabled(ref cause) => cause,
GetFileError::EncryptionKeyNotFound(ref cause) => cause,
GetFileError::EncryptionKeyUnavailable(ref cause) => cause,
GetFileError::FileDoesNotExist(ref cause) => cause,
GetFileError::FileTooLarge(ref cause) => cause,
GetFileError::InvalidCommit(ref cause) => cause,
GetFileError::InvalidPath(ref cause) => cause,
GetFileError::InvalidRepositoryName(ref cause) => cause,
GetFileError::PathRequired(ref cause) => cause,
GetFileError::RepositoryDoesNotExist(ref cause) => cause,
GetFileError::RepositoryNameRequired(ref cause) => cause,
GetFileError::Validation(ref cause) => cause,
GetFileError::Credentials(ref err) => err.description(),
GetFileError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
GetFileError::ParseError(ref cause) => cause,
GetFileError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetFolderError {
CommitDoesNotExist(String),
EncryptionIntegrityChecksFailed(String),
EncryptionKeyAccessDenied(String),
EncryptionKeyDisabled(String),
EncryptionKeyNotFound(String),
EncryptionKeyUnavailable(String),
FolderDoesNotExist(String),
InvalidCommit(String),
InvalidPath(String),
InvalidRepositoryName(String),
PathRequired(String),
RepositoryDoesNotExist(String),
RepositoryNameRequired(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetFolderError {
pub fn from_response(res: BufferedHttpResponse) -> GetFolderError {
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 {
"CommitDoesNotExistException" => {
return GetFolderError::CommitDoesNotExist(String::from(error_message));
}
"EncryptionIntegrityChecksFailedException" => {
return GetFolderError::EncryptionIntegrityChecksFailed(String::from(
error_message,
));
}
"EncryptionKeyAccessDeniedException" => {
return GetFolderError::EncryptionKeyAccessDenied(String::from(error_message));
}
"EncryptionKeyDisabledException" => {
return GetFolderError::EncryptionKeyDisabled(String::from(error_message));
}
"EncryptionKeyNotFoundException" => {
return GetFolderError::EncryptionKeyNotFound(String::from(error_message));
}
"EncryptionKeyUnavailableException" => {
return GetFolderError::EncryptionKeyUnavailable(String::from(error_message));
}
"FolderDoesNotExistException" => {
return GetFolderError::FolderDoesNotExist(String::from(error_message));
}
"InvalidCommitException" => {
return GetFolderError::InvalidCommit(String::from(error_message));
}
"InvalidPathException" => {
return GetFolderError::InvalidPath(String::from(error_message));
}
"InvalidRepositoryNameException" => {
return GetFolderError::InvalidRepositoryName(String::from(error_message));
}
"PathRequiredException" => {
return GetFolderError::PathRequired(String::from(error_message));
}
"RepositoryDoesNotExistException" => {
return GetFolderError::RepositoryDoesNotExist(String::from(error_message));
}
"RepositoryNameRequiredException" => {
return GetFolderError::RepositoryNameRequired(String::from(error_message));
}
"ValidationException" => {
return GetFolderError::Validation(error_message.to_string());
}
_ => {}
}
}
return GetFolderError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetFolderError {
fn from(err: serde_json::error::Error) -> GetFolderError {
GetFolderError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetFolderError {
fn from(err: CredentialsError) -> GetFolderError {
GetFolderError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetFolderError {
fn from(err: HttpDispatchError) -> GetFolderError {
GetFolderError::HttpDispatch(err)
}
}
impl From<io::Error> for GetFolderError {
fn from(err: io::Error) -> GetFolderError {
GetFolderError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetFolderError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetFolderError {
fn description(&self) -> &str {
match *self {
GetFolderError::CommitDoesNotExist(ref cause) => cause,
GetFolderError::EncryptionIntegrityChecksFailed(ref cause) => cause,
GetFolderError::EncryptionKeyAccessDenied(ref cause) => cause,
GetFolderError::EncryptionKeyDisabled(ref cause) => cause,
GetFolderError::EncryptionKeyNotFound(ref cause) => cause,
GetFolderError::EncryptionKeyUnavailable(ref cause) => cause,
GetFolderError::FolderDoesNotExist(ref cause) => cause,
GetFolderError::InvalidCommit(ref cause) => cause,
GetFolderError::InvalidPath(ref cause) => cause,
GetFolderError::InvalidRepositoryName(ref cause) => cause,
GetFolderError::PathRequired(ref cause) => cause,
GetFolderError::RepositoryDoesNotExist(ref cause) => cause,
GetFolderError::RepositoryNameRequired(ref cause) => cause,
GetFolderError::Validation(ref cause) => cause,
GetFolderError::Credentials(ref err) => err.description(),
GetFolderError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
GetFolderError::ParseError(ref cause) => cause,
GetFolderError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetMergeConflictsError {
CommitDoesNotExist(String),
CommitRequired(String),
EncryptionIntegrityChecksFailed(String),
EncryptionKeyAccessDenied(String),
EncryptionKeyDisabled(String),
EncryptionKeyNotFound(String),
EncryptionKeyUnavailable(String),
InvalidCommit(String),
InvalidDestinationCommitSpecifier(String),
InvalidMergeOption(String),
InvalidRepositoryName(String),
InvalidSourceCommitSpecifier(String),
MergeOptionRequired(String),
RepositoryDoesNotExist(String),
RepositoryNameRequired(String),
TipsDivergenceExceeded(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetMergeConflictsError {
pub fn from_response(res: BufferedHttpResponse) -> GetMergeConflictsError {
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 {
"CommitDoesNotExistException" => {
return GetMergeConflictsError::CommitDoesNotExist(String::from(error_message));
}
"CommitRequiredException" => {
return GetMergeConflictsError::CommitRequired(String::from(error_message));
}
"EncryptionIntegrityChecksFailedException" => {
return GetMergeConflictsError::EncryptionIntegrityChecksFailed(String::from(
error_message,
));
}
"EncryptionKeyAccessDeniedException" => {
return GetMergeConflictsError::EncryptionKeyAccessDenied(String::from(
error_message,
));
}
"EncryptionKeyDisabledException" => {
return GetMergeConflictsError::EncryptionKeyDisabled(String::from(
error_message,
));
}
"EncryptionKeyNotFoundException" => {
return GetMergeConflictsError::EncryptionKeyNotFound(String::from(
error_message,
));
}
"EncryptionKeyUnavailableException" => {
return GetMergeConflictsError::EncryptionKeyUnavailable(String::from(
error_message,
));
}
"InvalidCommitException" => {
return GetMergeConflictsError::InvalidCommit(String::from(error_message));
}
"InvalidDestinationCommitSpecifierException" => {
return GetMergeConflictsError::InvalidDestinationCommitSpecifier(String::from(
error_message,
));
}
"InvalidMergeOptionException" => {
return GetMergeConflictsError::InvalidMergeOption(String::from(error_message));
}
"InvalidRepositoryNameException" => {
return GetMergeConflictsError::InvalidRepositoryName(String::from(
error_message,
));
}
"InvalidSourceCommitSpecifierException" => {
return GetMergeConflictsError::InvalidSourceCommitSpecifier(String::from(
error_message,
));
}
"MergeOptionRequiredException" => {
return GetMergeConflictsError::MergeOptionRequired(String::from(error_message));
}
"RepositoryDoesNotExistException" => {
return GetMergeConflictsError::RepositoryDoesNotExist(String::from(
error_message,
));
}
"RepositoryNameRequiredException" => {
return GetMergeConflictsError::RepositoryNameRequired(String::from(
error_message,
));
}
"TipsDivergenceExceededException" => {
return GetMergeConflictsError::TipsDivergenceExceeded(String::from(
error_message,
));
}
"ValidationException" => {
return GetMergeConflictsError::Validation(error_message.to_string());
}
_ => {}
}
}
return GetMergeConflictsError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetMergeConflictsError {
fn from(err: serde_json::error::Error) -> GetMergeConflictsError {
GetMergeConflictsError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetMergeConflictsError {
fn from(err: CredentialsError) -> GetMergeConflictsError {
GetMergeConflictsError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetMergeConflictsError {
fn from(err: HttpDispatchError) -> GetMergeConflictsError {
GetMergeConflictsError::HttpDispatch(err)
}
}
impl From<io::Error> for GetMergeConflictsError {
fn from(err: io::Error) -> GetMergeConflictsError {
GetMergeConflictsError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetMergeConflictsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetMergeConflictsError {
fn description(&self) -> &str {
match *self {
GetMergeConflictsError::CommitDoesNotExist(ref cause) => cause,
GetMergeConflictsError::CommitRequired(ref cause) => cause,
GetMergeConflictsError::EncryptionIntegrityChecksFailed(ref cause) => cause,
GetMergeConflictsError::EncryptionKeyAccessDenied(ref cause) => cause,
GetMergeConflictsError::EncryptionKeyDisabled(ref cause) => cause,
GetMergeConflictsError::EncryptionKeyNotFound(ref cause) => cause,
GetMergeConflictsError::EncryptionKeyUnavailable(ref cause) => cause,
GetMergeConflictsError::InvalidCommit(ref cause) => cause,
GetMergeConflictsError::InvalidDestinationCommitSpecifier(ref cause) => cause,
GetMergeConflictsError::InvalidMergeOption(ref cause) => cause,
GetMergeConflictsError::InvalidRepositoryName(ref cause) => cause,
GetMergeConflictsError::InvalidSourceCommitSpecifier(ref cause) => cause,
GetMergeConflictsError::MergeOptionRequired(ref cause) => cause,
GetMergeConflictsError::RepositoryDoesNotExist(ref cause) => cause,
GetMergeConflictsError::RepositoryNameRequired(ref cause) => cause,
GetMergeConflictsError::TipsDivergenceExceeded(ref cause) => cause,
GetMergeConflictsError::Validation(ref cause) => cause,
GetMergeConflictsError::Credentials(ref err) => err.description(),
GetMergeConflictsError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
GetMergeConflictsError::ParseError(ref cause) => cause,
GetMergeConflictsError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetPullRequestError {
EncryptionIntegrityChecksFailed(String),
EncryptionKeyAccessDenied(String),
EncryptionKeyDisabled(String),
EncryptionKeyNotFound(String),
EncryptionKeyUnavailable(String),
InvalidPullRequestId(String),
PullRequestDoesNotExist(String),
PullRequestIdRequired(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetPullRequestError {
pub fn from_response(res: BufferedHttpResponse) -> GetPullRequestError {
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 {
"EncryptionIntegrityChecksFailedException" => {
return GetPullRequestError::EncryptionIntegrityChecksFailed(String::from(
error_message,
));
}
"EncryptionKeyAccessDeniedException" => {
return GetPullRequestError::EncryptionKeyAccessDenied(String::from(
error_message,
));
}
"EncryptionKeyDisabledException" => {
return GetPullRequestError::EncryptionKeyDisabled(String::from(error_message));
}
"EncryptionKeyNotFoundException" => {
return GetPullRequestError::EncryptionKeyNotFound(String::from(error_message));
}
"EncryptionKeyUnavailableException" => {
return GetPullRequestError::EncryptionKeyUnavailable(String::from(
error_message,
));
}
"InvalidPullRequestIdException" => {
return GetPullRequestError::InvalidPullRequestId(String::from(error_message));
}
"PullRequestDoesNotExistException" => {
return GetPullRequestError::PullRequestDoesNotExist(String::from(error_message));
}
"PullRequestIdRequiredException" => {
return GetPullRequestError::PullRequestIdRequired(String::from(error_message));
}
"ValidationException" => {
return GetPullRequestError::Validation(error_message.to_string());
}
_ => {}
}
}
return GetPullRequestError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetPullRequestError {
fn from(err: serde_json::error::Error) -> GetPullRequestError {
GetPullRequestError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetPullRequestError {
fn from(err: CredentialsError) -> GetPullRequestError {
GetPullRequestError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetPullRequestError {
fn from(err: HttpDispatchError) -> GetPullRequestError {
GetPullRequestError::HttpDispatch(err)
}
}
impl From<io::Error> for GetPullRequestError {
fn from(err: io::Error) -> GetPullRequestError {
GetPullRequestError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetPullRequestError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetPullRequestError {
fn description(&self) -> &str {
match *self {
GetPullRequestError::EncryptionIntegrityChecksFailed(ref cause) => cause,
GetPullRequestError::EncryptionKeyAccessDenied(ref cause) => cause,
GetPullRequestError::EncryptionKeyDisabled(ref cause) => cause,
GetPullRequestError::EncryptionKeyNotFound(ref cause) => cause,
GetPullRequestError::EncryptionKeyUnavailable(ref cause) => cause,
GetPullRequestError::InvalidPullRequestId(ref cause) => cause,
GetPullRequestError::PullRequestDoesNotExist(ref cause) => cause,
GetPullRequestError::PullRequestIdRequired(ref cause) => cause,
GetPullRequestError::Validation(ref cause) => cause,
GetPullRequestError::Credentials(ref err) => err.description(),
GetPullRequestError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
GetPullRequestError::ParseError(ref cause) => cause,
GetPullRequestError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetRepositoryError {
EncryptionIntegrityChecksFailed(String),
EncryptionKeyAccessDenied(String),
EncryptionKeyDisabled(String),
EncryptionKeyNotFound(String),
EncryptionKeyUnavailable(String),
InvalidRepositoryName(String),
RepositoryDoesNotExist(String),
RepositoryNameRequired(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetRepositoryError {
pub fn from_response(res: BufferedHttpResponse) -> GetRepositoryError {
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 {
"EncryptionIntegrityChecksFailedException" => {
return GetRepositoryError::EncryptionIntegrityChecksFailed(String::from(
error_message,
));
}
"EncryptionKeyAccessDeniedException" => {
return GetRepositoryError::EncryptionKeyAccessDenied(String::from(
error_message,
));
}
"EncryptionKeyDisabledException" => {
return GetRepositoryError::EncryptionKeyDisabled(String::from(error_message));
}
"EncryptionKeyNotFoundException" => {
return GetRepositoryError::EncryptionKeyNotFound(String::from(error_message));
}
"EncryptionKeyUnavailableException" => {
return GetRepositoryError::EncryptionKeyUnavailable(String::from(error_message));
}
"InvalidRepositoryNameException" => {
return GetRepositoryError::InvalidRepositoryName(String::from(error_message));
}
"RepositoryDoesNotExistException" => {
return GetRepositoryError::RepositoryDoesNotExist(String::from(error_message));
}
"RepositoryNameRequiredException" => {
return GetRepositoryError::RepositoryNameRequired(String::from(error_message));
}
"ValidationException" => {
return GetRepositoryError::Validation(error_message.to_string());
}
_ => {}
}
}
return GetRepositoryError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetRepositoryError {
fn from(err: serde_json::error::Error) -> GetRepositoryError {
GetRepositoryError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetRepositoryError {
fn from(err: CredentialsError) -> GetRepositoryError {
GetRepositoryError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetRepositoryError {
fn from(err: HttpDispatchError) -> GetRepositoryError {
GetRepositoryError::HttpDispatch(err)
}
}
impl From<io::Error> for GetRepositoryError {
fn from(err: io::Error) -> GetRepositoryError {
GetRepositoryError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetRepositoryError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetRepositoryError {
fn description(&self) -> &str {
match *self {
GetRepositoryError::EncryptionIntegrityChecksFailed(ref cause) => cause,
GetRepositoryError::EncryptionKeyAccessDenied(ref cause) => cause,
GetRepositoryError::EncryptionKeyDisabled(ref cause) => cause,
GetRepositoryError::EncryptionKeyNotFound(ref cause) => cause,
GetRepositoryError::EncryptionKeyUnavailable(ref cause) => cause,
GetRepositoryError::InvalidRepositoryName(ref cause) => cause,
GetRepositoryError::RepositoryDoesNotExist(ref cause) => cause,
GetRepositoryError::RepositoryNameRequired(ref cause) => cause,
GetRepositoryError::Validation(ref cause) => cause,
GetRepositoryError::Credentials(ref err) => err.description(),
GetRepositoryError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
GetRepositoryError::ParseError(ref cause) => cause,
GetRepositoryError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetRepositoryTriggersError {
EncryptionIntegrityChecksFailed(String),
EncryptionKeyAccessDenied(String),
EncryptionKeyDisabled(String),
EncryptionKeyNotFound(String),
EncryptionKeyUnavailable(String),
InvalidRepositoryName(String),
RepositoryDoesNotExist(String),
RepositoryNameRequired(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetRepositoryTriggersError {
pub fn from_response(res: BufferedHttpResponse) -> GetRepositoryTriggersError {
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 {
"EncryptionIntegrityChecksFailedException" => {
return GetRepositoryTriggersError::EncryptionIntegrityChecksFailed(
String::from(error_message),
);
}
"EncryptionKeyAccessDeniedException" => {
return GetRepositoryTriggersError::EncryptionKeyAccessDenied(String::from(
error_message,
));
}
"EncryptionKeyDisabledException" => {
return GetRepositoryTriggersError::EncryptionKeyDisabled(String::from(
error_message,
));
}
"EncryptionKeyNotFoundException" => {
return GetRepositoryTriggersError::EncryptionKeyNotFound(String::from(
error_message,
));
}
"EncryptionKeyUnavailableException" => {
return GetRepositoryTriggersError::EncryptionKeyUnavailable(String::from(
error_message,
));
}
"InvalidRepositoryNameException" => {
return GetRepositoryTriggersError::InvalidRepositoryName(String::from(
error_message,
));
}
"RepositoryDoesNotExistException" => {
return GetRepositoryTriggersError::RepositoryDoesNotExist(String::from(
error_message,
));
}
"RepositoryNameRequiredException" => {
return GetRepositoryTriggersError::RepositoryNameRequired(String::from(
error_message,
));
}
"ValidationException" => {
return GetRepositoryTriggersError::Validation(error_message.to_string());
}
_ => {}
}
}
return GetRepositoryTriggersError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetRepositoryTriggersError {
fn from(err: serde_json::error::Error) -> GetRepositoryTriggersError {
GetRepositoryTriggersError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetRepositoryTriggersError {
fn from(err: CredentialsError) -> GetRepositoryTriggersError {
GetRepositoryTriggersError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetRepositoryTriggersError {
fn from(err: HttpDispatchError) -> GetRepositoryTriggersError {
GetRepositoryTriggersError::HttpDispatch(err)
}
}
impl From<io::Error> for GetRepositoryTriggersError {
fn from(err: io::Error) -> GetRepositoryTriggersError {
GetRepositoryTriggersError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetRepositoryTriggersError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetRepositoryTriggersError {
fn description(&self) -> &str {
match *self {
GetRepositoryTriggersError::EncryptionIntegrityChecksFailed(ref cause) => cause,
GetRepositoryTriggersError::EncryptionKeyAccessDenied(ref cause) => cause,
GetRepositoryTriggersError::EncryptionKeyDisabled(ref cause) => cause,
GetRepositoryTriggersError::EncryptionKeyNotFound(ref cause) => cause,
GetRepositoryTriggersError::EncryptionKeyUnavailable(ref cause) => cause,
GetRepositoryTriggersError::InvalidRepositoryName(ref cause) => cause,
GetRepositoryTriggersError::RepositoryDoesNotExist(ref cause) => cause,
GetRepositoryTriggersError::RepositoryNameRequired(ref cause) => cause,
GetRepositoryTriggersError::Validation(ref cause) => cause,
GetRepositoryTriggersError::Credentials(ref err) => err.description(),
GetRepositoryTriggersError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
GetRepositoryTriggersError::ParseError(ref cause) => cause,
GetRepositoryTriggersError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListBranchesError {
EncryptionIntegrityChecksFailed(String),
EncryptionKeyAccessDenied(String),
EncryptionKeyDisabled(String),
EncryptionKeyNotFound(String),
EncryptionKeyUnavailable(String),
InvalidContinuationToken(String),
InvalidRepositoryName(String),
RepositoryDoesNotExist(String),
RepositoryNameRequired(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ListBranchesError {
pub fn from_response(res: BufferedHttpResponse) -> ListBranchesError {
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 {
"EncryptionIntegrityChecksFailedException" => {
return ListBranchesError::EncryptionIntegrityChecksFailed(String::from(
error_message,
));
}
"EncryptionKeyAccessDeniedException" => {
return ListBranchesError::EncryptionKeyAccessDenied(String::from(error_message));
}
"EncryptionKeyDisabledException" => {
return ListBranchesError::EncryptionKeyDisabled(String::from(error_message));
}
"EncryptionKeyNotFoundException" => {
return ListBranchesError::EncryptionKeyNotFound(String::from(error_message));
}
"EncryptionKeyUnavailableException" => {
return ListBranchesError::EncryptionKeyUnavailable(String::from(error_message));
}
"InvalidContinuationTokenException" => {
return ListBranchesError::InvalidContinuationToken(String::from(error_message));
}
"InvalidRepositoryNameException" => {
return ListBranchesError::InvalidRepositoryName(String::from(error_message));
}
"RepositoryDoesNotExistException" => {
return ListBranchesError::RepositoryDoesNotExist(String::from(error_message));
}
"RepositoryNameRequiredException" => {
return ListBranchesError::RepositoryNameRequired(String::from(error_message));
}
"ValidationException" => {
return ListBranchesError::Validation(error_message.to_string());
}
_ => {}
}
}
return ListBranchesError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ListBranchesError {
fn from(err: serde_json::error::Error) -> ListBranchesError {
ListBranchesError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ListBranchesError {
fn from(err: CredentialsError) -> ListBranchesError {
ListBranchesError::Credentials(err)
}
}
impl From<HttpDispatchError> for ListBranchesError {
fn from(err: HttpDispatchError) -> ListBranchesError {
ListBranchesError::HttpDispatch(err)
}
}
impl From<io::Error> for ListBranchesError {
fn from(err: io::Error) -> ListBranchesError {
ListBranchesError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ListBranchesError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListBranchesError {
fn description(&self) -> &str {
match *self {
ListBranchesError::EncryptionIntegrityChecksFailed(ref cause) => cause,
ListBranchesError::EncryptionKeyAccessDenied(ref cause) => cause,
ListBranchesError::EncryptionKeyDisabled(ref cause) => cause,
ListBranchesError::EncryptionKeyNotFound(ref cause) => cause,
ListBranchesError::EncryptionKeyUnavailable(ref cause) => cause,
ListBranchesError::InvalidContinuationToken(ref cause) => cause,
ListBranchesError::InvalidRepositoryName(ref cause) => cause,
ListBranchesError::RepositoryDoesNotExist(ref cause) => cause,
ListBranchesError::RepositoryNameRequired(ref cause) => cause,
ListBranchesError::Validation(ref cause) => cause,
ListBranchesError::Credentials(ref err) => err.description(),
ListBranchesError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
ListBranchesError::ParseError(ref cause) => cause,
ListBranchesError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListPullRequestsError {
AuthorDoesNotExist(String),
EncryptionIntegrityChecksFailed(String),
EncryptionKeyAccessDenied(String),
EncryptionKeyDisabled(String),
EncryptionKeyNotFound(String),
EncryptionKeyUnavailable(String),
InvalidAuthorArn(String),
InvalidContinuationToken(String),
InvalidMaxResults(String),
InvalidPullRequestStatus(String),
InvalidRepositoryName(String),
RepositoryDoesNotExist(String),
RepositoryNameRequired(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ListPullRequestsError {
pub fn from_response(res: BufferedHttpResponse) -> ListPullRequestsError {
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 {
"AuthorDoesNotExistException" => {
return ListPullRequestsError::AuthorDoesNotExist(String::from(error_message));
}
"EncryptionIntegrityChecksFailedException" => {
return ListPullRequestsError::EncryptionIntegrityChecksFailed(String::from(
error_message,
));
}
"EncryptionKeyAccessDeniedException" => {
return ListPullRequestsError::EncryptionKeyAccessDenied(String::from(
error_message,
));
}
"EncryptionKeyDisabledException" => {
return ListPullRequestsError::EncryptionKeyDisabled(String::from(error_message));
}
"EncryptionKeyNotFoundException" => {
return ListPullRequestsError::EncryptionKeyNotFound(String::from(error_message));
}
"EncryptionKeyUnavailableException" => {
return ListPullRequestsError::EncryptionKeyUnavailable(String::from(
error_message,
));
}
"InvalidAuthorArnException" => {
return ListPullRequestsError::InvalidAuthorArn(String::from(error_message));
}
"InvalidContinuationTokenException" => {
return ListPullRequestsError::InvalidContinuationToken(String::from(
error_message,
));
}
"InvalidMaxResultsException" => {
return ListPullRequestsError::InvalidMaxResults(String::from(error_message));
}
"InvalidPullRequestStatusException" => {
return ListPullRequestsError::InvalidPullRequestStatus(String::from(
error_message,
));
}
"InvalidRepositoryNameException" => {
return ListPullRequestsError::InvalidRepositoryName(String::from(error_message));
}
"RepositoryDoesNotExistException" => {
return ListPullRequestsError::RepositoryDoesNotExist(String::from(
error_message,
));
}
"RepositoryNameRequiredException" => {
return ListPullRequestsError::RepositoryNameRequired(String::from(
error_message,
));
}
"ValidationException" => {
return ListPullRequestsError::Validation(error_message.to_string());
}
_ => {}
}
}
return ListPullRequestsError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ListPullRequestsError {
fn from(err: serde_json::error::Error) -> ListPullRequestsError {
ListPullRequestsError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ListPullRequestsError {
fn from(err: CredentialsError) -> ListPullRequestsError {
ListPullRequestsError::Credentials(err)
}
}
impl From<HttpDispatchError> for ListPullRequestsError {
fn from(err: HttpDispatchError) -> ListPullRequestsError {
ListPullRequestsError::HttpDispatch(err)
}
}
impl From<io::Error> for ListPullRequestsError {
fn from(err: io::Error) -> ListPullRequestsError {
ListPullRequestsError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ListPullRequestsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListPullRequestsError {
fn description(&self) -> &str {
match *self {
ListPullRequestsError::AuthorDoesNotExist(ref cause) => cause,
ListPullRequestsError::EncryptionIntegrityChecksFailed(ref cause) => cause,
ListPullRequestsError::EncryptionKeyAccessDenied(ref cause) => cause,
ListPullRequestsError::EncryptionKeyDisabled(ref cause) => cause,
ListPullRequestsError::EncryptionKeyNotFound(ref cause) => cause,
ListPullRequestsError::EncryptionKeyUnavailable(ref cause) => cause,
ListPullRequestsError::InvalidAuthorArn(ref cause) => cause,
ListPullRequestsError::InvalidContinuationToken(ref cause) => cause,
ListPullRequestsError::InvalidMaxResults(ref cause) => cause,
ListPullRequestsError::InvalidPullRequestStatus(ref cause) => cause,
ListPullRequestsError::InvalidRepositoryName(ref cause) => cause,
ListPullRequestsError::RepositoryDoesNotExist(ref cause) => cause,
ListPullRequestsError::RepositoryNameRequired(ref cause) => cause,
ListPullRequestsError::Validation(ref cause) => cause,
ListPullRequestsError::Credentials(ref err) => err.description(),
ListPullRequestsError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
ListPullRequestsError::ParseError(ref cause) => cause,
ListPullRequestsError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListRepositoriesError {
InvalidContinuationToken(String),
InvalidOrder(String),
InvalidSortBy(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ListRepositoriesError {
pub fn from_response(res: BufferedHttpResponse) -> ListRepositoriesError {
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 {
"InvalidContinuationTokenException" => {
return ListRepositoriesError::InvalidContinuationToken(String::from(
error_message,
));
}
"InvalidOrderException" => {
return ListRepositoriesError::InvalidOrder(String::from(error_message));
}
"InvalidSortByException" => {
return ListRepositoriesError::InvalidSortBy(String::from(error_message));
}
"ValidationException" => {
return ListRepositoriesError::Validation(error_message.to_string());
}
_ => {}
}
}
return ListRepositoriesError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ListRepositoriesError {
fn from(err: serde_json::error::Error) -> ListRepositoriesError {
ListRepositoriesError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ListRepositoriesError {
fn from(err: CredentialsError) -> ListRepositoriesError {
ListRepositoriesError::Credentials(err)
}
}
impl From<HttpDispatchError> for ListRepositoriesError {
fn from(err: HttpDispatchError) -> ListRepositoriesError {
ListRepositoriesError::HttpDispatch(err)
}
}
impl From<io::Error> for ListRepositoriesError {
fn from(err: io::Error) -> ListRepositoriesError {
ListRepositoriesError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ListRepositoriesError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListRepositoriesError {
fn description(&self) -> &str {
match *self {
ListRepositoriesError::InvalidContinuationToken(ref cause) => cause,
ListRepositoriesError::InvalidOrder(ref cause) => cause,
ListRepositoriesError::InvalidSortBy(ref cause) => cause,
ListRepositoriesError::Validation(ref cause) => cause,
ListRepositoriesError::Credentials(ref err) => err.description(),
ListRepositoriesError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
ListRepositoriesError::ParseError(ref cause) => cause,
ListRepositoriesError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum MergePullRequestByFastForwardError {
EncryptionIntegrityChecksFailed(String),
EncryptionKeyAccessDenied(String),
EncryptionKeyDisabled(String),
EncryptionKeyNotFound(String),
EncryptionKeyUnavailable(String),
InvalidCommitId(String),
InvalidPullRequestId(String),
InvalidRepositoryName(String),
ManualMergeRequired(String),
PullRequestAlreadyClosed(String),
PullRequestDoesNotExist(String),
PullRequestIdRequired(String),
ReferenceDoesNotExist(String),
RepositoryDoesNotExist(String),
RepositoryNameRequired(String),
TipOfSourceReferenceIsDifferent(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl MergePullRequestByFastForwardError {
pub fn from_response(res: BufferedHttpResponse) -> MergePullRequestByFastForwardError {
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 {
"EncryptionIntegrityChecksFailedException" => {
return MergePullRequestByFastForwardError::EncryptionIntegrityChecksFailed(
String::from(error_message),
);
}
"EncryptionKeyAccessDeniedException" => {
return MergePullRequestByFastForwardError::EncryptionKeyAccessDenied(
String::from(error_message),
);
}
"EncryptionKeyDisabledException" => {
return MergePullRequestByFastForwardError::EncryptionKeyDisabled(String::from(
error_message,
));
}
"EncryptionKeyNotFoundException" => {
return MergePullRequestByFastForwardError::EncryptionKeyNotFound(String::from(
error_message,
));
}
"EncryptionKeyUnavailableException" => {
return MergePullRequestByFastForwardError::EncryptionKeyUnavailable(
String::from(error_message),
);
}
"InvalidCommitIdException" => {
return MergePullRequestByFastForwardError::InvalidCommitId(String::from(
error_message,
));
}
"InvalidPullRequestIdException" => {
return MergePullRequestByFastForwardError::InvalidPullRequestId(String::from(
error_message,
));
}
"InvalidRepositoryNameException" => {
return MergePullRequestByFastForwardError::InvalidRepositoryName(String::from(
error_message,
));
}
"ManualMergeRequiredException" => {
return MergePullRequestByFastForwardError::ManualMergeRequired(String::from(
error_message,
));
}
"PullRequestAlreadyClosedException" => {
return MergePullRequestByFastForwardError::PullRequestAlreadyClosed(
String::from(error_message),
);
}
"PullRequestDoesNotExistException" => {
return MergePullRequestByFastForwardError::PullRequestDoesNotExist(
String::from(error_message),
);
}
"PullRequestIdRequiredException" => {
return MergePullRequestByFastForwardError::PullRequestIdRequired(String::from(
error_message,
));
}
"ReferenceDoesNotExistException" => {
return MergePullRequestByFastForwardError::ReferenceDoesNotExist(String::from(
error_message,
));
}
"RepositoryDoesNotExistException" => {
return MergePullRequestByFastForwardError::RepositoryDoesNotExist(String::from(
error_message,
));
}
"RepositoryNameRequiredException" => {
return MergePullRequestByFastForwardError::RepositoryNameRequired(String::from(
error_message,
));
}
"TipOfSourceReferenceIsDifferentException" => {
return MergePullRequestByFastForwardError::TipOfSourceReferenceIsDifferent(
String::from(error_message),
);
}
"ValidationException" => {
return MergePullRequestByFastForwardError::Validation(error_message.to_string());
}
_ => {}
}
}
return MergePullRequestByFastForwardError::Unknown(res);
}
}
impl From<serde_json::error::Error> for MergePullRequestByFastForwardError {
fn from(err: serde_json::error::Error) -> MergePullRequestByFastForwardError {
MergePullRequestByFastForwardError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for MergePullRequestByFastForwardError {
fn from(err: CredentialsError) -> MergePullRequestByFastForwardError {
MergePullRequestByFastForwardError::Credentials(err)
}
}
impl From<HttpDispatchError> for MergePullRequestByFastForwardError {
fn from(err: HttpDispatchError) -> MergePullRequestByFastForwardError {
MergePullRequestByFastForwardError::HttpDispatch(err)
}
}
impl From<io::Error> for MergePullRequestByFastForwardError {
fn from(err: io::Error) -> MergePullRequestByFastForwardError {
MergePullRequestByFastForwardError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for MergePullRequestByFastForwardError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for MergePullRequestByFastForwardError {
fn description(&self) -> &str {
match *self {
MergePullRequestByFastForwardError::EncryptionIntegrityChecksFailed(ref cause) => cause,
MergePullRequestByFastForwardError::EncryptionKeyAccessDenied(ref cause) => cause,
MergePullRequestByFastForwardError::EncryptionKeyDisabled(ref cause) => cause,
MergePullRequestByFastForwardError::EncryptionKeyNotFound(ref cause) => cause,
MergePullRequestByFastForwardError::EncryptionKeyUnavailable(ref cause) => cause,
MergePullRequestByFastForwardError::InvalidCommitId(ref cause) => cause,
MergePullRequestByFastForwardError::InvalidPullRequestId(ref cause) => cause,
MergePullRequestByFastForwardError::InvalidRepositoryName(ref cause) => cause,
MergePullRequestByFastForwardError::ManualMergeRequired(ref cause) => cause,
MergePullRequestByFastForwardError::PullRequestAlreadyClosed(ref cause) => cause,
MergePullRequestByFastForwardError::PullRequestDoesNotExist(ref cause) => cause,
MergePullRequestByFastForwardError::PullRequestIdRequired(ref cause) => cause,
MergePullRequestByFastForwardError::ReferenceDoesNotExist(ref cause) => cause,
MergePullRequestByFastForwardError::RepositoryDoesNotExist(ref cause) => cause,
MergePullRequestByFastForwardError::RepositoryNameRequired(ref cause) => cause,
MergePullRequestByFastForwardError::TipOfSourceReferenceIsDifferent(ref cause) => cause,
MergePullRequestByFastForwardError::Validation(ref cause) => cause,
MergePullRequestByFastForwardError::Credentials(ref err) => err.description(),
MergePullRequestByFastForwardError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
MergePullRequestByFastForwardError::ParseError(ref cause) => cause,
MergePullRequestByFastForwardError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum PostCommentForComparedCommitError {
BeforeCommitIdAndAfterCommitIdAreSame(String),
ClientRequestTokenRequired(String),
CommentContentRequired(String),
CommentContentSizeLimitExceeded(String),
CommitDoesNotExist(String),
CommitIdRequired(String),
EncryptionIntegrityChecksFailed(String),
EncryptionKeyAccessDenied(String),
EncryptionKeyDisabled(String),
EncryptionKeyNotFound(String),
EncryptionKeyUnavailable(String),
IdempotencyParameterMismatch(String),
InvalidClientRequestToken(String),
InvalidCommitId(String),
InvalidFileLocation(String),
InvalidFilePosition(String),
InvalidPath(String),
InvalidRelativeFileVersionEnum(String),
InvalidRepositoryName(String),
PathDoesNotExist(String),
PathRequired(String),
RepositoryDoesNotExist(String),
RepositoryNameRequired(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl PostCommentForComparedCommitError {
pub fn from_response(res: BufferedHttpResponse) -> PostCommentForComparedCommitError {
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 {
"BeforeCommitIdAndAfterCommitIdAreSameException" => {
return PostCommentForComparedCommitError::BeforeCommitIdAndAfterCommitIdAreSame(
String::from(error_message),
);
}
"ClientRequestTokenRequiredException" => {
return PostCommentForComparedCommitError::ClientRequestTokenRequired(
String::from(error_message),
);
}
"CommentContentRequiredException" => {
return PostCommentForComparedCommitError::CommentContentRequired(String::from(
error_message,
));
}
"CommentContentSizeLimitExceededException" => {
return PostCommentForComparedCommitError::CommentContentSizeLimitExceeded(
String::from(error_message),
);
}
"CommitDoesNotExistException" => {
return PostCommentForComparedCommitError::CommitDoesNotExist(String::from(
error_message,
));
}
"CommitIdRequiredException" => {
return PostCommentForComparedCommitError::CommitIdRequired(String::from(
error_message,
));
}
"EncryptionIntegrityChecksFailedException" => {
return PostCommentForComparedCommitError::EncryptionIntegrityChecksFailed(
String::from(error_message),
);
}
"EncryptionKeyAccessDeniedException" => {
return PostCommentForComparedCommitError::EncryptionKeyAccessDenied(
String::from(error_message),
);
}
"EncryptionKeyDisabledException" => {
return PostCommentForComparedCommitError::EncryptionKeyDisabled(String::from(
error_message,
));
}
"EncryptionKeyNotFoundException" => {
return PostCommentForComparedCommitError::EncryptionKeyNotFound(String::from(
error_message,
));
}
"EncryptionKeyUnavailableException" => {
return PostCommentForComparedCommitError::EncryptionKeyUnavailable(
String::from(error_message),
);
}
"IdempotencyParameterMismatchException" => {
return PostCommentForComparedCommitError::IdempotencyParameterMismatch(
String::from(error_message),
);
}
"InvalidClientRequestTokenException" => {
return PostCommentForComparedCommitError::InvalidClientRequestToken(
String::from(error_message),
);
}
"InvalidCommitIdException" => {
return PostCommentForComparedCommitError::InvalidCommitId(String::from(
error_message,
));
}
"InvalidFileLocationException" => {
return PostCommentForComparedCommitError::InvalidFileLocation(String::from(
error_message,
));
}
"InvalidFilePositionException" => {
return PostCommentForComparedCommitError::InvalidFilePosition(String::from(
error_message,
));
}
"InvalidPathException" => {
return PostCommentForComparedCommitError::InvalidPath(String::from(
error_message,
));
}
"InvalidRelativeFileVersionEnumException" => {
return PostCommentForComparedCommitError::InvalidRelativeFileVersionEnum(
String::from(error_message),
);
}
"InvalidRepositoryNameException" => {
return PostCommentForComparedCommitError::InvalidRepositoryName(String::from(
error_message,
));
}
"PathDoesNotExistException" => {
return PostCommentForComparedCommitError::PathDoesNotExist(String::from(
error_message,
));
}
"PathRequiredException" => {
return PostCommentForComparedCommitError::PathRequired(String::from(
error_message,
));
}
"RepositoryDoesNotExistException" => {
return PostCommentForComparedCommitError::RepositoryDoesNotExist(String::from(
error_message,
));
}
"RepositoryNameRequiredException" => {
return PostCommentForComparedCommitError::RepositoryNameRequired(String::from(
error_message,
));
}
"ValidationException" => {
return PostCommentForComparedCommitError::Validation(error_message.to_string());
}
_ => {}
}
}
return PostCommentForComparedCommitError::Unknown(res);
}
}
impl From<serde_json::error::Error> for PostCommentForComparedCommitError {
fn from(err: serde_json::error::Error) -> PostCommentForComparedCommitError {
PostCommentForComparedCommitError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for PostCommentForComparedCommitError {
fn from(err: CredentialsError) -> PostCommentForComparedCommitError {
PostCommentForComparedCommitError::Credentials(err)
}
}
impl From<HttpDispatchError> for PostCommentForComparedCommitError {
fn from(err: HttpDispatchError) -> PostCommentForComparedCommitError {
PostCommentForComparedCommitError::HttpDispatch(err)
}
}
impl From<io::Error> for PostCommentForComparedCommitError {
fn from(err: io::Error) -> PostCommentForComparedCommitError {
PostCommentForComparedCommitError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for PostCommentForComparedCommitError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for PostCommentForComparedCommitError {
fn description(&self) -> &str {
match *self {
PostCommentForComparedCommitError::BeforeCommitIdAndAfterCommitIdAreSame(ref cause) => {
cause
}
PostCommentForComparedCommitError::ClientRequestTokenRequired(ref cause) => cause,
PostCommentForComparedCommitError::CommentContentRequired(ref cause) => cause,
PostCommentForComparedCommitError::CommentContentSizeLimitExceeded(ref cause) => cause,
PostCommentForComparedCommitError::CommitDoesNotExist(ref cause) => cause,
PostCommentForComparedCommitError::CommitIdRequired(ref cause) => cause,
PostCommentForComparedCommitError::EncryptionIntegrityChecksFailed(ref cause) => cause,
PostCommentForComparedCommitError::EncryptionKeyAccessDenied(ref cause) => cause,
PostCommentForComparedCommitError::EncryptionKeyDisabled(ref cause) => cause,
PostCommentForComparedCommitError::EncryptionKeyNotFound(ref cause) => cause,
PostCommentForComparedCommitError::EncryptionKeyUnavailable(ref cause) => cause,
PostCommentForComparedCommitError::IdempotencyParameterMismatch(ref cause) => cause,
PostCommentForComparedCommitError::InvalidClientRequestToken(ref cause) => cause,
PostCommentForComparedCommitError::InvalidCommitId(ref cause) => cause,
PostCommentForComparedCommitError::InvalidFileLocation(ref cause) => cause,
PostCommentForComparedCommitError::InvalidFilePosition(ref cause) => cause,
PostCommentForComparedCommitError::InvalidPath(ref cause) => cause,
PostCommentForComparedCommitError::InvalidRelativeFileVersionEnum(ref cause) => cause,
PostCommentForComparedCommitError::InvalidRepositoryName(ref cause) => cause,
PostCommentForComparedCommitError::PathDoesNotExist(ref cause) => cause,
PostCommentForComparedCommitError::PathRequired(ref cause) => cause,
PostCommentForComparedCommitError::RepositoryDoesNotExist(ref cause) => cause,
PostCommentForComparedCommitError::RepositoryNameRequired(ref cause) => cause,
PostCommentForComparedCommitError::Validation(ref cause) => cause,
PostCommentForComparedCommitError::Credentials(ref err) => err.description(),
PostCommentForComparedCommitError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
PostCommentForComparedCommitError::ParseError(ref cause) => cause,
PostCommentForComparedCommitError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum PostCommentForPullRequestError {
BeforeCommitIdAndAfterCommitIdAreSame(String),
ClientRequestTokenRequired(String),
CommentContentRequired(String),
CommentContentSizeLimitExceeded(String),
CommitDoesNotExist(String),
CommitIdRequired(String),
EncryptionIntegrityChecksFailed(String),
EncryptionKeyAccessDenied(String),
EncryptionKeyDisabled(String),
EncryptionKeyNotFound(String),
EncryptionKeyUnavailable(String),
IdempotencyParameterMismatch(String),
InvalidClientRequestToken(String),
InvalidCommitId(String),
InvalidFileLocation(String),
InvalidFilePosition(String),
InvalidPath(String),
InvalidPullRequestId(String),
InvalidRelativeFileVersionEnum(String),
InvalidRepositoryName(String),
PathDoesNotExist(String),
PathRequired(String),
PullRequestDoesNotExist(String),
PullRequestIdRequired(String),
RepositoryDoesNotExist(String),
RepositoryNameRequired(String),
RepositoryNotAssociatedWithPullRequest(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl PostCommentForPullRequestError {
pub fn from_response(res: BufferedHttpResponse) -> PostCommentForPullRequestError {
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 {
"BeforeCommitIdAndAfterCommitIdAreSameException" => {
return PostCommentForPullRequestError::BeforeCommitIdAndAfterCommitIdAreSame(
String::from(error_message),
);
}
"ClientRequestTokenRequiredException" => {
return PostCommentForPullRequestError::ClientRequestTokenRequired(String::from(
error_message,
));
}
"CommentContentRequiredException" => {
return PostCommentForPullRequestError::CommentContentRequired(String::from(
error_message,
));
}
"CommentContentSizeLimitExceededException" => {
return PostCommentForPullRequestError::CommentContentSizeLimitExceeded(
String::from(error_message),
);
}
"CommitDoesNotExistException" => {
return PostCommentForPullRequestError::CommitDoesNotExist(String::from(
error_message,
));
}
"CommitIdRequiredException" => {
return PostCommentForPullRequestError::CommitIdRequired(String::from(
error_message,
));
}
"EncryptionIntegrityChecksFailedException" => {
return PostCommentForPullRequestError::EncryptionIntegrityChecksFailed(
String::from(error_message),
);
}
"EncryptionKeyAccessDeniedException" => {
return PostCommentForPullRequestError::EncryptionKeyAccessDenied(String::from(
error_message,
));
}
"EncryptionKeyDisabledException" => {
return PostCommentForPullRequestError::EncryptionKeyDisabled(String::from(
error_message,
));
}
"EncryptionKeyNotFoundException" => {
return PostCommentForPullRequestError::EncryptionKeyNotFound(String::from(
error_message,
));
}
"EncryptionKeyUnavailableException" => {
return PostCommentForPullRequestError::EncryptionKeyUnavailable(String::from(
error_message,
));
}
"IdempotencyParameterMismatchException" => {
return PostCommentForPullRequestError::IdempotencyParameterMismatch(
String::from(error_message),
);
}
"InvalidClientRequestTokenException" => {
return PostCommentForPullRequestError::InvalidClientRequestToken(String::from(
error_message,
));
}
"InvalidCommitIdException" => {
return PostCommentForPullRequestError::InvalidCommitId(String::from(
error_message,
));
}
"InvalidFileLocationException" => {
return PostCommentForPullRequestError::InvalidFileLocation(String::from(
error_message,
));
}
"InvalidFilePositionException" => {
return PostCommentForPullRequestError::InvalidFilePosition(String::from(
error_message,
));
}
"InvalidPathException" => {
return PostCommentForPullRequestError::InvalidPath(String::from(error_message));
}
"InvalidPullRequestIdException" => {
return PostCommentForPullRequestError::InvalidPullRequestId(String::from(
error_message,
));
}
"InvalidRelativeFileVersionEnumException" => {
return PostCommentForPullRequestError::InvalidRelativeFileVersionEnum(
String::from(error_message),
);
}
"InvalidRepositoryNameException" => {
return PostCommentForPullRequestError::InvalidRepositoryName(String::from(
error_message,
));
}
"PathDoesNotExistException" => {
return PostCommentForPullRequestError::PathDoesNotExist(String::from(
error_message,
));
}
"PathRequiredException" => {
return PostCommentForPullRequestError::PathRequired(String::from(error_message));
}
"PullRequestDoesNotExistException" => {
return PostCommentForPullRequestError::PullRequestDoesNotExist(String::from(
error_message,
));
}
"PullRequestIdRequiredException" => {
return PostCommentForPullRequestError::PullRequestIdRequired(String::from(
error_message,
));
}
"RepositoryDoesNotExistException" => {
return PostCommentForPullRequestError::RepositoryDoesNotExist(String::from(
error_message,
));
}
"RepositoryNameRequiredException" => {
return PostCommentForPullRequestError::RepositoryNameRequired(String::from(
error_message,
));
}
"RepositoryNotAssociatedWithPullRequestException" => {
return PostCommentForPullRequestError::RepositoryNotAssociatedWithPullRequest(
String::from(error_message),
);
}
"ValidationException" => {
return PostCommentForPullRequestError::Validation(error_message.to_string());
}
_ => {}
}
}
return PostCommentForPullRequestError::Unknown(res);
}
}
impl From<serde_json::error::Error> for PostCommentForPullRequestError {
fn from(err: serde_json::error::Error) -> PostCommentForPullRequestError {
PostCommentForPullRequestError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for PostCommentForPullRequestError {
fn from(err: CredentialsError) -> PostCommentForPullRequestError {
PostCommentForPullRequestError::Credentials(err)
}
}
impl From<HttpDispatchError> for PostCommentForPullRequestError {
fn from(err: HttpDispatchError) -> PostCommentForPullRequestError {
PostCommentForPullRequestError::HttpDispatch(err)
}
}
impl From<io::Error> for PostCommentForPullRequestError {
fn from(err: io::Error) -> PostCommentForPullRequestError {
PostCommentForPullRequestError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for PostCommentForPullRequestError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for PostCommentForPullRequestError {
fn description(&self) -> &str {
match *self {
PostCommentForPullRequestError::BeforeCommitIdAndAfterCommitIdAreSame(ref cause) => {
cause
}
PostCommentForPullRequestError::ClientRequestTokenRequired(ref cause) => cause,
PostCommentForPullRequestError::CommentContentRequired(ref cause) => cause,
PostCommentForPullRequestError::CommentContentSizeLimitExceeded(ref cause) => cause,
PostCommentForPullRequestError::CommitDoesNotExist(ref cause) => cause,
PostCommentForPullRequestError::CommitIdRequired(ref cause) => cause,
PostCommentForPullRequestError::EncryptionIntegrityChecksFailed(ref cause) => cause,
PostCommentForPullRequestError::EncryptionKeyAccessDenied(ref cause) => cause,
PostCommentForPullRequestError::EncryptionKeyDisabled(ref cause) => cause,
PostCommentForPullRequestError::EncryptionKeyNotFound(ref cause) => cause,
PostCommentForPullRequestError::EncryptionKeyUnavailable(ref cause) => cause,
PostCommentForPullRequestError::IdempotencyParameterMismatch(ref cause) => cause,
PostCommentForPullRequestError::InvalidClientRequestToken(ref cause) => cause,
PostCommentForPullRequestError::InvalidCommitId(ref cause) => cause,
PostCommentForPullRequestError::InvalidFileLocation(ref cause) => cause,
PostCommentForPullRequestError::InvalidFilePosition(ref cause) => cause,
PostCommentForPullRequestError::InvalidPath(ref cause) => cause,
PostCommentForPullRequestError::InvalidPullRequestId(ref cause) => cause,
PostCommentForPullRequestError::InvalidRelativeFileVersionEnum(ref cause) => cause,
PostCommentForPullRequestError::InvalidRepositoryName(ref cause) => cause,
PostCommentForPullRequestError::PathDoesNotExist(ref cause) => cause,
PostCommentForPullRequestError::PathRequired(ref cause) => cause,
PostCommentForPullRequestError::PullRequestDoesNotExist(ref cause) => cause,
PostCommentForPullRequestError::PullRequestIdRequired(ref cause) => cause,
PostCommentForPullRequestError::RepositoryDoesNotExist(ref cause) => cause,
PostCommentForPullRequestError::RepositoryNameRequired(ref cause) => cause,
PostCommentForPullRequestError::RepositoryNotAssociatedWithPullRequest(ref cause) => {
cause
}
PostCommentForPullRequestError::Validation(ref cause) => cause,
PostCommentForPullRequestError::Credentials(ref err) => err.description(),
PostCommentForPullRequestError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
PostCommentForPullRequestError::ParseError(ref cause) => cause,
PostCommentForPullRequestError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum PostCommentReplyError {
ClientRequestTokenRequired(String),
CommentContentRequired(String),
CommentContentSizeLimitExceeded(String),
CommentDoesNotExist(String),
CommentIdRequired(String),
IdempotencyParameterMismatch(String),
InvalidClientRequestToken(String),
InvalidCommentId(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl PostCommentReplyError {
pub fn from_response(res: BufferedHttpResponse) -> PostCommentReplyError {
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 {
"ClientRequestTokenRequiredException" => {
return PostCommentReplyError::ClientRequestTokenRequired(String::from(
error_message,
));
}
"CommentContentRequiredException" => {
return PostCommentReplyError::CommentContentRequired(String::from(
error_message,
));
}
"CommentContentSizeLimitExceededException" => {
return PostCommentReplyError::CommentContentSizeLimitExceeded(String::from(
error_message,
));
}
"CommentDoesNotExistException" => {
return PostCommentReplyError::CommentDoesNotExist(String::from(error_message));
}
"CommentIdRequiredException" => {
return PostCommentReplyError::CommentIdRequired(String::from(error_message));
}
"IdempotencyParameterMismatchException" => {
return PostCommentReplyError::IdempotencyParameterMismatch(String::from(
error_message,
));
}
"InvalidClientRequestTokenException" => {
return PostCommentReplyError::InvalidClientRequestToken(String::from(
error_message,
));
}
"InvalidCommentIdException" => {
return PostCommentReplyError::InvalidCommentId(String::from(error_message));
}
"ValidationException" => {
return PostCommentReplyError::Validation(error_message.to_string());
}
_ => {}
}
}
return PostCommentReplyError::Unknown(res);
}
}
impl From<serde_json::error::Error> for PostCommentReplyError {
fn from(err: serde_json::error::Error) -> PostCommentReplyError {
PostCommentReplyError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for PostCommentReplyError {
fn from(err: CredentialsError) -> PostCommentReplyError {
PostCommentReplyError::Credentials(err)
}
}
impl From<HttpDispatchError> for PostCommentReplyError {
fn from(err: HttpDispatchError) -> PostCommentReplyError {
PostCommentReplyError::HttpDispatch(err)
}
}
impl From<io::Error> for PostCommentReplyError {
fn from(err: io::Error) -> PostCommentReplyError {
PostCommentReplyError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for PostCommentReplyError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for PostCommentReplyError {
fn description(&self) -> &str {
match *self {
PostCommentReplyError::ClientRequestTokenRequired(ref cause) => cause,
PostCommentReplyError::CommentContentRequired(ref cause) => cause,
PostCommentReplyError::CommentContentSizeLimitExceeded(ref cause) => cause,
PostCommentReplyError::CommentDoesNotExist(ref cause) => cause,
PostCommentReplyError::CommentIdRequired(ref cause) => cause,
PostCommentReplyError::IdempotencyParameterMismatch(ref cause) => cause,
PostCommentReplyError::InvalidClientRequestToken(ref cause) => cause,
PostCommentReplyError::InvalidCommentId(ref cause) => cause,
PostCommentReplyError::Validation(ref cause) => cause,
PostCommentReplyError::Credentials(ref err) => err.description(),
PostCommentReplyError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
PostCommentReplyError::ParseError(ref cause) => cause,
PostCommentReplyError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum PutFileError {
BranchDoesNotExist(String),
BranchNameIsTagName(String),
BranchNameRequired(String),
CommitMessageLengthExceeded(String),
DirectoryNameConflictsWithFileName(String),
EncryptionIntegrityChecksFailed(String),
EncryptionKeyAccessDenied(String),
EncryptionKeyDisabled(String),
EncryptionKeyNotFound(String),
EncryptionKeyUnavailable(String),
FileContentRequired(String),
FileContentSizeLimitExceeded(String),
FileNameConflictsWithDirectoryName(String),
FilePathConflictsWithSubmodulePath(String),
FolderContentSizeLimitExceeded(String),
InvalidBranchName(String),
InvalidDeletionParameter(String),
InvalidEmail(String),
InvalidFileMode(String),
InvalidParentCommitId(String),
InvalidPath(String),
InvalidRepositoryName(String),
NameLengthExceeded(String),
ParentCommitDoesNotExist(String),
ParentCommitIdOutdated(String),
ParentCommitIdRequired(String),
PathRequired(String),
RepositoryDoesNotExist(String),
RepositoryNameRequired(String),
SameFileContent(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl PutFileError {
pub fn from_response(res: BufferedHttpResponse) -> PutFileError {
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 {
"BranchDoesNotExistException" => {
return PutFileError::BranchDoesNotExist(String::from(error_message));
}
"BranchNameIsTagNameException" => {
return PutFileError::BranchNameIsTagName(String::from(error_message));
}
"BranchNameRequiredException" => {
return PutFileError::BranchNameRequired(String::from(error_message));
}
"CommitMessageLengthExceededException" => {
return PutFileError::CommitMessageLengthExceeded(String::from(error_message));
}
"DirectoryNameConflictsWithFileNameException" => {
return PutFileError::DirectoryNameConflictsWithFileName(String::from(
error_message,
));
}
"EncryptionIntegrityChecksFailedException" => {
return PutFileError::EncryptionIntegrityChecksFailed(String::from(
error_message,
));
}
"EncryptionKeyAccessDeniedException" => {
return PutFileError::EncryptionKeyAccessDenied(String::from(error_message));
}
"EncryptionKeyDisabledException" => {
return PutFileError::EncryptionKeyDisabled(String::from(error_message));
}
"EncryptionKeyNotFoundException" => {
return PutFileError::EncryptionKeyNotFound(String::from(error_message));
}
"EncryptionKeyUnavailableException" => {
return PutFileError::EncryptionKeyUnavailable(String::from(error_message));
}
"FileContentRequiredException" => {
return PutFileError::FileContentRequired(String::from(error_message));
}
"FileContentSizeLimitExceededException" => {
return PutFileError::FileContentSizeLimitExceeded(String::from(error_message));
}
"FileNameConflictsWithDirectoryNameException" => {
return PutFileError::FileNameConflictsWithDirectoryName(String::from(
error_message,
));
}
"FilePathConflictsWithSubmodulePathException" => {
return PutFileError::FilePathConflictsWithSubmodulePath(String::from(
error_message,
));
}
"FolderContentSizeLimitExceededException" => {
return PutFileError::FolderContentSizeLimitExceeded(String::from(error_message));
}
"InvalidBranchNameException" => {
return PutFileError::InvalidBranchName(String::from(error_message));
}
"InvalidDeletionParameterException" => {
return PutFileError::InvalidDeletionParameter(String::from(error_message));
}
"InvalidEmailException" => {
return PutFileError::InvalidEmail(String::from(error_message));
}
"InvalidFileModeException" => {
return PutFileError::InvalidFileMode(String::from(error_message));
}
"InvalidParentCommitIdException" => {
return PutFileError::InvalidParentCommitId(String::from(error_message));
}
"InvalidPathException" => {
return PutFileError::InvalidPath(String::from(error_message));
}
"InvalidRepositoryNameException" => {
return PutFileError::InvalidRepositoryName(String::from(error_message));
}
"NameLengthExceededException" => {
return PutFileError::NameLengthExceeded(String::from(error_message));
}
"ParentCommitDoesNotExistException" => {
return PutFileError::ParentCommitDoesNotExist(String::from(error_message));
}
"ParentCommitIdOutdatedException" => {
return PutFileError::ParentCommitIdOutdated(String::from(error_message));
}
"ParentCommitIdRequiredException" => {
return PutFileError::ParentCommitIdRequired(String::from(error_message));
}
"PathRequiredException" => {
return PutFileError::PathRequired(String::from(error_message));
}
"RepositoryDoesNotExistException" => {
return PutFileError::RepositoryDoesNotExist(String::from(error_message));
}
"RepositoryNameRequiredException" => {
return PutFileError::RepositoryNameRequired(String::from(error_message));
}
"SameFileContentException" => {
return PutFileError::SameFileContent(String::from(error_message));
}
"ValidationException" => return PutFileError::Validation(error_message.to_string()),
_ => {}
}
}
return PutFileError::Unknown(res);
}
}
impl From<serde_json::error::Error> for PutFileError {
fn from(err: serde_json::error::Error) -> PutFileError {
PutFileError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for PutFileError {
fn from(err: CredentialsError) -> PutFileError {
PutFileError::Credentials(err)
}
}
impl From<HttpDispatchError> for PutFileError {
fn from(err: HttpDispatchError) -> PutFileError {
PutFileError::HttpDispatch(err)
}
}
impl From<io::Error> for PutFileError {
fn from(err: io::Error) -> PutFileError {
PutFileError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for PutFileError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for PutFileError {
fn description(&self) -> &str {
match *self {
PutFileError::BranchDoesNotExist(ref cause) => cause,
PutFileError::BranchNameIsTagName(ref cause) => cause,
PutFileError::BranchNameRequired(ref cause) => cause,
PutFileError::CommitMessageLengthExceeded(ref cause) => cause,
PutFileError::DirectoryNameConflictsWithFileName(ref cause) => cause,
PutFileError::EncryptionIntegrityChecksFailed(ref cause) => cause,
PutFileError::EncryptionKeyAccessDenied(ref cause) => cause,
PutFileError::EncryptionKeyDisabled(ref cause) => cause,
PutFileError::EncryptionKeyNotFound(ref cause) => cause,
PutFileError::EncryptionKeyUnavailable(ref cause) => cause,
PutFileError::FileContentRequired(ref cause) => cause,
PutFileError::FileContentSizeLimitExceeded(ref cause) => cause,
PutFileError::FileNameConflictsWithDirectoryName(ref cause) => cause,
PutFileError::FilePathConflictsWithSubmodulePath(ref cause) => cause,
PutFileError::FolderContentSizeLimitExceeded(ref cause) => cause,
PutFileError::InvalidBranchName(ref cause) => cause,
PutFileError::InvalidDeletionParameter(ref cause) => cause,
PutFileError::InvalidEmail(ref cause) => cause,
PutFileError::InvalidFileMode(ref cause) => cause,
PutFileError::InvalidParentCommitId(ref cause) => cause,
PutFileError::InvalidPath(ref cause) => cause,
PutFileError::InvalidRepositoryName(ref cause) => cause,
PutFileError::NameLengthExceeded(ref cause) => cause,
PutFileError::ParentCommitDoesNotExist(ref cause) => cause,
PutFileError::ParentCommitIdOutdated(ref cause) => cause,
PutFileError::ParentCommitIdRequired(ref cause) => cause,
PutFileError::PathRequired(ref cause) => cause,
PutFileError::RepositoryDoesNotExist(ref cause) => cause,
PutFileError::RepositoryNameRequired(ref cause) => cause,
PutFileError::SameFileContent(ref cause) => cause,
PutFileError::Validation(ref cause) => cause,
PutFileError::Credentials(ref err) => err.description(),
PutFileError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
PutFileError::ParseError(ref cause) => cause,
PutFileError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum PutRepositoryTriggersError {
EncryptionIntegrityChecksFailed(String),
EncryptionKeyAccessDenied(String),
EncryptionKeyDisabled(String),
EncryptionKeyNotFound(String),
EncryptionKeyUnavailable(String),
InvalidRepositoryName(String),
InvalidRepositoryTriggerBranchName(String),
InvalidRepositoryTriggerCustomData(String),
InvalidRepositoryTriggerDestinationArn(String),
InvalidRepositoryTriggerEvents(String),
InvalidRepositoryTriggerName(String),
InvalidRepositoryTriggerRegion(String),
MaximumBranchesExceeded(String),
MaximumRepositoryTriggersExceeded(String),
RepositoryDoesNotExist(String),
RepositoryNameRequired(String),
RepositoryTriggerBranchNameListRequired(String),
RepositoryTriggerDestinationArnRequired(String),
RepositoryTriggerEventsListRequired(String),
RepositoryTriggerNameRequired(String),
RepositoryTriggersListRequired(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl PutRepositoryTriggersError {
pub fn from_response(res: BufferedHttpResponse) -> PutRepositoryTriggersError {
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 {
"EncryptionIntegrityChecksFailedException" => {
return PutRepositoryTriggersError::EncryptionIntegrityChecksFailed(
String::from(error_message),
);
}
"EncryptionKeyAccessDeniedException" => {
return PutRepositoryTriggersError::EncryptionKeyAccessDenied(String::from(
error_message,
));
}
"EncryptionKeyDisabledException" => {
return PutRepositoryTriggersError::EncryptionKeyDisabled(String::from(
error_message,
));
}
"EncryptionKeyNotFoundException" => {
return PutRepositoryTriggersError::EncryptionKeyNotFound(String::from(
error_message,
));
}
"EncryptionKeyUnavailableException" => {
return PutRepositoryTriggersError::EncryptionKeyUnavailable(String::from(
error_message,
));
}
"InvalidRepositoryNameException" => {
return PutRepositoryTriggersError::InvalidRepositoryName(String::from(
error_message,
));
}
"InvalidRepositoryTriggerBranchNameException" => {
return PutRepositoryTriggersError::InvalidRepositoryTriggerBranchName(
String::from(error_message),
);
}
"InvalidRepositoryTriggerCustomDataException" => {
return PutRepositoryTriggersError::InvalidRepositoryTriggerCustomData(
String::from(error_message),
);
}
"InvalidRepositoryTriggerDestinationArnException" => {
return PutRepositoryTriggersError::InvalidRepositoryTriggerDestinationArn(
String::from(error_message),
);
}
"InvalidRepositoryTriggerEventsException" => {
return PutRepositoryTriggersError::InvalidRepositoryTriggerEvents(String::from(
error_message,
));
}
"InvalidRepositoryTriggerNameException" => {
return PutRepositoryTriggersError::InvalidRepositoryTriggerName(String::from(
error_message,
));
}
"InvalidRepositoryTriggerRegionException" => {
return PutRepositoryTriggersError::InvalidRepositoryTriggerRegion(String::from(
error_message,
));
}
"MaximumBranchesExceededException" => {
return PutRepositoryTriggersError::MaximumBranchesExceeded(String::from(
error_message,
));
}
"MaximumRepositoryTriggersExceededException" => {
return PutRepositoryTriggersError::MaximumRepositoryTriggersExceeded(
String::from(error_message),
);
}
"RepositoryDoesNotExistException" => {
return PutRepositoryTriggersError::RepositoryDoesNotExist(String::from(
error_message,
));
}
"RepositoryNameRequiredException" => {
return PutRepositoryTriggersError::RepositoryNameRequired(String::from(
error_message,
));
}
"RepositoryTriggerBranchNameListRequiredException" => {
return PutRepositoryTriggersError::RepositoryTriggerBranchNameListRequired(
String::from(error_message),
);
}
"RepositoryTriggerDestinationArnRequiredException" => {
return PutRepositoryTriggersError::RepositoryTriggerDestinationArnRequired(
String::from(error_message),
);
}
"RepositoryTriggerEventsListRequiredException" => {
return PutRepositoryTriggersError::RepositoryTriggerEventsListRequired(
String::from(error_message),
);
}
"RepositoryTriggerNameRequiredException" => {
return PutRepositoryTriggersError::RepositoryTriggerNameRequired(String::from(
error_message,
));
}
"RepositoryTriggersListRequiredException" => {
return PutRepositoryTriggersError::RepositoryTriggersListRequired(String::from(
error_message,
));
}
"ValidationException" => {
return PutRepositoryTriggersError::Validation(error_message.to_string());
}
_ => {}
}
}
return PutRepositoryTriggersError::Unknown(res);
}
}
impl From<serde_json::error::Error> for PutRepositoryTriggersError {
fn from(err: serde_json::error::Error) -> PutRepositoryTriggersError {
PutRepositoryTriggersError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for PutRepositoryTriggersError {
fn from(err: CredentialsError) -> PutRepositoryTriggersError {
PutRepositoryTriggersError::Credentials(err)
}
}
impl From<HttpDispatchError> for PutRepositoryTriggersError {
fn from(err: HttpDispatchError) -> PutRepositoryTriggersError {
PutRepositoryTriggersError::HttpDispatch(err)
}
}
impl From<io::Error> for PutRepositoryTriggersError {
fn from(err: io::Error) -> PutRepositoryTriggersError {
PutRepositoryTriggersError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for PutRepositoryTriggersError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for PutRepositoryTriggersError {
fn description(&self) -> &str {
match *self {
PutRepositoryTriggersError::EncryptionIntegrityChecksFailed(ref cause) => cause,
PutRepositoryTriggersError::EncryptionKeyAccessDenied(ref cause) => cause,
PutRepositoryTriggersError::EncryptionKeyDisabled(ref cause) => cause,
PutRepositoryTriggersError::EncryptionKeyNotFound(ref cause) => cause,
PutRepositoryTriggersError::EncryptionKeyUnavailable(ref cause) => cause,
PutRepositoryTriggersError::InvalidRepositoryName(ref cause) => cause,
PutRepositoryTriggersError::InvalidRepositoryTriggerBranchName(ref cause) => cause,
PutRepositoryTriggersError::InvalidRepositoryTriggerCustomData(ref cause) => cause,
PutRepositoryTriggersError::InvalidRepositoryTriggerDestinationArn(ref cause) => cause,
PutRepositoryTriggersError::InvalidRepositoryTriggerEvents(ref cause) => cause,
PutRepositoryTriggersError::InvalidRepositoryTriggerName(ref cause) => cause,
PutRepositoryTriggersError::InvalidRepositoryTriggerRegion(ref cause) => cause,
PutRepositoryTriggersError::MaximumBranchesExceeded(ref cause) => cause,
PutRepositoryTriggersError::MaximumRepositoryTriggersExceeded(ref cause) => cause,
PutRepositoryTriggersError::RepositoryDoesNotExist(ref cause) => cause,
PutRepositoryTriggersError::RepositoryNameRequired(ref cause) => cause,
PutRepositoryTriggersError::RepositoryTriggerBranchNameListRequired(ref cause) => cause,
PutRepositoryTriggersError::RepositoryTriggerDestinationArnRequired(ref cause) => cause,
PutRepositoryTriggersError::RepositoryTriggerEventsListRequired(ref cause) => cause,
PutRepositoryTriggersError::RepositoryTriggerNameRequired(ref cause) => cause,
PutRepositoryTriggersError::RepositoryTriggersListRequired(ref cause) => cause,
PutRepositoryTriggersError::Validation(ref cause) => cause,
PutRepositoryTriggersError::Credentials(ref err) => err.description(),
PutRepositoryTriggersError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
PutRepositoryTriggersError::ParseError(ref cause) => cause,
PutRepositoryTriggersError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum TestRepositoryTriggersError {
EncryptionIntegrityChecksFailed(String),
EncryptionKeyAccessDenied(String),
EncryptionKeyDisabled(String),
EncryptionKeyNotFound(String),
EncryptionKeyUnavailable(String),
InvalidRepositoryName(String),
InvalidRepositoryTriggerBranchName(String),
InvalidRepositoryTriggerCustomData(String),
InvalidRepositoryTriggerDestinationArn(String),
InvalidRepositoryTriggerEvents(String),
InvalidRepositoryTriggerName(String),
InvalidRepositoryTriggerRegion(String),
MaximumBranchesExceeded(String),
MaximumRepositoryTriggersExceeded(String),
RepositoryDoesNotExist(String),
RepositoryNameRequired(String),
RepositoryTriggerBranchNameListRequired(String),
RepositoryTriggerDestinationArnRequired(String),
RepositoryTriggerEventsListRequired(String),
RepositoryTriggerNameRequired(String),
RepositoryTriggersListRequired(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl TestRepositoryTriggersError {
pub fn from_response(res: BufferedHttpResponse) -> TestRepositoryTriggersError {
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 {
"EncryptionIntegrityChecksFailedException" => {
return TestRepositoryTriggersError::EncryptionIntegrityChecksFailed(
String::from(error_message),
);
}
"EncryptionKeyAccessDeniedException" => {
return TestRepositoryTriggersError::EncryptionKeyAccessDenied(String::from(
error_message,
));
}
"EncryptionKeyDisabledException" => {
return TestRepositoryTriggersError::EncryptionKeyDisabled(String::from(
error_message,
));
}
"EncryptionKeyNotFoundException" => {
return TestRepositoryTriggersError::EncryptionKeyNotFound(String::from(
error_message,
));
}
"EncryptionKeyUnavailableException" => {
return TestRepositoryTriggersError::EncryptionKeyUnavailable(String::from(
error_message,
));
}
"InvalidRepositoryNameException" => {
return TestRepositoryTriggersError::InvalidRepositoryName(String::from(
error_message,
));
}
"InvalidRepositoryTriggerBranchNameException" => {
return TestRepositoryTriggersError::InvalidRepositoryTriggerBranchName(
String::from(error_message),
);
}
"InvalidRepositoryTriggerCustomDataException" => {
return TestRepositoryTriggersError::InvalidRepositoryTriggerCustomData(
String::from(error_message),
);
}
"InvalidRepositoryTriggerDestinationArnException" => {
return TestRepositoryTriggersError::InvalidRepositoryTriggerDestinationArn(
String::from(error_message),
);
}
"InvalidRepositoryTriggerEventsException" => {
return TestRepositoryTriggersError::InvalidRepositoryTriggerEvents(
String::from(error_message),
);
}
"InvalidRepositoryTriggerNameException" => {
return TestRepositoryTriggersError::InvalidRepositoryTriggerName(String::from(
error_message,
));
}
"InvalidRepositoryTriggerRegionException" => {
return TestRepositoryTriggersError::InvalidRepositoryTriggerRegion(
String::from(error_message),
);
}
"MaximumBranchesExceededException" => {
return TestRepositoryTriggersError::MaximumBranchesExceeded(String::from(
error_message,
));
}
"MaximumRepositoryTriggersExceededException" => {
return TestRepositoryTriggersError::MaximumRepositoryTriggersExceeded(
String::from(error_message),
);
}
"RepositoryDoesNotExistException" => {
return TestRepositoryTriggersError::RepositoryDoesNotExist(String::from(
error_message,
));
}
"RepositoryNameRequiredException" => {
return TestRepositoryTriggersError::RepositoryNameRequired(String::from(
error_message,
));
}
"RepositoryTriggerBranchNameListRequiredException" => {
return TestRepositoryTriggersError::RepositoryTriggerBranchNameListRequired(
String::from(error_message),
);
}
"RepositoryTriggerDestinationArnRequiredException" => {
return TestRepositoryTriggersError::RepositoryTriggerDestinationArnRequired(
String::from(error_message),
);
}
"RepositoryTriggerEventsListRequiredException" => {
return TestRepositoryTriggersError::RepositoryTriggerEventsListRequired(
String::from(error_message),
);
}
"RepositoryTriggerNameRequiredException" => {
return TestRepositoryTriggersError::RepositoryTriggerNameRequired(String::from(
error_message,
));
}
"RepositoryTriggersListRequiredException" => {
return TestRepositoryTriggersError::RepositoryTriggersListRequired(
String::from(error_message),
);
}
"ValidationException" => {
return TestRepositoryTriggersError::Validation(error_message.to_string());
}
_ => {}
}
}
return TestRepositoryTriggersError::Unknown(res);
}
}
impl From<serde_json::error::Error> for TestRepositoryTriggersError {
fn from(err: serde_json::error::Error) -> TestRepositoryTriggersError {
TestRepositoryTriggersError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for TestRepositoryTriggersError {
fn from(err: CredentialsError) -> TestRepositoryTriggersError {
TestRepositoryTriggersError::Credentials(err)
}
}
impl From<HttpDispatchError> for TestRepositoryTriggersError {
fn from(err: HttpDispatchError) -> TestRepositoryTriggersError {
TestRepositoryTriggersError::HttpDispatch(err)
}
}
impl From<io::Error> for TestRepositoryTriggersError {
fn from(err: io::Error) -> TestRepositoryTriggersError {
TestRepositoryTriggersError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for TestRepositoryTriggersError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for TestRepositoryTriggersError {
fn description(&self) -> &str {
match *self {
TestRepositoryTriggersError::EncryptionIntegrityChecksFailed(ref cause) => cause,
TestRepositoryTriggersError::EncryptionKeyAccessDenied(ref cause) => cause,
TestRepositoryTriggersError::EncryptionKeyDisabled(ref cause) => cause,
TestRepositoryTriggersError::EncryptionKeyNotFound(ref cause) => cause,
TestRepositoryTriggersError::EncryptionKeyUnavailable(ref cause) => cause,
TestRepositoryTriggersError::InvalidRepositoryName(ref cause) => cause,
TestRepositoryTriggersError::InvalidRepositoryTriggerBranchName(ref cause) => cause,
TestRepositoryTriggersError::InvalidRepositoryTriggerCustomData(ref cause) => cause,
TestRepositoryTriggersError::InvalidRepositoryTriggerDestinationArn(ref cause) => cause,
TestRepositoryTriggersError::InvalidRepositoryTriggerEvents(ref cause) => cause,
TestRepositoryTriggersError::InvalidRepositoryTriggerName(ref cause) => cause,
TestRepositoryTriggersError::InvalidRepositoryTriggerRegion(ref cause) => cause,
TestRepositoryTriggersError::MaximumBranchesExceeded(ref cause) => cause,
TestRepositoryTriggersError::MaximumRepositoryTriggersExceeded(ref cause) => cause,
TestRepositoryTriggersError::RepositoryDoesNotExist(ref cause) => cause,
TestRepositoryTriggersError::RepositoryNameRequired(ref cause) => cause,
TestRepositoryTriggersError::RepositoryTriggerBranchNameListRequired(ref cause) => {
cause
}
TestRepositoryTriggersError::RepositoryTriggerDestinationArnRequired(ref cause) => {
cause
}
TestRepositoryTriggersError::RepositoryTriggerEventsListRequired(ref cause) => cause,
TestRepositoryTriggersError::RepositoryTriggerNameRequired(ref cause) => cause,
TestRepositoryTriggersError::RepositoryTriggersListRequired(ref cause) => cause,
TestRepositoryTriggersError::Validation(ref cause) => cause,
TestRepositoryTriggersError::Credentials(ref err) => err.description(),
TestRepositoryTriggersError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
TestRepositoryTriggersError::ParseError(ref cause) => cause,
TestRepositoryTriggersError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum UpdateCommentError {
CommentContentRequired(String),
CommentContentSizeLimitExceeded(String),
CommentDeleted(String),
CommentDoesNotExist(String),
CommentIdRequired(String),
CommentNotCreatedByCaller(String),
InvalidCommentId(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl UpdateCommentError {
pub fn from_response(res: BufferedHttpResponse) -> UpdateCommentError {
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 {
"CommentContentRequiredException" => {
return UpdateCommentError::CommentContentRequired(String::from(error_message));
}
"CommentContentSizeLimitExceededException" => {
return UpdateCommentError::CommentContentSizeLimitExceeded(String::from(
error_message,
));
}
"CommentDeletedException" => {
return UpdateCommentError::CommentDeleted(String::from(error_message));
}
"CommentDoesNotExistException" => {
return UpdateCommentError::CommentDoesNotExist(String::from(error_message));
}
"CommentIdRequiredException" => {
return UpdateCommentError::CommentIdRequired(String::from(error_message));
}
"CommentNotCreatedByCallerException" => {
return UpdateCommentError::CommentNotCreatedByCaller(String::from(
error_message,
));
}
"InvalidCommentIdException" => {
return UpdateCommentError::InvalidCommentId(String::from(error_message));
}
"ValidationException" => {
return UpdateCommentError::Validation(error_message.to_string());
}
_ => {}
}
}
return UpdateCommentError::Unknown(res);
}
}
impl From<serde_json::error::Error> for UpdateCommentError {
fn from(err: serde_json::error::Error) -> UpdateCommentError {
UpdateCommentError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for UpdateCommentError {
fn from(err: CredentialsError) -> UpdateCommentError {
UpdateCommentError::Credentials(err)
}
}
impl From<HttpDispatchError> for UpdateCommentError {
fn from(err: HttpDispatchError) -> UpdateCommentError {
UpdateCommentError::HttpDispatch(err)
}
}
impl From<io::Error> for UpdateCommentError {
fn from(err: io::Error) -> UpdateCommentError {
UpdateCommentError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for UpdateCommentError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for UpdateCommentError {
fn description(&self) -> &str {
match *self {
UpdateCommentError::CommentContentRequired(ref cause) => cause,
UpdateCommentError::CommentContentSizeLimitExceeded(ref cause) => cause,
UpdateCommentError::CommentDeleted(ref cause) => cause,
UpdateCommentError::CommentDoesNotExist(ref cause) => cause,
UpdateCommentError::CommentIdRequired(ref cause) => cause,
UpdateCommentError::CommentNotCreatedByCaller(ref cause) => cause,
UpdateCommentError::InvalidCommentId(ref cause) => cause,
UpdateCommentError::Validation(ref cause) => cause,
UpdateCommentError::Credentials(ref err) => err.description(),
UpdateCommentError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
UpdateCommentError::ParseError(ref cause) => cause,
UpdateCommentError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum UpdateDefaultBranchError {
BranchDoesNotExist(String),
BranchNameRequired(String),
EncryptionIntegrityChecksFailed(String),
EncryptionKeyAccessDenied(String),
EncryptionKeyDisabled(String),
EncryptionKeyNotFound(String),
EncryptionKeyUnavailable(String),
InvalidBranchName(String),
InvalidRepositoryName(String),
RepositoryDoesNotExist(String),
RepositoryNameRequired(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl UpdateDefaultBranchError {
pub fn from_response(res: BufferedHttpResponse) -> UpdateDefaultBranchError {
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 {
"BranchDoesNotExistException" => {
return UpdateDefaultBranchError::BranchDoesNotExist(String::from(error_message));
}
"BranchNameRequiredException" => {
return UpdateDefaultBranchError::BranchNameRequired(String::from(error_message));
}
"EncryptionIntegrityChecksFailedException" => {
return UpdateDefaultBranchError::EncryptionIntegrityChecksFailed(String::from(
error_message,
));
}
"EncryptionKeyAccessDeniedException" => {
return UpdateDefaultBranchError::EncryptionKeyAccessDenied(String::from(
error_message,
));
}
"EncryptionKeyDisabledException" => {
return UpdateDefaultBranchError::EncryptionKeyDisabled(String::from(
error_message,
));
}
"EncryptionKeyNotFoundException" => {
return UpdateDefaultBranchError::EncryptionKeyNotFound(String::from(
error_message,
));
}
"EncryptionKeyUnavailableException" => {
return UpdateDefaultBranchError::EncryptionKeyUnavailable(String::from(
error_message,
));
}
"InvalidBranchNameException" => {
return UpdateDefaultBranchError::InvalidBranchName(String::from(error_message));
}
"InvalidRepositoryNameException" => {
return UpdateDefaultBranchError::InvalidRepositoryName(String::from(
error_message,
));
}
"RepositoryDoesNotExistException" => {
return UpdateDefaultBranchError::RepositoryDoesNotExist(String::from(
error_message,
));
}
"RepositoryNameRequiredException" => {
return UpdateDefaultBranchError::RepositoryNameRequired(String::from(
error_message,
));
}
"ValidationException" => {
return UpdateDefaultBranchError::Validation(error_message.to_string());
}
_ => {}
}
}
return UpdateDefaultBranchError::Unknown(res);
}
}
impl From<serde_json::error::Error> for UpdateDefaultBranchError {
fn from(err: serde_json::error::Error) -> UpdateDefaultBranchError {
UpdateDefaultBranchError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for UpdateDefaultBranchError {
fn from(err: CredentialsError) -> UpdateDefaultBranchError {
UpdateDefaultBranchError::Credentials(err)
}
}
impl From<HttpDispatchError> for UpdateDefaultBranchError {
fn from(err: HttpDispatchError) -> UpdateDefaultBranchError {
UpdateDefaultBranchError::HttpDispatch(err)
}
}
impl From<io::Error> for UpdateDefaultBranchError {
fn from(err: io::Error) -> UpdateDefaultBranchError {
UpdateDefaultBranchError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for UpdateDefaultBranchError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for UpdateDefaultBranchError {
fn description(&self) -> &str {
match *self {
UpdateDefaultBranchError::BranchDoesNotExist(ref cause) => cause,
UpdateDefaultBranchError::BranchNameRequired(ref cause) => cause,
UpdateDefaultBranchError::EncryptionIntegrityChecksFailed(ref cause) => cause,
UpdateDefaultBranchError::EncryptionKeyAccessDenied(ref cause) => cause,
UpdateDefaultBranchError::EncryptionKeyDisabled(ref cause) => cause,
UpdateDefaultBranchError::EncryptionKeyNotFound(ref cause) => cause,
UpdateDefaultBranchError::EncryptionKeyUnavailable(ref cause) => cause,
UpdateDefaultBranchError::InvalidBranchName(ref cause) => cause,
UpdateDefaultBranchError::InvalidRepositoryName(ref cause) => cause,
UpdateDefaultBranchError::RepositoryDoesNotExist(ref cause) => cause,
UpdateDefaultBranchError::RepositoryNameRequired(ref cause) => cause,
UpdateDefaultBranchError::Validation(ref cause) => cause,
UpdateDefaultBranchError::Credentials(ref err) => err.description(),
UpdateDefaultBranchError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
UpdateDefaultBranchError::ParseError(ref cause) => cause,
UpdateDefaultBranchError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum UpdatePullRequestDescriptionError {
InvalidDescription(String),
InvalidPullRequestId(String),
PullRequestAlreadyClosed(String),
PullRequestDoesNotExist(String),
PullRequestIdRequired(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl UpdatePullRequestDescriptionError {
pub fn from_response(res: BufferedHttpResponse) -> UpdatePullRequestDescriptionError {
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 {
"InvalidDescriptionException" => {
return UpdatePullRequestDescriptionError::InvalidDescription(String::from(
error_message,
));
}
"InvalidPullRequestIdException" => {
return UpdatePullRequestDescriptionError::InvalidPullRequestId(String::from(
error_message,
));
}
"PullRequestAlreadyClosedException" => {
return UpdatePullRequestDescriptionError::PullRequestAlreadyClosed(
String::from(error_message),
);
}
"PullRequestDoesNotExistException" => {
return UpdatePullRequestDescriptionError::PullRequestDoesNotExist(String::from(
error_message,
));
}
"PullRequestIdRequiredException" => {
return UpdatePullRequestDescriptionError::PullRequestIdRequired(String::from(
error_message,
));
}
"ValidationException" => {
return UpdatePullRequestDescriptionError::Validation(error_message.to_string());
}
_ => {}
}
}
return UpdatePullRequestDescriptionError::Unknown(res);
}
}
impl From<serde_json::error::Error> for UpdatePullRequestDescriptionError {
fn from(err: serde_json::error::Error) -> UpdatePullRequestDescriptionError {
UpdatePullRequestDescriptionError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for UpdatePullRequestDescriptionError {
fn from(err: CredentialsError) -> UpdatePullRequestDescriptionError {
UpdatePullRequestDescriptionError::Credentials(err)
}
}
impl From<HttpDispatchError> for UpdatePullRequestDescriptionError {
fn from(err: HttpDispatchError) -> UpdatePullRequestDescriptionError {
UpdatePullRequestDescriptionError::HttpDispatch(err)
}
}
impl From<io::Error> for UpdatePullRequestDescriptionError {
fn from(err: io::Error) -> UpdatePullRequestDescriptionError {
UpdatePullRequestDescriptionError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for UpdatePullRequestDescriptionError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for UpdatePullRequestDescriptionError {
fn description(&self) -> &str {
match *self {
UpdatePullRequestDescriptionError::InvalidDescription(ref cause) => cause,
UpdatePullRequestDescriptionError::InvalidPullRequestId(ref cause) => cause,
UpdatePullRequestDescriptionError::PullRequestAlreadyClosed(ref cause) => cause,
UpdatePullRequestDescriptionError::PullRequestDoesNotExist(ref cause) => cause,
UpdatePullRequestDescriptionError::PullRequestIdRequired(ref cause) => cause,
UpdatePullRequestDescriptionError::Validation(ref cause) => cause,
UpdatePullRequestDescriptionError::Credentials(ref err) => err.description(),
UpdatePullRequestDescriptionError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
UpdatePullRequestDescriptionError::ParseError(ref cause) => cause,
UpdatePullRequestDescriptionError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum UpdatePullRequestStatusError {
EncryptionIntegrityChecksFailed(String),
EncryptionKeyAccessDenied(String),
EncryptionKeyDisabled(String),
EncryptionKeyNotFound(String),
EncryptionKeyUnavailable(String),
InvalidPullRequestId(String),
InvalidPullRequestStatus(String),
InvalidPullRequestStatusUpdate(String),
PullRequestDoesNotExist(String),
PullRequestIdRequired(String),
PullRequestStatusRequired(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl UpdatePullRequestStatusError {
pub fn from_response(res: BufferedHttpResponse) -> UpdatePullRequestStatusError {
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 {
"EncryptionIntegrityChecksFailedException" => {
return UpdatePullRequestStatusError::EncryptionIntegrityChecksFailed(
String::from(error_message),
);
}
"EncryptionKeyAccessDeniedException" => {
return UpdatePullRequestStatusError::EncryptionKeyAccessDenied(String::from(
error_message,
));
}
"EncryptionKeyDisabledException" => {
return UpdatePullRequestStatusError::EncryptionKeyDisabled(String::from(
error_message,
));
}
"EncryptionKeyNotFoundException" => {
return UpdatePullRequestStatusError::EncryptionKeyNotFound(String::from(
error_message,
));
}
"EncryptionKeyUnavailableException" => {
return UpdatePullRequestStatusError::EncryptionKeyUnavailable(String::from(
error_message,
));
}
"InvalidPullRequestIdException" => {
return UpdatePullRequestStatusError::InvalidPullRequestId(String::from(
error_message,
));
}
"InvalidPullRequestStatusException" => {
return UpdatePullRequestStatusError::InvalidPullRequestStatus(String::from(
error_message,
));
}
"InvalidPullRequestStatusUpdateException" => {
return UpdatePullRequestStatusError::InvalidPullRequestStatusUpdate(
String::from(error_message),
);
}
"PullRequestDoesNotExistException" => {
return UpdatePullRequestStatusError::PullRequestDoesNotExist(String::from(
error_message,
));
}
"PullRequestIdRequiredException" => {
return UpdatePullRequestStatusError::PullRequestIdRequired(String::from(
error_message,
));
}
"PullRequestStatusRequiredException" => {
return UpdatePullRequestStatusError::PullRequestStatusRequired(String::from(
error_message,
));
}
"ValidationException" => {
return UpdatePullRequestStatusError::Validation(error_message.to_string());
}
_ => {}
}
}
return UpdatePullRequestStatusError::Unknown(res);
}
}
impl From<serde_json::error::Error> for UpdatePullRequestStatusError {
fn from(err: serde_json::error::Error) -> UpdatePullRequestStatusError {
UpdatePullRequestStatusError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for UpdatePullRequestStatusError {
fn from(err: CredentialsError) -> UpdatePullRequestStatusError {
UpdatePullRequestStatusError::Credentials(err)
}
}
impl From<HttpDispatchError> for UpdatePullRequestStatusError {
fn from(err: HttpDispatchError) -> UpdatePullRequestStatusError {
UpdatePullRequestStatusError::HttpDispatch(err)
}
}
impl From<io::Error> for UpdatePullRequestStatusError {
fn from(err: io::Error) -> UpdatePullRequestStatusError {
UpdatePullRequestStatusError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for UpdatePullRequestStatusError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for UpdatePullRequestStatusError {
fn description(&self) -> &str {
match *self {
UpdatePullRequestStatusError::EncryptionIntegrityChecksFailed(ref cause) => cause,
UpdatePullRequestStatusError::EncryptionKeyAccessDenied(ref cause) => cause,
UpdatePullRequestStatusError::EncryptionKeyDisabled(ref cause) => cause,
UpdatePullRequestStatusError::EncryptionKeyNotFound(ref cause) => cause,
UpdatePullRequestStatusError::EncryptionKeyUnavailable(ref cause) => cause,
UpdatePullRequestStatusError::InvalidPullRequestId(ref cause) => cause,
UpdatePullRequestStatusError::InvalidPullRequestStatus(ref cause) => cause,
UpdatePullRequestStatusError::InvalidPullRequestStatusUpdate(ref cause) => cause,
UpdatePullRequestStatusError::PullRequestDoesNotExist(ref cause) => cause,
UpdatePullRequestStatusError::PullRequestIdRequired(ref cause) => cause,
UpdatePullRequestStatusError::PullRequestStatusRequired(ref cause) => cause,
UpdatePullRequestStatusError::Validation(ref cause) => cause,
UpdatePullRequestStatusError::Credentials(ref err) => err.description(),
UpdatePullRequestStatusError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
UpdatePullRequestStatusError::ParseError(ref cause) => cause,
UpdatePullRequestStatusError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum UpdatePullRequestTitleError {
InvalidPullRequestId(String),
InvalidTitle(String),
PullRequestAlreadyClosed(String),
PullRequestDoesNotExist(String),
PullRequestIdRequired(String),
TitleRequired(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl UpdatePullRequestTitleError {
pub fn from_response(res: BufferedHttpResponse) -> UpdatePullRequestTitleError {
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 {
"InvalidPullRequestIdException" => {
return UpdatePullRequestTitleError::InvalidPullRequestId(String::from(
error_message,
));
}
"InvalidTitleException" => {
return UpdatePullRequestTitleError::InvalidTitle(String::from(error_message));
}
"PullRequestAlreadyClosedException" => {
return UpdatePullRequestTitleError::PullRequestAlreadyClosed(String::from(
error_message,
));
}
"PullRequestDoesNotExistException" => {
return UpdatePullRequestTitleError::PullRequestDoesNotExist(String::from(
error_message,
));
}
"PullRequestIdRequiredException" => {
return UpdatePullRequestTitleError::PullRequestIdRequired(String::from(
error_message,
));
}
"TitleRequiredException" => {
return UpdatePullRequestTitleError::TitleRequired(String::from(error_message));
}
"ValidationException" => {
return UpdatePullRequestTitleError::Validation(error_message.to_string());
}
_ => {}
}
}
return UpdatePullRequestTitleError::Unknown(res);
}
}
impl From<serde_json::error::Error> for UpdatePullRequestTitleError {
fn from(err: serde_json::error::Error) -> UpdatePullRequestTitleError {
UpdatePullRequestTitleError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for UpdatePullRequestTitleError {
fn from(err: CredentialsError) -> UpdatePullRequestTitleError {
UpdatePullRequestTitleError::Credentials(err)
}
}
impl From<HttpDispatchError> for UpdatePullRequestTitleError {
fn from(err: HttpDispatchError) -> UpdatePullRequestTitleError {
UpdatePullRequestTitleError::HttpDispatch(err)
}
}
impl From<io::Error> for UpdatePullRequestTitleError {
fn from(err: io::Error) -> UpdatePullRequestTitleError {
UpdatePullRequestTitleError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for UpdatePullRequestTitleError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for UpdatePullRequestTitleError {
fn description(&self) -> &str {
match *self {
UpdatePullRequestTitleError::InvalidPullRequestId(ref cause) => cause,
UpdatePullRequestTitleError::InvalidTitle(ref cause) => cause,
UpdatePullRequestTitleError::PullRequestAlreadyClosed(ref cause) => cause,
UpdatePullRequestTitleError::PullRequestDoesNotExist(ref cause) => cause,
UpdatePullRequestTitleError::PullRequestIdRequired(ref cause) => cause,
UpdatePullRequestTitleError::TitleRequired(ref cause) => cause,
UpdatePullRequestTitleError::Validation(ref cause) => cause,
UpdatePullRequestTitleError::Credentials(ref err) => err.description(),
UpdatePullRequestTitleError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
UpdatePullRequestTitleError::ParseError(ref cause) => cause,
UpdatePullRequestTitleError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum UpdateRepositoryDescriptionError {
EncryptionIntegrityChecksFailed(String),
EncryptionKeyAccessDenied(String),
EncryptionKeyDisabled(String),
EncryptionKeyNotFound(String),
EncryptionKeyUnavailable(String),
InvalidRepositoryDescription(String),
InvalidRepositoryName(String),
RepositoryDoesNotExist(String),
RepositoryNameRequired(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl UpdateRepositoryDescriptionError {
pub fn from_response(res: BufferedHttpResponse) -> UpdateRepositoryDescriptionError {
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 {
"EncryptionIntegrityChecksFailedException" => {
return UpdateRepositoryDescriptionError::EncryptionIntegrityChecksFailed(
String::from(error_message),
);
}
"EncryptionKeyAccessDeniedException" => {
return UpdateRepositoryDescriptionError::EncryptionKeyAccessDenied(
String::from(error_message),
);
}
"EncryptionKeyDisabledException" => {
return UpdateRepositoryDescriptionError::EncryptionKeyDisabled(String::from(
error_message,
));
}
"EncryptionKeyNotFoundException" => {
return UpdateRepositoryDescriptionError::EncryptionKeyNotFound(String::from(
error_message,
));
}
"EncryptionKeyUnavailableException" => {
return UpdateRepositoryDescriptionError::EncryptionKeyUnavailable(String::from(
error_message,
));
}
"InvalidRepositoryDescriptionException" => {
return UpdateRepositoryDescriptionError::InvalidRepositoryDescription(
String::from(error_message),
);
}
"InvalidRepositoryNameException" => {
return UpdateRepositoryDescriptionError::InvalidRepositoryName(String::from(
error_message,
));
}
"RepositoryDoesNotExistException" => {
return UpdateRepositoryDescriptionError::RepositoryDoesNotExist(String::from(
error_message,
));
}
"RepositoryNameRequiredException" => {
return UpdateRepositoryDescriptionError::RepositoryNameRequired(String::from(
error_message,
));
}
"ValidationException" => {
return UpdateRepositoryDescriptionError::Validation(error_message.to_string());
}
_ => {}
}
}
return UpdateRepositoryDescriptionError::Unknown(res);
}
}
impl From<serde_json::error::Error> for UpdateRepositoryDescriptionError {
fn from(err: serde_json::error::Error) -> UpdateRepositoryDescriptionError {
UpdateRepositoryDescriptionError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for UpdateRepositoryDescriptionError {
fn from(err: CredentialsError) -> UpdateRepositoryDescriptionError {
UpdateRepositoryDescriptionError::Credentials(err)
}
}
impl From<HttpDispatchError> for UpdateRepositoryDescriptionError {
fn from(err: HttpDispatchError) -> UpdateRepositoryDescriptionError {
UpdateRepositoryDescriptionError::HttpDispatch(err)
}
}
impl From<io::Error> for UpdateRepositoryDescriptionError {
fn from(err: io::Error) -> UpdateRepositoryDescriptionError {
UpdateRepositoryDescriptionError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for UpdateRepositoryDescriptionError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for UpdateRepositoryDescriptionError {
fn description(&self) -> &str {
match *self {
UpdateRepositoryDescriptionError::EncryptionIntegrityChecksFailed(ref cause) => cause,
UpdateRepositoryDescriptionError::EncryptionKeyAccessDenied(ref cause) => cause,
UpdateRepositoryDescriptionError::EncryptionKeyDisabled(ref cause) => cause,
UpdateRepositoryDescriptionError::EncryptionKeyNotFound(ref cause) => cause,
UpdateRepositoryDescriptionError::EncryptionKeyUnavailable(ref cause) => cause,
UpdateRepositoryDescriptionError::InvalidRepositoryDescription(ref cause) => cause,
UpdateRepositoryDescriptionError::InvalidRepositoryName(ref cause) => cause,
UpdateRepositoryDescriptionError::RepositoryDoesNotExist(ref cause) => cause,
UpdateRepositoryDescriptionError::RepositoryNameRequired(ref cause) => cause,
UpdateRepositoryDescriptionError::Validation(ref cause) => cause,
UpdateRepositoryDescriptionError::Credentials(ref err) => err.description(),
UpdateRepositoryDescriptionError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
UpdateRepositoryDescriptionError::ParseError(ref cause) => cause,
UpdateRepositoryDescriptionError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum UpdateRepositoryNameError {
InvalidRepositoryName(String),
RepositoryDoesNotExist(String),
RepositoryNameExists(String),
RepositoryNameRequired(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl UpdateRepositoryNameError {
pub fn from_response(res: BufferedHttpResponse) -> UpdateRepositoryNameError {
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 {
"InvalidRepositoryNameException" => {
return UpdateRepositoryNameError::InvalidRepositoryName(String::from(
error_message,
));
}
"RepositoryDoesNotExistException" => {
return UpdateRepositoryNameError::RepositoryDoesNotExist(String::from(
error_message,
));
}
"RepositoryNameExistsException" => {
return UpdateRepositoryNameError::RepositoryNameExists(String::from(
error_message,
));
}
"RepositoryNameRequiredException" => {
return UpdateRepositoryNameError::RepositoryNameRequired(String::from(
error_message,
));
}
"ValidationException" => {
return UpdateRepositoryNameError::Validation(error_message.to_string());
}
_ => {}
}
}
return UpdateRepositoryNameError::Unknown(res);
}
}
impl From<serde_json::error::Error> for UpdateRepositoryNameError {
fn from(err: serde_json::error::Error) -> UpdateRepositoryNameError {
UpdateRepositoryNameError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for UpdateRepositoryNameError {
fn from(err: CredentialsError) -> UpdateRepositoryNameError {
UpdateRepositoryNameError::Credentials(err)
}
}
impl From<HttpDispatchError> for UpdateRepositoryNameError {
fn from(err: HttpDispatchError) -> UpdateRepositoryNameError {
UpdateRepositoryNameError::HttpDispatch(err)
}
}
impl From<io::Error> for UpdateRepositoryNameError {
fn from(err: io::Error) -> UpdateRepositoryNameError {
UpdateRepositoryNameError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for UpdateRepositoryNameError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for UpdateRepositoryNameError {
fn description(&self) -> &str {
match *self {
UpdateRepositoryNameError::InvalidRepositoryName(ref cause) => cause,
UpdateRepositoryNameError::RepositoryDoesNotExist(ref cause) => cause,
UpdateRepositoryNameError::RepositoryNameExists(ref cause) => cause,
UpdateRepositoryNameError::RepositoryNameRequired(ref cause) => cause,
UpdateRepositoryNameError::Validation(ref cause) => cause,
UpdateRepositoryNameError::Credentials(ref err) => err.description(),
UpdateRepositoryNameError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
UpdateRepositoryNameError::ParseError(ref cause) => cause,
UpdateRepositoryNameError::Unknown(_) => "unknown error",
}
}
}
pub trait CodeCommit {
fn batch_get_repositories(
&self,
input: BatchGetRepositoriesInput,
) -> RusotoFuture<BatchGetRepositoriesOutput, BatchGetRepositoriesError>;
fn create_branch(&self, input: CreateBranchInput) -> RusotoFuture<(), CreateBranchError>;
fn create_commit(
&self,
input: CreateCommitInput,
) -> RusotoFuture<CreateCommitOutput, CreateCommitError>;
fn create_pull_request(
&self,
input: CreatePullRequestInput,
) -> RusotoFuture<CreatePullRequestOutput, CreatePullRequestError>;
fn create_repository(
&self,
input: CreateRepositoryInput,
) -> RusotoFuture<CreateRepositoryOutput, CreateRepositoryError>;
fn delete_branch(
&self,
input: DeleteBranchInput,
) -> RusotoFuture<DeleteBranchOutput, DeleteBranchError>;
fn delete_comment_content(
&self,
input: DeleteCommentContentInput,
) -> RusotoFuture<DeleteCommentContentOutput, DeleteCommentContentError>;
fn delete_file(
&self,
input: DeleteFileInput,
) -> RusotoFuture<DeleteFileOutput, DeleteFileError>;
fn delete_repository(
&self,
input: DeleteRepositoryInput,
) -> RusotoFuture<DeleteRepositoryOutput, DeleteRepositoryError>;
fn describe_pull_request_events(
&self,
input: DescribePullRequestEventsInput,
) -> RusotoFuture<DescribePullRequestEventsOutput, DescribePullRequestEventsError>;
fn get_blob(&self, input: GetBlobInput) -> RusotoFuture<GetBlobOutput, GetBlobError>;
fn get_branch(&self, input: GetBranchInput) -> RusotoFuture<GetBranchOutput, GetBranchError>;
fn get_comment(
&self,
input: GetCommentInput,
) -> RusotoFuture<GetCommentOutput, GetCommentError>;
fn get_comments_for_compared_commit(
&self,
input: GetCommentsForComparedCommitInput,
) -> RusotoFuture<GetCommentsForComparedCommitOutput, GetCommentsForComparedCommitError>;
fn get_comments_for_pull_request(
&self,
input: GetCommentsForPullRequestInput,
) -> RusotoFuture<GetCommentsForPullRequestOutput, GetCommentsForPullRequestError>;
fn get_commit(&self, input: GetCommitInput) -> RusotoFuture<GetCommitOutput, GetCommitError>;
fn get_differences(
&self,
input: GetDifferencesInput,
) -> RusotoFuture<GetDifferencesOutput, GetDifferencesError>;
fn get_file(&self, input: GetFileInput) -> RusotoFuture<GetFileOutput, GetFileError>;
fn get_folder(&self, input: GetFolderInput) -> RusotoFuture<GetFolderOutput, GetFolderError>;
fn get_merge_conflicts(
&self,
input: GetMergeConflictsInput,
) -> RusotoFuture<GetMergeConflictsOutput, GetMergeConflictsError>;
fn get_pull_request(
&self,
input: GetPullRequestInput,
) -> RusotoFuture<GetPullRequestOutput, GetPullRequestError>;
fn get_repository(
&self,
input: GetRepositoryInput,
) -> RusotoFuture<GetRepositoryOutput, GetRepositoryError>;
fn get_repository_triggers(
&self,
input: GetRepositoryTriggersInput,
) -> RusotoFuture<GetRepositoryTriggersOutput, GetRepositoryTriggersError>;
fn list_branches(
&self,
input: ListBranchesInput,
) -> RusotoFuture<ListBranchesOutput, ListBranchesError>;
fn list_pull_requests(
&self,
input: ListPullRequestsInput,
) -> RusotoFuture<ListPullRequestsOutput, ListPullRequestsError>;
fn list_repositories(
&self,
input: ListRepositoriesInput,
) -> RusotoFuture<ListRepositoriesOutput, ListRepositoriesError>;
fn merge_pull_request_by_fast_forward(
&self,
input: MergePullRequestByFastForwardInput,
) -> RusotoFuture<MergePullRequestByFastForwardOutput, MergePullRequestByFastForwardError>;
fn post_comment_for_compared_commit(
&self,
input: PostCommentForComparedCommitInput,
) -> RusotoFuture<PostCommentForComparedCommitOutput, PostCommentForComparedCommitError>;
fn post_comment_for_pull_request(
&self,
input: PostCommentForPullRequestInput,
) -> RusotoFuture<PostCommentForPullRequestOutput, PostCommentForPullRequestError>;
fn post_comment_reply(
&self,
input: PostCommentReplyInput,
) -> RusotoFuture<PostCommentReplyOutput, PostCommentReplyError>;
fn put_file(&self, input: PutFileInput) -> RusotoFuture<PutFileOutput, PutFileError>;
fn put_repository_triggers(
&self,
input: PutRepositoryTriggersInput,
) -> RusotoFuture<PutRepositoryTriggersOutput, PutRepositoryTriggersError>;
fn test_repository_triggers(
&self,
input: TestRepositoryTriggersInput,
) -> RusotoFuture<TestRepositoryTriggersOutput, TestRepositoryTriggersError>;
fn update_comment(
&self,
input: UpdateCommentInput,
) -> RusotoFuture<UpdateCommentOutput, UpdateCommentError>;
fn update_default_branch(
&self,
input: UpdateDefaultBranchInput,
) -> RusotoFuture<(), UpdateDefaultBranchError>;
fn update_pull_request_description(
&self,
input: UpdatePullRequestDescriptionInput,
) -> RusotoFuture<UpdatePullRequestDescriptionOutput, UpdatePullRequestDescriptionError>;
fn update_pull_request_status(
&self,
input: UpdatePullRequestStatusInput,
) -> RusotoFuture<UpdatePullRequestStatusOutput, UpdatePullRequestStatusError>;
fn update_pull_request_title(
&self,
input: UpdatePullRequestTitleInput,
) -> RusotoFuture<UpdatePullRequestTitleOutput, UpdatePullRequestTitleError>;
fn update_repository_description(
&self,
input: UpdateRepositoryDescriptionInput,
) -> RusotoFuture<(), UpdateRepositoryDescriptionError>;
fn update_repository_name(
&self,
input: UpdateRepositoryNameInput,
) -> RusotoFuture<(), UpdateRepositoryNameError>;
}
#[derive(Clone)]
pub struct CodeCommitClient {
client: Client,
region: region::Region,
}
impl CodeCommitClient {
pub fn new(region: region::Region) -> CodeCommitClient {
CodeCommitClient {
client: Client::shared(),
region: region,
}
}
pub fn new_with<P, D>(
request_dispatcher: D,
credentials_provider: P,
region: region::Region,
) -> CodeCommitClient
where
P: ProvideAwsCredentials + Send + Sync + 'static,
P::Future: Send,
D: DispatchSignedRequest + Send + Sync + 'static,
D::Future: Send,
{
CodeCommitClient {
client: Client::new_with(credentials_provider, request_dispatcher),
region: region,
}
}
}
impl CodeCommit for CodeCommitClient {
fn batch_get_repositories(
&self,
input: BatchGetRepositoriesInput,
) -> RusotoFuture<BatchGetRepositoriesOutput, BatchGetRepositoriesError> {
let mut request = SignedRequest::new("POST", "codecommit", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "CodeCommit_20150413.BatchGetRepositories");
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::<BatchGetRepositoriesOutput>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(BatchGetRepositoriesError::from_response(response))
}),
)
}
})
}
fn create_branch(&self, input: CreateBranchInput) -> RusotoFuture<(), CreateBranchError> {
let mut request = SignedRequest::new("POST", "codecommit", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "CodeCommit_20150413.CreateBranch");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(future::ok(::std::mem::drop(response)))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(CreateBranchError::from_response(response))),
)
}
})
}
fn create_commit(
&self,
input: CreateCommitInput,
) -> RusotoFuture<CreateCommitOutput, CreateCommitError> {
let mut request = SignedRequest::new("POST", "codecommit", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "CodeCommit_20150413.CreateCommit");
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::<CreateCommitOutput>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(CreateCommitError::from_response(response))),
)
}
})
}
fn create_pull_request(
&self,
input: CreatePullRequestInput,
) -> RusotoFuture<CreatePullRequestOutput, CreatePullRequestError> {
let mut request = SignedRequest::new("POST", "codecommit", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "CodeCommit_20150413.CreatePullRequest");
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::<CreatePullRequestOutput>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(CreatePullRequestError::from_response(response))),
)
}
})
}
fn create_repository(
&self,
input: CreateRepositoryInput,
) -> RusotoFuture<CreateRepositoryOutput, CreateRepositoryError> {
let mut request = SignedRequest::new("POST", "codecommit", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "CodeCommit_20150413.CreateRepository");
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::<CreateRepositoryOutput>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(CreateRepositoryError::from_response(response))),
)
}
})
}
fn delete_branch(
&self,
input: DeleteBranchInput,
) -> RusotoFuture<DeleteBranchOutput, DeleteBranchError> {
let mut request = SignedRequest::new("POST", "codecommit", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "CodeCommit_20150413.DeleteBranch");
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::<DeleteBranchOutput>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(DeleteBranchError::from_response(response))),
)
}
})
}
fn delete_comment_content(
&self,
input: DeleteCommentContentInput,
) -> RusotoFuture<DeleteCommentContentOutput, DeleteCommentContentError> {
let mut request = SignedRequest::new("POST", "codecommit", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "CodeCommit_20150413.DeleteCommentContent");
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::<DeleteCommentContentOutput>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(DeleteCommentContentError::from_response(response))
}),
)
}
})
}
fn delete_file(
&self,
input: DeleteFileInput,
) -> RusotoFuture<DeleteFileOutput, DeleteFileError> {
let mut request = SignedRequest::new("POST", "codecommit", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "CodeCommit_20150413.DeleteFile");
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::<DeleteFileOutput>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(DeleteFileError::from_response(response))),
)
}
})
}
fn delete_repository(
&self,
input: DeleteRepositoryInput,
) -> RusotoFuture<DeleteRepositoryOutput, DeleteRepositoryError> {
let mut request = SignedRequest::new("POST", "codecommit", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "CodeCommit_20150413.DeleteRepository");
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::<DeleteRepositoryOutput>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(DeleteRepositoryError::from_response(response))),
)
}
})
}
fn describe_pull_request_events(
&self,
input: DescribePullRequestEventsInput,
) -> RusotoFuture<DescribePullRequestEventsOutput, DescribePullRequestEventsError> {
let mut request = SignedRequest::new("POST", "codecommit", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"CodeCommit_20150413.DescribePullRequestEvents",
);
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::<DescribePullRequestEventsOutput>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(DescribePullRequestEventsError::from_response(response))
}))
}
})
}
fn get_blob(&self, input: GetBlobInput) -> RusotoFuture<GetBlobOutput, GetBlobError> {
let mut request = SignedRequest::new("POST", "codecommit", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "CodeCommit_20150413.GetBlob");
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::<GetBlobOutput>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(GetBlobError::from_response(response))),
)
}
})
}
fn get_branch(&self, input: GetBranchInput) -> RusotoFuture<GetBranchOutput, GetBranchError> {
let mut request = SignedRequest::new("POST", "codecommit", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "CodeCommit_20150413.GetBranch");
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::<GetBranchOutput>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(GetBranchError::from_response(response))),
)
}
})
}
fn get_comment(
&self,
input: GetCommentInput,
) -> RusotoFuture<GetCommentOutput, GetCommentError> {
let mut request = SignedRequest::new("POST", "codecommit", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "CodeCommit_20150413.GetComment");
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::<GetCommentOutput>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(GetCommentError::from_response(response))),
)
}
})
}
fn get_comments_for_compared_commit(
&self,
input: GetCommentsForComparedCommitInput,
) -> RusotoFuture<GetCommentsForComparedCommitOutput, GetCommentsForComparedCommitError> {
let mut request = SignedRequest::new("POST", "codecommit", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"CodeCommit_20150413.GetCommentsForComparedCommit",
);
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::<GetCommentsForComparedCommitOutput>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(GetCommentsForComparedCommitError::from_response(response))
}))
}
})
}
fn get_comments_for_pull_request(
&self,
input: GetCommentsForPullRequestInput,
) -> RusotoFuture<GetCommentsForPullRequestOutput, GetCommentsForPullRequestError> {
let mut request = SignedRequest::new("POST", "codecommit", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"CodeCommit_20150413.GetCommentsForPullRequest",
);
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::<GetCommentsForPullRequestOutput>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(GetCommentsForPullRequestError::from_response(response))
}))
}
})
}
fn get_commit(&self, input: GetCommitInput) -> RusotoFuture<GetCommitOutput, GetCommitError> {
let mut request = SignedRequest::new("POST", "codecommit", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "CodeCommit_20150413.GetCommit");
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::<GetCommitOutput>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(GetCommitError::from_response(response))),
)
}
})
}
fn get_differences(
&self,
input: GetDifferencesInput,
) -> RusotoFuture<GetDifferencesOutput, GetDifferencesError> {
let mut request = SignedRequest::new("POST", "codecommit", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "CodeCommit_20150413.GetDifferences");
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::<GetDifferencesOutput>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(GetDifferencesError::from_response(response))),
)
}
})
}
fn get_file(&self, input: GetFileInput) -> RusotoFuture<GetFileOutput, GetFileError> {
let mut request = SignedRequest::new("POST", "codecommit", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "CodeCommit_20150413.GetFile");
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::<GetFileOutput>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(GetFileError::from_response(response))),
)
}
})
}
fn get_folder(&self, input: GetFolderInput) -> RusotoFuture<GetFolderOutput, GetFolderError> {
let mut request = SignedRequest::new("POST", "codecommit", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "CodeCommit_20150413.GetFolder");
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::<GetFolderOutput>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(GetFolderError::from_response(response))),
)
}
})
}
fn get_merge_conflicts(
&self,
input: GetMergeConflictsInput,
) -> RusotoFuture<GetMergeConflictsOutput, GetMergeConflictsError> {
let mut request = SignedRequest::new("POST", "codecommit", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "CodeCommit_20150413.GetMergeConflicts");
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::<GetMergeConflictsOutput>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(GetMergeConflictsError::from_response(response))),
)
}
})
}
fn get_pull_request(
&self,
input: GetPullRequestInput,
) -> RusotoFuture<GetPullRequestOutput, GetPullRequestError> {
let mut request = SignedRequest::new("POST", "codecommit", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "CodeCommit_20150413.GetPullRequest");
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::<GetPullRequestOutput>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(GetPullRequestError::from_response(response))),
)
}
})
}
fn get_repository(
&self,
input: GetRepositoryInput,
) -> RusotoFuture<GetRepositoryOutput, GetRepositoryError> {
let mut request = SignedRequest::new("POST", "codecommit", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "CodeCommit_20150413.GetRepository");
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::<GetRepositoryOutput>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(GetRepositoryError::from_response(response))),
)
}
})
}
fn get_repository_triggers(
&self,
input: GetRepositoryTriggersInput,
) -> RusotoFuture<GetRepositoryTriggersOutput, GetRepositoryTriggersError> {
let mut request = SignedRequest::new("POST", "codecommit", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "CodeCommit_20150413.GetRepositoryTriggers");
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::<GetRepositoryTriggersOutput>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(GetRepositoryTriggersError::from_response(response))
}),
)
}
})
}
fn list_branches(
&self,
input: ListBranchesInput,
) -> RusotoFuture<ListBranchesOutput, ListBranchesError> {
let mut request = SignedRequest::new("POST", "codecommit", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "CodeCommit_20150413.ListBranches");
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::<ListBranchesOutput>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(ListBranchesError::from_response(response))),
)
}
})
}
fn list_pull_requests(
&self,
input: ListPullRequestsInput,
) -> RusotoFuture<ListPullRequestsOutput, ListPullRequestsError> {
let mut request = SignedRequest::new("POST", "codecommit", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "CodeCommit_20150413.ListPullRequests");
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::<ListPullRequestsOutput>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(ListPullRequestsError::from_response(response))),
)
}
})
}
fn list_repositories(
&self,
input: ListRepositoriesInput,
) -> RusotoFuture<ListRepositoriesOutput, ListRepositoriesError> {
let mut request = SignedRequest::new("POST", "codecommit", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "CodeCommit_20150413.ListRepositories");
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::<ListRepositoriesOutput>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(ListRepositoriesError::from_response(response))),
)
}
})
}
fn merge_pull_request_by_fast_forward(
&self,
input: MergePullRequestByFastForwardInput,
) -> RusotoFuture<MergePullRequestByFastForwardOutput, MergePullRequestByFastForwardError> {
let mut request = SignedRequest::new("POST", "codecommit", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"CodeCommit_20150413.MergePullRequestByFastForward",
);
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::<MergePullRequestByFastForwardOutput>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(MergePullRequestByFastForwardError::from_response(response))
}))
}
})
}
fn post_comment_for_compared_commit(
&self,
input: PostCommentForComparedCommitInput,
) -> RusotoFuture<PostCommentForComparedCommitOutput, PostCommentForComparedCommitError> {
let mut request = SignedRequest::new("POST", "codecommit", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"CodeCommit_20150413.PostCommentForComparedCommit",
);
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::<PostCommentForComparedCommitOutput>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(PostCommentForComparedCommitError::from_response(response))
}))
}
})
}
fn post_comment_for_pull_request(
&self,
input: PostCommentForPullRequestInput,
) -> RusotoFuture<PostCommentForPullRequestOutput, PostCommentForPullRequestError> {
let mut request = SignedRequest::new("POST", "codecommit", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"CodeCommit_20150413.PostCommentForPullRequest",
);
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::<PostCommentForPullRequestOutput>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(PostCommentForPullRequestError::from_response(response))
}))
}
})
}
fn post_comment_reply(
&self,
input: PostCommentReplyInput,
) -> RusotoFuture<PostCommentReplyOutput, PostCommentReplyError> {
let mut request = SignedRequest::new("POST", "codecommit", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "CodeCommit_20150413.PostCommentReply");
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::<PostCommentReplyOutput>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(PostCommentReplyError::from_response(response))),
)
}
})
}
fn put_file(&self, input: PutFileInput) -> RusotoFuture<PutFileOutput, PutFileError> {
let mut request = SignedRequest::new("POST", "codecommit", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "CodeCommit_20150413.PutFile");
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::<PutFileOutput>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(PutFileError::from_response(response))),
)
}
})
}
fn put_repository_triggers(
&self,
input: PutRepositoryTriggersInput,
) -> RusotoFuture<PutRepositoryTriggersOutput, PutRepositoryTriggersError> {
let mut request = SignedRequest::new("POST", "codecommit", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "CodeCommit_20150413.PutRepositoryTriggers");
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::<PutRepositoryTriggersOutput>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(PutRepositoryTriggersError::from_response(response))
}),
)
}
})
}
fn test_repository_triggers(
&self,
input: TestRepositoryTriggersInput,
) -> RusotoFuture<TestRepositoryTriggersOutput, TestRepositoryTriggersError> {
let mut request = SignedRequest::new("POST", "codecommit", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "CodeCommit_20150413.TestRepositoryTriggers");
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::<TestRepositoryTriggersOutput>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(TestRepositoryTriggersError::from_response(response))
}),
)
}
})
}
fn update_comment(
&self,
input: UpdateCommentInput,
) -> RusotoFuture<UpdateCommentOutput, UpdateCommentError> {
let mut request = SignedRequest::new("POST", "codecommit", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "CodeCommit_20150413.UpdateComment");
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::<UpdateCommentOutput>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(UpdateCommentError::from_response(response))),
)
}
})
}
fn update_default_branch(
&self,
input: UpdateDefaultBranchInput,
) -> RusotoFuture<(), UpdateDefaultBranchError> {
let mut request = SignedRequest::new("POST", "codecommit", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "CodeCommit_20150413.UpdateDefaultBranch");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(future::ok(::std::mem::drop(response)))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(UpdateDefaultBranchError::from_response(response))
}),
)
}
})
}
fn update_pull_request_description(
&self,
input: UpdatePullRequestDescriptionInput,
) -> RusotoFuture<UpdatePullRequestDescriptionOutput, UpdatePullRequestDescriptionError> {
let mut request = SignedRequest::new("POST", "codecommit", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"CodeCommit_20150413.UpdatePullRequestDescription",
);
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::<UpdatePullRequestDescriptionOutput>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(UpdatePullRequestDescriptionError::from_response(response))
}))
}
})
}
fn update_pull_request_status(
&self,
input: UpdatePullRequestStatusInput,
) -> RusotoFuture<UpdatePullRequestStatusOutput, UpdatePullRequestStatusError> {
let mut request = SignedRequest::new("POST", "codecommit", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"CodeCommit_20150413.UpdatePullRequestStatus",
);
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::<UpdatePullRequestStatusOutput>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(UpdatePullRequestStatusError::from_response(response))
}))
}
})
}
fn update_pull_request_title(
&self,
input: UpdatePullRequestTitleInput,
) -> RusotoFuture<UpdatePullRequestTitleOutput, UpdatePullRequestTitleError> {
let mut request = SignedRequest::new("POST", "codecommit", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "CodeCommit_20150413.UpdatePullRequestTitle");
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::<UpdatePullRequestTitleOutput>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(UpdatePullRequestTitleError::from_response(response))
}),
)
}
})
}
fn update_repository_description(
&self,
input: UpdateRepositoryDescriptionInput,
) -> RusotoFuture<(), UpdateRepositoryDescriptionError> {
let mut request = SignedRequest::new("POST", "codecommit", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"CodeCommit_20150413.UpdateRepositoryDescription",
);
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(future::ok(::std::mem::drop(response)))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(UpdateRepositoryDescriptionError::from_response(response))
}))
}
})
}
fn update_repository_name(
&self,
input: UpdateRepositoryNameInput,
) -> RusotoFuture<(), UpdateRepositoryNameError> {
let mut request = SignedRequest::new("POST", "codecommit", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "CodeCommit_20150413.UpdateRepositoryName");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(future::ok(::std::mem::drop(response)))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(UpdateRepositoryNameError::from_response(response))
}),
)
}
})
}
}
#[cfg(test)]
mod protocol_tests {}