use std::error::Error;
use std::fmt;
use async_trait::async_trait;
use rusoto_core::credential::ProvideAwsCredentials;
use rusoto_core::region;
use rusoto_core::request::{BufferedHttpResponse, DispatchSignedRequest};
use rusoto_core::{Client, RusotoError};
use rusoto_core::param::{Params, ServiceParams};
use rusoto_core::proto;
use rusoto_core::signature::SignedRequest;
#[allow(unused_imports)]
use serde::{Deserialize, Serialize};
use serde_json;
#[derive(Clone, Debug, Default, PartialEq, Serialize)]
#[cfg_attr(feature = "deserialize_structs", derive(Deserialize))]
pub struct CancelJournalKinesisStreamRequest {
#[serde(rename = "LedgerName")]
pub ledger_name: String,
#[serde(rename = "StreamId")]
pub stream_id: String,
}
#[derive(Clone, Debug, Default, Deserialize, PartialEq)]
#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
pub struct CancelJournalKinesisStreamResponse {
#[serde(rename = "StreamId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub stream_id: Option<String>,
}
#[derive(Clone, Debug, Default, PartialEq, Serialize)]
#[cfg_attr(feature = "deserialize_structs", derive(Deserialize))]
pub struct CreateLedgerRequest {
#[serde(rename = "DeletionProtection")]
#[serde(skip_serializing_if = "Option::is_none")]
pub deletion_protection: Option<bool>,
#[serde(rename = "Name")]
pub name: String,
#[serde(rename = "PermissionsMode")]
pub permissions_mode: String,
#[serde(rename = "Tags")]
#[serde(skip_serializing_if = "Option::is_none")]
pub tags: Option<::std::collections::HashMap<String, String>>,
}
#[derive(Clone, Debug, Default, Deserialize, PartialEq)]
#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
pub struct CreateLedgerResponse {
#[serde(rename = "Arn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub arn: Option<String>,
#[serde(rename = "CreationDateTime")]
#[serde(skip_serializing_if = "Option::is_none")]
pub creation_date_time: Option<f64>,
#[serde(rename = "DeletionProtection")]
#[serde(skip_serializing_if = "Option::is_none")]
pub deletion_protection: Option<bool>,
#[serde(rename = "Name")]
#[serde(skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
#[serde(rename = "State")]
#[serde(skip_serializing_if = "Option::is_none")]
pub state: Option<String>,
}
#[derive(Clone, Debug, Default, PartialEq, Serialize)]
#[cfg_attr(feature = "deserialize_structs", derive(Deserialize))]
pub struct DeleteLedgerRequest {
#[serde(rename = "Name")]
pub name: String,
}
#[derive(Clone, Debug, Default, PartialEq, Serialize)]
#[cfg_attr(feature = "deserialize_structs", derive(Deserialize))]
pub struct DescribeJournalKinesisStreamRequest {
#[serde(rename = "LedgerName")]
pub ledger_name: String,
#[serde(rename = "StreamId")]
pub stream_id: String,
}
#[derive(Clone, Debug, Default, Deserialize, PartialEq)]
#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
pub struct DescribeJournalKinesisStreamResponse {
#[serde(rename = "Stream")]
#[serde(skip_serializing_if = "Option::is_none")]
pub stream: Option<JournalKinesisStreamDescription>,
}
#[derive(Clone, Debug, Default, PartialEq, Serialize)]
#[cfg_attr(feature = "deserialize_structs", derive(Deserialize))]
pub struct DescribeJournalS3ExportRequest {
#[serde(rename = "ExportId")]
pub export_id: String,
#[serde(rename = "Name")]
pub name: String,
}
#[derive(Clone, Debug, Default, Deserialize, PartialEq)]
#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
pub struct DescribeJournalS3ExportResponse {
#[serde(rename = "ExportDescription")]
pub export_description: JournalS3ExportDescription,
}
#[derive(Clone, Debug, Default, PartialEq, Serialize)]
#[cfg_attr(feature = "deserialize_structs", derive(Deserialize))]
pub struct DescribeLedgerRequest {
#[serde(rename = "Name")]
pub name: String,
}
#[derive(Clone, Debug, Default, Deserialize, PartialEq)]
#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
pub struct DescribeLedgerResponse {
#[serde(rename = "Arn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub arn: Option<String>,
#[serde(rename = "CreationDateTime")]
#[serde(skip_serializing_if = "Option::is_none")]
pub creation_date_time: Option<f64>,
#[serde(rename = "DeletionProtection")]
#[serde(skip_serializing_if = "Option::is_none")]
pub deletion_protection: Option<bool>,
#[serde(rename = "Name")]
#[serde(skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
#[serde(rename = "State")]
#[serde(skip_serializing_if = "Option::is_none")]
pub state: Option<String>,
}
#[derive(Clone, Debug, Default, PartialEq, Serialize)]
#[cfg_attr(feature = "deserialize_structs", derive(Deserialize))]
pub struct ExportJournalToS3Request {
#[serde(rename = "ExclusiveEndTime")]
pub exclusive_end_time: f64,
#[serde(rename = "InclusiveStartTime")]
pub inclusive_start_time: f64,
#[serde(rename = "Name")]
pub name: String,
#[serde(rename = "RoleArn")]
pub role_arn: String,
#[serde(rename = "S3ExportConfiguration")]
pub s3_export_configuration: S3ExportConfiguration,
}
#[derive(Clone, Debug, Default, Deserialize, PartialEq)]
#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
pub struct ExportJournalToS3Response {
#[serde(rename = "ExportId")]
pub export_id: String,
}
#[derive(Clone, Debug, Default, PartialEq, Serialize)]
#[cfg_attr(feature = "deserialize_structs", derive(Deserialize))]
pub struct GetBlockRequest {
#[serde(rename = "BlockAddress")]
pub block_address: ValueHolder,
#[serde(rename = "DigestTipAddress")]
#[serde(skip_serializing_if = "Option::is_none")]
pub digest_tip_address: Option<ValueHolder>,
#[serde(rename = "Name")]
pub name: String,
}
#[derive(Clone, Debug, Default, Deserialize, PartialEq)]
#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
pub struct GetBlockResponse {
#[serde(rename = "Block")]
pub block: ValueHolder,
#[serde(rename = "Proof")]
#[serde(skip_serializing_if = "Option::is_none")]
pub proof: Option<ValueHolder>,
}
#[derive(Clone, Debug, Default, PartialEq, Serialize)]
#[cfg_attr(feature = "deserialize_structs", derive(Deserialize))]
pub struct GetDigestRequest {
#[serde(rename = "Name")]
pub name: String,
}
#[derive(Clone, Debug, Default, Deserialize, PartialEq)]
#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
pub struct GetDigestResponse {
#[serde(rename = "Digest")]
#[serde(
deserialize_with = "::rusoto_core::serialization::SerdeBlob::deserialize_blob",
serialize_with = "::rusoto_core::serialization::SerdeBlob::serialize_blob",
default
)]
pub digest: bytes::Bytes,
#[serde(rename = "DigestTipAddress")]
pub digest_tip_address: ValueHolder,
}
#[derive(Clone, Debug, Default, PartialEq, Serialize)]
#[cfg_attr(feature = "deserialize_structs", derive(Deserialize))]
pub struct GetRevisionRequest {
#[serde(rename = "BlockAddress")]
pub block_address: ValueHolder,
#[serde(rename = "DigestTipAddress")]
#[serde(skip_serializing_if = "Option::is_none")]
pub digest_tip_address: Option<ValueHolder>,
#[serde(rename = "DocumentId")]
pub document_id: String,
#[serde(rename = "Name")]
pub name: String,
}
#[derive(Clone, Debug, Default, Deserialize, PartialEq)]
#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
pub struct GetRevisionResponse {
#[serde(rename = "Proof")]
#[serde(skip_serializing_if = "Option::is_none")]
pub proof: Option<ValueHolder>,
#[serde(rename = "Revision")]
pub revision: ValueHolder,
}
#[derive(Clone, Debug, Default, Deserialize, PartialEq)]
#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
pub struct JournalKinesisStreamDescription {
#[serde(rename = "Arn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub arn: Option<String>,
#[serde(rename = "CreationTime")]
#[serde(skip_serializing_if = "Option::is_none")]
pub creation_time: Option<f64>,
#[serde(rename = "ErrorCause")]
#[serde(skip_serializing_if = "Option::is_none")]
pub error_cause: Option<String>,
#[serde(rename = "ExclusiveEndTime")]
#[serde(skip_serializing_if = "Option::is_none")]
pub exclusive_end_time: Option<f64>,
#[serde(rename = "InclusiveStartTime")]
#[serde(skip_serializing_if = "Option::is_none")]
pub inclusive_start_time: Option<f64>,
#[serde(rename = "KinesisConfiguration")]
pub kinesis_configuration: KinesisConfiguration,
#[serde(rename = "LedgerName")]
pub ledger_name: String,
#[serde(rename = "RoleArn")]
pub role_arn: String,
#[serde(rename = "Status")]
pub status: String,
#[serde(rename = "StreamId")]
pub stream_id: String,
#[serde(rename = "StreamName")]
pub stream_name: String,
}
#[derive(Clone, Debug, Default, Deserialize, PartialEq)]
#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
pub struct JournalS3ExportDescription {
#[serde(rename = "ExclusiveEndTime")]
pub exclusive_end_time: f64,
#[serde(rename = "ExportCreationTime")]
pub export_creation_time: f64,
#[serde(rename = "ExportId")]
pub export_id: String,
#[serde(rename = "InclusiveStartTime")]
pub inclusive_start_time: f64,
#[serde(rename = "LedgerName")]
pub ledger_name: String,
#[serde(rename = "RoleArn")]
pub role_arn: String,
#[serde(rename = "S3ExportConfiguration")]
pub s3_export_configuration: S3ExportConfiguration,
#[serde(rename = "Status")]
pub status: String,
}
#[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)]
pub struct KinesisConfiguration {
#[serde(rename = "AggregationEnabled")]
#[serde(skip_serializing_if = "Option::is_none")]
pub aggregation_enabled: Option<bool>,
#[serde(rename = "StreamArn")]
pub stream_arn: String,
}
#[derive(Clone, Debug, Default, Deserialize, PartialEq)]
#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
pub struct LedgerSummary {
#[serde(rename = "CreationDateTime")]
#[serde(skip_serializing_if = "Option::is_none")]
pub creation_date_time: Option<f64>,
#[serde(rename = "Name")]
#[serde(skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
#[serde(rename = "State")]
#[serde(skip_serializing_if = "Option::is_none")]
pub state: Option<String>,
}
#[derive(Clone, Debug, Default, PartialEq, Serialize)]
#[cfg_attr(feature = "deserialize_structs", derive(Deserialize))]
pub struct ListJournalKinesisStreamsForLedgerRequest {
#[serde(rename = "LedgerName")]
pub ledger_name: String,
#[serde(rename = "MaxResults")]
#[serde(skip_serializing_if = "Option::is_none")]
pub max_results: Option<i64>,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
}
#[derive(Clone, Debug, Default, Deserialize, PartialEq)]
#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
pub struct ListJournalKinesisStreamsForLedgerResponse {
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "Streams")]
#[serde(skip_serializing_if = "Option::is_none")]
pub streams: Option<Vec<JournalKinesisStreamDescription>>,
}
#[derive(Clone, Debug, Default, PartialEq, Serialize)]
#[cfg_attr(feature = "deserialize_structs", derive(Deserialize))]
pub struct ListJournalS3ExportsForLedgerRequest {
#[serde(rename = "MaxResults")]
#[serde(skip_serializing_if = "Option::is_none")]
pub max_results: Option<i64>,
#[serde(rename = "Name")]
pub name: String,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
}
#[derive(Clone, Debug, Default, Deserialize, PartialEq)]
#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
pub struct ListJournalS3ExportsForLedgerResponse {
#[serde(rename = "JournalS3Exports")]
#[serde(skip_serializing_if = "Option::is_none")]
pub journal_s3_exports: Option<Vec<JournalS3ExportDescription>>,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
}
#[derive(Clone, Debug, Default, PartialEq, Serialize)]
#[cfg_attr(feature = "deserialize_structs", derive(Deserialize))]
pub struct ListJournalS3ExportsRequest {
#[serde(rename = "MaxResults")]
#[serde(skip_serializing_if = "Option::is_none")]
pub max_results: Option<i64>,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
}
#[derive(Clone, Debug, Default, Deserialize, PartialEq)]
#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
pub struct ListJournalS3ExportsResponse {
#[serde(rename = "JournalS3Exports")]
#[serde(skip_serializing_if = "Option::is_none")]
pub journal_s3_exports: Option<Vec<JournalS3ExportDescription>>,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
}
#[derive(Clone, Debug, Default, PartialEq, Serialize)]
#[cfg_attr(feature = "deserialize_structs", derive(Deserialize))]
pub struct ListLedgersRequest {
#[serde(rename = "MaxResults")]
#[serde(skip_serializing_if = "Option::is_none")]
pub max_results: Option<i64>,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
}
#[derive(Clone, Debug, Default, Deserialize, PartialEq)]
#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
pub struct ListLedgersResponse {
#[serde(rename = "Ledgers")]
#[serde(skip_serializing_if = "Option::is_none")]
pub ledgers: Option<Vec<LedgerSummary>>,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
}
#[derive(Clone, Debug, Default, PartialEq, Serialize)]
#[cfg_attr(feature = "deserialize_structs", derive(Deserialize))]
pub struct ListTagsForResourceRequest {
#[serde(rename = "ResourceArn")]
pub resource_arn: String,
}
#[derive(Clone, Debug, Default, Deserialize, PartialEq)]
#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
pub struct ListTagsForResourceResponse {
#[serde(rename = "Tags")]
#[serde(skip_serializing_if = "Option::is_none")]
pub tags: Option<::std::collections::HashMap<String, String>>,
}
#[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)]
pub struct S3EncryptionConfiguration {
#[serde(rename = "KmsKeyArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub kms_key_arn: Option<String>,
#[serde(rename = "ObjectEncryptionType")]
pub object_encryption_type: String,
}
#[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)]
pub struct S3ExportConfiguration {
#[serde(rename = "Bucket")]
pub bucket: String,
#[serde(rename = "EncryptionConfiguration")]
pub encryption_configuration: S3EncryptionConfiguration,
#[serde(rename = "Prefix")]
pub prefix: String,
}
#[derive(Clone, Debug, Default, PartialEq, Serialize)]
#[cfg_attr(feature = "deserialize_structs", derive(Deserialize))]
pub struct StreamJournalToKinesisRequest {
#[serde(rename = "ExclusiveEndTime")]
#[serde(skip_serializing_if = "Option::is_none")]
pub exclusive_end_time: Option<f64>,
#[serde(rename = "InclusiveStartTime")]
pub inclusive_start_time: f64,
#[serde(rename = "KinesisConfiguration")]
pub kinesis_configuration: KinesisConfiguration,
#[serde(rename = "LedgerName")]
pub ledger_name: String,
#[serde(rename = "RoleArn")]
pub role_arn: String,
#[serde(rename = "StreamName")]
pub stream_name: String,
#[serde(rename = "Tags")]
#[serde(skip_serializing_if = "Option::is_none")]
pub tags: Option<::std::collections::HashMap<String, String>>,
}
#[derive(Clone, Debug, Default, Deserialize, PartialEq)]
#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
pub struct StreamJournalToKinesisResponse {
#[serde(rename = "StreamId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub stream_id: Option<String>,
}
#[derive(Clone, Debug, Default, PartialEq, Serialize)]
#[cfg_attr(feature = "deserialize_structs", derive(Deserialize))]
pub struct TagResourceRequest {
#[serde(rename = "ResourceArn")]
pub resource_arn: String,
#[serde(rename = "Tags")]
pub tags: ::std::collections::HashMap<String, String>,
}
#[derive(Clone, Debug, Default, Deserialize, PartialEq)]
#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
pub struct TagResourceResponse {}
#[derive(Clone, Debug, Default, PartialEq, Serialize)]
#[cfg_attr(feature = "deserialize_structs", derive(Deserialize))]
pub struct UntagResourceRequest {
#[serde(rename = "ResourceArn")]
pub resource_arn: String,
#[serde(rename = "TagKeys")]
pub tag_keys: Vec<String>,
}
#[derive(Clone, Debug, Default, Deserialize, PartialEq)]
#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
pub struct UntagResourceResponse {}
#[derive(Clone, Debug, Default, PartialEq, Serialize)]
#[cfg_attr(feature = "deserialize_structs", derive(Deserialize))]
pub struct UpdateLedgerRequest {
#[serde(rename = "DeletionProtection")]
#[serde(skip_serializing_if = "Option::is_none")]
pub deletion_protection: Option<bool>,
#[serde(rename = "Name")]
pub name: String,
}
#[derive(Clone, Debug, Default, Deserialize, PartialEq)]
#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
pub struct UpdateLedgerResponse {
#[serde(rename = "Arn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub arn: Option<String>,
#[serde(rename = "CreationDateTime")]
#[serde(skip_serializing_if = "Option::is_none")]
pub creation_date_time: Option<f64>,
#[serde(rename = "DeletionProtection")]
#[serde(skip_serializing_if = "Option::is_none")]
pub deletion_protection: Option<bool>,
#[serde(rename = "Name")]
#[serde(skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
#[serde(rename = "State")]
#[serde(skip_serializing_if = "Option::is_none")]
pub state: Option<String>,
}
#[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)]
pub struct ValueHolder {
#[serde(rename = "IonText")]
#[serde(skip_serializing_if = "Option::is_none")]
pub ion_text: Option<String>,
}
#[derive(Debug, PartialEq)]
pub enum CancelJournalKinesisStreamError {
InvalidParameter(String),
ResourceNotFound(String),
ResourcePreconditionNotMet(String),
}
impl CancelJournalKinesisStreamError {
pub fn from_response(
res: BufferedHttpResponse,
) -> RusotoError<CancelJournalKinesisStreamError> {
if let Some(err) = proto::json::Error::parse_rest(&res) {
match err.typ.as_str() {
"InvalidParameterException" => {
return RusotoError::Service(CancelJournalKinesisStreamError::InvalidParameter(
err.msg,
))
}
"ResourceNotFoundException" => {
return RusotoError::Service(CancelJournalKinesisStreamError::ResourceNotFound(
err.msg,
))
}
"ResourcePreconditionNotMetException" => {
return RusotoError::Service(
CancelJournalKinesisStreamError::ResourcePreconditionNotMet(err.msg),
)
}
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
RusotoError::Unknown(res)
}
}
impl fmt::Display for CancelJournalKinesisStreamError {
#[allow(unused_variables)]
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match *self {
CancelJournalKinesisStreamError::InvalidParameter(ref cause) => write!(f, "{}", cause),
CancelJournalKinesisStreamError::ResourceNotFound(ref cause) => write!(f, "{}", cause),
CancelJournalKinesisStreamError::ResourcePreconditionNotMet(ref cause) => {
write!(f, "{}", cause)
}
}
}
}
impl Error for CancelJournalKinesisStreamError {}
#[derive(Debug, PartialEq)]
pub enum CreateLedgerError {
InvalidParameter(String),
LimitExceeded(String),
ResourceAlreadyExists(String),
ResourceInUse(String),
}
impl CreateLedgerError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<CreateLedgerError> {
if let Some(err) = proto::json::Error::parse_rest(&res) {
match err.typ.as_str() {
"InvalidParameterException" => {
return RusotoError::Service(CreateLedgerError::InvalidParameter(err.msg))
}
"LimitExceededException" => {
return RusotoError::Service(CreateLedgerError::LimitExceeded(err.msg))
}
"ResourceAlreadyExistsException" => {
return RusotoError::Service(CreateLedgerError::ResourceAlreadyExists(err.msg))
}
"ResourceInUseException" => {
return RusotoError::Service(CreateLedgerError::ResourceInUse(err.msg))
}
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
RusotoError::Unknown(res)
}
}
impl fmt::Display for CreateLedgerError {
#[allow(unused_variables)]
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match *self {
CreateLedgerError::InvalidParameter(ref cause) => write!(f, "{}", cause),
CreateLedgerError::LimitExceeded(ref cause) => write!(f, "{}", cause),
CreateLedgerError::ResourceAlreadyExists(ref cause) => write!(f, "{}", cause),
CreateLedgerError::ResourceInUse(ref cause) => write!(f, "{}", cause),
}
}
}
impl Error for CreateLedgerError {}
#[derive(Debug, PartialEq)]
pub enum DeleteLedgerError {
InvalidParameter(String),
ResourceInUse(String),
ResourceNotFound(String),
ResourcePreconditionNotMet(String),
}
impl DeleteLedgerError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<DeleteLedgerError> {
if let Some(err) = proto::json::Error::parse_rest(&res) {
match err.typ.as_str() {
"InvalidParameterException" => {
return RusotoError::Service(DeleteLedgerError::InvalidParameter(err.msg))
}
"ResourceInUseException" => {
return RusotoError::Service(DeleteLedgerError::ResourceInUse(err.msg))
}
"ResourceNotFoundException" => {
return RusotoError::Service(DeleteLedgerError::ResourceNotFound(err.msg))
}
"ResourcePreconditionNotMetException" => {
return RusotoError::Service(DeleteLedgerError::ResourcePreconditionNotMet(
err.msg,
))
}
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
RusotoError::Unknown(res)
}
}
impl fmt::Display for DeleteLedgerError {
#[allow(unused_variables)]
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match *self {
DeleteLedgerError::InvalidParameter(ref cause) => write!(f, "{}", cause),
DeleteLedgerError::ResourceInUse(ref cause) => write!(f, "{}", cause),
DeleteLedgerError::ResourceNotFound(ref cause) => write!(f, "{}", cause),
DeleteLedgerError::ResourcePreconditionNotMet(ref cause) => write!(f, "{}", cause),
}
}
}
impl Error for DeleteLedgerError {}
#[derive(Debug, PartialEq)]
pub enum DescribeJournalKinesisStreamError {
InvalidParameter(String),
ResourceNotFound(String),
ResourcePreconditionNotMet(String),
}
impl DescribeJournalKinesisStreamError {
pub fn from_response(
res: BufferedHttpResponse,
) -> RusotoError<DescribeJournalKinesisStreamError> {
if let Some(err) = proto::json::Error::parse_rest(&res) {
match err.typ.as_str() {
"InvalidParameterException" => {
return RusotoError::Service(
DescribeJournalKinesisStreamError::InvalidParameter(err.msg),
)
}
"ResourceNotFoundException" => {
return RusotoError::Service(
DescribeJournalKinesisStreamError::ResourceNotFound(err.msg),
)
}
"ResourcePreconditionNotMetException" => {
return RusotoError::Service(
DescribeJournalKinesisStreamError::ResourcePreconditionNotMet(err.msg),
)
}
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
RusotoError::Unknown(res)
}
}
impl fmt::Display for DescribeJournalKinesisStreamError {
#[allow(unused_variables)]
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match *self {
DescribeJournalKinesisStreamError::InvalidParameter(ref cause) => {
write!(f, "{}", cause)
}
DescribeJournalKinesisStreamError::ResourceNotFound(ref cause) => {
write!(f, "{}", cause)
}
DescribeJournalKinesisStreamError::ResourcePreconditionNotMet(ref cause) => {
write!(f, "{}", cause)
}
}
}
}
impl Error for DescribeJournalKinesisStreamError {}
#[derive(Debug, PartialEq)]
pub enum DescribeJournalS3ExportError {
ResourceNotFound(String),
}
impl DescribeJournalS3ExportError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<DescribeJournalS3ExportError> {
if let Some(err) = proto::json::Error::parse_rest(&res) {
match err.typ.as_str() {
"ResourceNotFoundException" => {
return RusotoError::Service(DescribeJournalS3ExportError::ResourceNotFound(
err.msg,
))
}
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
RusotoError::Unknown(res)
}
}
impl fmt::Display for DescribeJournalS3ExportError {
#[allow(unused_variables)]
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match *self {
DescribeJournalS3ExportError::ResourceNotFound(ref cause) => write!(f, "{}", cause),
}
}
}
impl Error for DescribeJournalS3ExportError {}
#[derive(Debug, PartialEq)]
pub enum DescribeLedgerError {
InvalidParameter(String),
ResourceNotFound(String),
}
impl DescribeLedgerError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<DescribeLedgerError> {
if let Some(err) = proto::json::Error::parse_rest(&res) {
match err.typ.as_str() {
"InvalidParameterException" => {
return RusotoError::Service(DescribeLedgerError::InvalidParameter(err.msg))
}
"ResourceNotFoundException" => {
return RusotoError::Service(DescribeLedgerError::ResourceNotFound(err.msg))
}
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
RusotoError::Unknown(res)
}
}
impl fmt::Display for DescribeLedgerError {
#[allow(unused_variables)]
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match *self {
DescribeLedgerError::InvalidParameter(ref cause) => write!(f, "{}", cause),
DescribeLedgerError::ResourceNotFound(ref cause) => write!(f, "{}", cause),
}
}
}
impl Error for DescribeLedgerError {}
#[derive(Debug, PartialEq)]
pub enum ExportJournalToS3Error {
ResourceNotFound(String),
ResourcePreconditionNotMet(String),
}
impl ExportJournalToS3Error {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<ExportJournalToS3Error> {
if let Some(err) = proto::json::Error::parse_rest(&res) {
match err.typ.as_str() {
"ResourceNotFoundException" => {
return RusotoError::Service(ExportJournalToS3Error::ResourceNotFound(err.msg))
}
"ResourcePreconditionNotMetException" => {
return RusotoError::Service(
ExportJournalToS3Error::ResourcePreconditionNotMet(err.msg),
)
}
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
RusotoError::Unknown(res)
}
}
impl fmt::Display for ExportJournalToS3Error {
#[allow(unused_variables)]
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match *self {
ExportJournalToS3Error::ResourceNotFound(ref cause) => write!(f, "{}", cause),
ExportJournalToS3Error::ResourcePreconditionNotMet(ref cause) => write!(f, "{}", cause),
}
}
}
impl Error for ExportJournalToS3Error {}
#[derive(Debug, PartialEq)]
pub enum GetBlockError {
InvalidParameter(String),
ResourceNotFound(String),
ResourcePreconditionNotMet(String),
}
impl GetBlockError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<GetBlockError> {
if let Some(err) = proto::json::Error::parse_rest(&res) {
match err.typ.as_str() {
"InvalidParameterException" => {
return RusotoError::Service(GetBlockError::InvalidParameter(err.msg))
}
"ResourceNotFoundException" => {
return RusotoError::Service(GetBlockError::ResourceNotFound(err.msg))
}
"ResourcePreconditionNotMetException" => {
return RusotoError::Service(GetBlockError::ResourcePreconditionNotMet(err.msg))
}
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
RusotoError::Unknown(res)
}
}
impl fmt::Display for GetBlockError {
#[allow(unused_variables)]
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match *self {
GetBlockError::InvalidParameter(ref cause) => write!(f, "{}", cause),
GetBlockError::ResourceNotFound(ref cause) => write!(f, "{}", cause),
GetBlockError::ResourcePreconditionNotMet(ref cause) => write!(f, "{}", cause),
}
}
}
impl Error for GetBlockError {}
#[derive(Debug, PartialEq)]
pub enum GetDigestError {
InvalidParameter(String),
ResourceNotFound(String),
ResourcePreconditionNotMet(String),
}
impl GetDigestError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<GetDigestError> {
if let Some(err) = proto::json::Error::parse_rest(&res) {
match err.typ.as_str() {
"InvalidParameterException" => {
return RusotoError::Service(GetDigestError::InvalidParameter(err.msg))
}
"ResourceNotFoundException" => {
return RusotoError::Service(GetDigestError::ResourceNotFound(err.msg))
}
"ResourcePreconditionNotMetException" => {
return RusotoError::Service(GetDigestError::ResourcePreconditionNotMet(
err.msg,
))
}
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
RusotoError::Unknown(res)
}
}
impl fmt::Display for GetDigestError {
#[allow(unused_variables)]
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match *self {
GetDigestError::InvalidParameter(ref cause) => write!(f, "{}", cause),
GetDigestError::ResourceNotFound(ref cause) => write!(f, "{}", cause),
GetDigestError::ResourcePreconditionNotMet(ref cause) => write!(f, "{}", cause),
}
}
}
impl Error for GetDigestError {}
#[derive(Debug, PartialEq)]
pub enum GetRevisionError {
InvalidParameter(String),
ResourceNotFound(String),
ResourcePreconditionNotMet(String),
}
impl GetRevisionError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<GetRevisionError> {
if let Some(err) = proto::json::Error::parse_rest(&res) {
match err.typ.as_str() {
"InvalidParameterException" => {
return RusotoError::Service(GetRevisionError::InvalidParameter(err.msg))
}
"ResourceNotFoundException" => {
return RusotoError::Service(GetRevisionError::ResourceNotFound(err.msg))
}
"ResourcePreconditionNotMetException" => {
return RusotoError::Service(GetRevisionError::ResourcePreconditionNotMet(
err.msg,
))
}
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
RusotoError::Unknown(res)
}
}
impl fmt::Display for GetRevisionError {
#[allow(unused_variables)]
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match *self {
GetRevisionError::InvalidParameter(ref cause) => write!(f, "{}", cause),
GetRevisionError::ResourceNotFound(ref cause) => write!(f, "{}", cause),
GetRevisionError::ResourcePreconditionNotMet(ref cause) => write!(f, "{}", cause),
}
}
}
impl Error for GetRevisionError {}
#[derive(Debug, PartialEq)]
pub enum ListJournalKinesisStreamsForLedgerError {
InvalidParameter(String),
ResourceNotFound(String),
ResourcePreconditionNotMet(String),
}
impl ListJournalKinesisStreamsForLedgerError {
pub fn from_response(
res: BufferedHttpResponse,
) -> RusotoError<ListJournalKinesisStreamsForLedgerError> {
if let Some(err) = proto::json::Error::parse_rest(&res) {
match err.typ.as_str() {
"InvalidParameterException" => {
return RusotoError::Service(
ListJournalKinesisStreamsForLedgerError::InvalidParameter(err.msg),
)
}
"ResourceNotFoundException" => {
return RusotoError::Service(
ListJournalKinesisStreamsForLedgerError::ResourceNotFound(err.msg),
)
}
"ResourcePreconditionNotMetException" => {
return RusotoError::Service(
ListJournalKinesisStreamsForLedgerError::ResourcePreconditionNotMet(
err.msg,
),
)
}
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
RusotoError::Unknown(res)
}
}
impl fmt::Display for ListJournalKinesisStreamsForLedgerError {
#[allow(unused_variables)]
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match *self {
ListJournalKinesisStreamsForLedgerError::InvalidParameter(ref cause) => {
write!(f, "{}", cause)
}
ListJournalKinesisStreamsForLedgerError::ResourceNotFound(ref cause) => {
write!(f, "{}", cause)
}
ListJournalKinesisStreamsForLedgerError::ResourcePreconditionNotMet(ref cause) => {
write!(f, "{}", cause)
}
}
}
}
impl Error for ListJournalKinesisStreamsForLedgerError {}
#[derive(Debug, PartialEq)]
pub enum ListJournalS3ExportsError {}
impl ListJournalS3ExportsError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<ListJournalS3ExportsError> {
if let Some(err) = proto::json::Error::parse_rest(&res) {
match err.typ.as_str() {
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
RusotoError::Unknown(res)
}
}
impl fmt::Display for ListJournalS3ExportsError {
#[allow(unused_variables)]
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match *self {}
}
}
impl Error for ListJournalS3ExportsError {}
#[derive(Debug, PartialEq)]
pub enum ListJournalS3ExportsForLedgerError {}
impl ListJournalS3ExportsForLedgerError {
pub fn from_response(
res: BufferedHttpResponse,
) -> RusotoError<ListJournalS3ExportsForLedgerError> {
if let Some(err) = proto::json::Error::parse_rest(&res) {
match err.typ.as_str() {
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
RusotoError::Unknown(res)
}
}
impl fmt::Display for ListJournalS3ExportsForLedgerError {
#[allow(unused_variables)]
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match *self {}
}
}
impl Error for ListJournalS3ExportsForLedgerError {}
#[derive(Debug, PartialEq)]
pub enum ListLedgersError {}
impl ListLedgersError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<ListLedgersError> {
if let Some(err) = proto::json::Error::parse_rest(&res) {
match err.typ.as_str() {
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
RusotoError::Unknown(res)
}
}
impl fmt::Display for ListLedgersError {
#[allow(unused_variables)]
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match *self {}
}
}
impl Error for ListLedgersError {}
#[derive(Debug, PartialEq)]
pub enum ListTagsForResourceError {
InvalidParameter(String),
ResourceNotFound(String),
}
impl ListTagsForResourceError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<ListTagsForResourceError> {
if let Some(err) = proto::json::Error::parse_rest(&res) {
match err.typ.as_str() {
"InvalidParameterException" => {
return RusotoError::Service(ListTagsForResourceError::InvalidParameter(
err.msg,
))
}
"ResourceNotFoundException" => {
return RusotoError::Service(ListTagsForResourceError::ResourceNotFound(
err.msg,
))
}
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
RusotoError::Unknown(res)
}
}
impl fmt::Display for ListTagsForResourceError {
#[allow(unused_variables)]
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match *self {
ListTagsForResourceError::InvalidParameter(ref cause) => write!(f, "{}", cause),
ListTagsForResourceError::ResourceNotFound(ref cause) => write!(f, "{}", cause),
}
}
}
impl Error for ListTagsForResourceError {}
#[derive(Debug, PartialEq)]
pub enum StreamJournalToKinesisError {
InvalidParameter(String),
ResourceNotFound(String),
ResourcePreconditionNotMet(String),
}
impl StreamJournalToKinesisError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<StreamJournalToKinesisError> {
if let Some(err) = proto::json::Error::parse_rest(&res) {
match err.typ.as_str() {
"InvalidParameterException" => {
return RusotoError::Service(StreamJournalToKinesisError::InvalidParameter(
err.msg,
))
}
"ResourceNotFoundException" => {
return RusotoError::Service(StreamJournalToKinesisError::ResourceNotFound(
err.msg,
))
}
"ResourcePreconditionNotMetException" => {
return RusotoError::Service(
StreamJournalToKinesisError::ResourcePreconditionNotMet(err.msg),
)
}
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
RusotoError::Unknown(res)
}
}
impl fmt::Display for StreamJournalToKinesisError {
#[allow(unused_variables)]
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match *self {
StreamJournalToKinesisError::InvalidParameter(ref cause) => write!(f, "{}", cause),
StreamJournalToKinesisError::ResourceNotFound(ref cause) => write!(f, "{}", cause),
StreamJournalToKinesisError::ResourcePreconditionNotMet(ref cause) => {
write!(f, "{}", cause)
}
}
}
}
impl Error for StreamJournalToKinesisError {}
#[derive(Debug, PartialEq)]
pub enum TagResourceError {
InvalidParameter(String),
ResourceNotFound(String),
}
impl TagResourceError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<TagResourceError> {
if let Some(err) = proto::json::Error::parse_rest(&res) {
match err.typ.as_str() {
"InvalidParameterException" => {
return RusotoError::Service(TagResourceError::InvalidParameter(err.msg))
}
"ResourceNotFoundException" => {
return RusotoError::Service(TagResourceError::ResourceNotFound(err.msg))
}
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
RusotoError::Unknown(res)
}
}
impl fmt::Display for TagResourceError {
#[allow(unused_variables)]
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match *self {
TagResourceError::InvalidParameter(ref cause) => write!(f, "{}", cause),
TagResourceError::ResourceNotFound(ref cause) => write!(f, "{}", cause),
}
}
}
impl Error for TagResourceError {}
#[derive(Debug, PartialEq)]
pub enum UntagResourceError {
InvalidParameter(String),
ResourceNotFound(String),
}
impl UntagResourceError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<UntagResourceError> {
if let Some(err) = proto::json::Error::parse_rest(&res) {
match err.typ.as_str() {
"InvalidParameterException" => {
return RusotoError::Service(UntagResourceError::InvalidParameter(err.msg))
}
"ResourceNotFoundException" => {
return RusotoError::Service(UntagResourceError::ResourceNotFound(err.msg))
}
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
RusotoError::Unknown(res)
}
}
impl fmt::Display for UntagResourceError {
#[allow(unused_variables)]
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match *self {
UntagResourceError::InvalidParameter(ref cause) => write!(f, "{}", cause),
UntagResourceError::ResourceNotFound(ref cause) => write!(f, "{}", cause),
}
}
}
impl Error for UntagResourceError {}
#[derive(Debug, PartialEq)]
pub enum UpdateLedgerError {
InvalidParameter(String),
ResourceNotFound(String),
}
impl UpdateLedgerError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<UpdateLedgerError> {
if let Some(err) = proto::json::Error::parse_rest(&res) {
match err.typ.as_str() {
"InvalidParameterException" => {
return RusotoError::Service(UpdateLedgerError::InvalidParameter(err.msg))
}
"ResourceNotFoundException" => {
return RusotoError::Service(UpdateLedgerError::ResourceNotFound(err.msg))
}
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
RusotoError::Unknown(res)
}
}
impl fmt::Display for UpdateLedgerError {
#[allow(unused_variables)]
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match *self {
UpdateLedgerError::InvalidParameter(ref cause) => write!(f, "{}", cause),
UpdateLedgerError::ResourceNotFound(ref cause) => write!(f, "{}", cause),
}
}
}
impl Error for UpdateLedgerError {}
#[async_trait]
pub trait Qldb {
async fn cancel_journal_kinesis_stream(
&self,
input: CancelJournalKinesisStreamRequest,
) -> Result<CancelJournalKinesisStreamResponse, RusotoError<CancelJournalKinesisStreamError>>;
async fn create_ledger(
&self,
input: CreateLedgerRequest,
) -> Result<CreateLedgerResponse, RusotoError<CreateLedgerError>>;
async fn delete_ledger(
&self,
input: DeleteLedgerRequest,
) -> Result<(), RusotoError<DeleteLedgerError>>;
async fn describe_journal_kinesis_stream(
&self,
input: DescribeJournalKinesisStreamRequest,
) -> Result<DescribeJournalKinesisStreamResponse, RusotoError<DescribeJournalKinesisStreamError>>;
async fn describe_journal_s3_export(
&self,
input: DescribeJournalS3ExportRequest,
) -> Result<DescribeJournalS3ExportResponse, RusotoError<DescribeJournalS3ExportError>>;
async fn describe_ledger(
&self,
input: DescribeLedgerRequest,
) -> Result<DescribeLedgerResponse, RusotoError<DescribeLedgerError>>;
async fn export_journal_to_s3(
&self,
input: ExportJournalToS3Request,
) -> Result<ExportJournalToS3Response, RusotoError<ExportJournalToS3Error>>;
async fn get_block(
&self,
input: GetBlockRequest,
) -> Result<GetBlockResponse, RusotoError<GetBlockError>>;
async fn get_digest(
&self,
input: GetDigestRequest,
) -> Result<GetDigestResponse, RusotoError<GetDigestError>>;
async fn get_revision(
&self,
input: GetRevisionRequest,
) -> Result<GetRevisionResponse, RusotoError<GetRevisionError>>;
async fn list_journal_kinesis_streams_for_ledger(
&self,
input: ListJournalKinesisStreamsForLedgerRequest,
) -> Result<
ListJournalKinesisStreamsForLedgerResponse,
RusotoError<ListJournalKinesisStreamsForLedgerError>,
>;
async fn list_journal_s3_exports(
&self,
input: ListJournalS3ExportsRequest,
) -> Result<ListJournalS3ExportsResponse, RusotoError<ListJournalS3ExportsError>>;
async fn list_journal_s3_exports_for_ledger(
&self,
input: ListJournalS3ExportsForLedgerRequest,
) -> Result<
ListJournalS3ExportsForLedgerResponse,
RusotoError<ListJournalS3ExportsForLedgerError>,
>;
async fn list_ledgers(
&self,
input: ListLedgersRequest,
) -> Result<ListLedgersResponse, RusotoError<ListLedgersError>>;
async fn list_tags_for_resource(
&self,
input: ListTagsForResourceRequest,
) -> Result<ListTagsForResourceResponse, RusotoError<ListTagsForResourceError>>;
async fn stream_journal_to_kinesis(
&self,
input: StreamJournalToKinesisRequest,
) -> Result<StreamJournalToKinesisResponse, RusotoError<StreamJournalToKinesisError>>;
async fn tag_resource(
&self,
input: TagResourceRequest,
) -> Result<TagResourceResponse, RusotoError<TagResourceError>>;
async fn untag_resource(
&self,
input: UntagResourceRequest,
) -> Result<UntagResourceResponse, RusotoError<UntagResourceError>>;
async fn update_ledger(
&self,
input: UpdateLedgerRequest,
) -> Result<UpdateLedgerResponse, RusotoError<UpdateLedgerError>>;
}
#[derive(Clone)]
pub struct QldbClient {
client: Client,
region: region::Region,
}
impl QldbClient {
pub fn new(region: region::Region) -> QldbClient {
QldbClient {
client: Client::shared(),
region,
}
}
pub fn new_with<P, D>(
request_dispatcher: D,
credentials_provider: P,
region: region::Region,
) -> QldbClient
where
P: ProvideAwsCredentials + Send + Sync + 'static,
D: DispatchSignedRequest + Send + Sync + 'static,
{
QldbClient {
client: Client::new_with(credentials_provider, request_dispatcher),
region,
}
}
pub fn new_with_client(client: Client, region: region::Region) -> QldbClient {
QldbClient { client, region }
}
}
#[async_trait]
impl Qldb for QldbClient {
#[allow(unused_mut)]
async fn cancel_journal_kinesis_stream(
&self,
input: CancelJournalKinesisStreamRequest,
) -> Result<CancelJournalKinesisStreamResponse, RusotoError<CancelJournalKinesisStreamError>>
{
let request_uri = format!(
"/ledgers/{name}/journal-kinesis-streams/{stream_id}",
name = input.ledger_name,
stream_id = input.stream_id
);
let mut request = SignedRequest::new("DELETE", "qldb", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
let mut response = self
.client
.sign_and_dispatch(request)
.await
.map_err(RusotoError::from)?;
if response.status.is_success() {
let mut response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
let result = proto::json::ResponsePayload::new(&response)
.deserialize::<CancelJournalKinesisStreamResponse, _>()?;
Ok(result)
} else {
let response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
Err(CancelJournalKinesisStreamError::from_response(response))
}
}
#[allow(unused_mut)]
async fn create_ledger(
&self,
input: CreateLedgerRequest,
) -> Result<CreateLedgerResponse, RusotoError<CreateLedgerError>> {
let request_uri = "/ledgers";
let mut request = SignedRequest::new("POST", "qldb", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
let mut response = self
.client
.sign_and_dispatch(request)
.await
.map_err(RusotoError::from)?;
if response.status.is_success() {
let mut response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
let result = proto::json::ResponsePayload::new(&response)
.deserialize::<CreateLedgerResponse, _>()?;
Ok(result)
} else {
let response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
Err(CreateLedgerError::from_response(response))
}
}
#[allow(unused_mut)]
async fn delete_ledger(
&self,
input: DeleteLedgerRequest,
) -> Result<(), RusotoError<DeleteLedgerError>> {
let request_uri = format!("/ledgers/{name}", name = input.name);
let mut request = SignedRequest::new("DELETE", "qldb", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
let mut response = self
.client
.sign_and_dispatch(request)
.await
.map_err(RusotoError::from)?;
if response.status.is_success() {
let mut response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
let result = ::std::mem::drop(response);
Ok(result)
} else {
let response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
Err(DeleteLedgerError::from_response(response))
}
}
#[allow(unused_mut)]
async fn describe_journal_kinesis_stream(
&self,
input: DescribeJournalKinesisStreamRequest,
) -> Result<DescribeJournalKinesisStreamResponse, RusotoError<DescribeJournalKinesisStreamError>>
{
let request_uri = format!(
"/ledgers/{name}/journal-kinesis-streams/{stream_id}",
name = input.ledger_name,
stream_id = input.stream_id
);
let mut request = SignedRequest::new("GET", "qldb", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
let mut response = self
.client
.sign_and_dispatch(request)
.await
.map_err(RusotoError::from)?;
if response.status.is_success() {
let mut response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
let result = proto::json::ResponsePayload::new(&response)
.deserialize::<DescribeJournalKinesisStreamResponse, _>()?;
Ok(result)
} else {
let response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
Err(DescribeJournalKinesisStreamError::from_response(response))
}
}
#[allow(unused_mut)]
async fn describe_journal_s3_export(
&self,
input: DescribeJournalS3ExportRequest,
) -> Result<DescribeJournalS3ExportResponse, RusotoError<DescribeJournalS3ExportError>> {
let request_uri = format!(
"/ledgers/{name}/journal-s3-exports/{export_id}",
export_id = input.export_id,
name = input.name
);
let mut request = SignedRequest::new("GET", "qldb", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
let mut response = self
.client
.sign_and_dispatch(request)
.await
.map_err(RusotoError::from)?;
if response.status.is_success() {
let mut response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
let result = proto::json::ResponsePayload::new(&response)
.deserialize::<DescribeJournalS3ExportResponse, _>()?;
Ok(result)
} else {
let response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
Err(DescribeJournalS3ExportError::from_response(response))
}
}
#[allow(unused_mut)]
async fn describe_ledger(
&self,
input: DescribeLedgerRequest,
) -> Result<DescribeLedgerResponse, RusotoError<DescribeLedgerError>> {
let request_uri = format!("/ledgers/{name}", name = input.name);
let mut request = SignedRequest::new("GET", "qldb", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
let mut response = self
.client
.sign_and_dispatch(request)
.await
.map_err(RusotoError::from)?;
if response.status.is_success() {
let mut response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
let result = proto::json::ResponsePayload::new(&response)
.deserialize::<DescribeLedgerResponse, _>()?;
Ok(result)
} else {
let response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
Err(DescribeLedgerError::from_response(response))
}
}
#[allow(unused_mut)]
async fn export_journal_to_s3(
&self,
input: ExportJournalToS3Request,
) -> Result<ExportJournalToS3Response, RusotoError<ExportJournalToS3Error>> {
let request_uri = format!("/ledgers/{name}/journal-s3-exports", name = input.name);
let mut request = SignedRequest::new("POST", "qldb", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
let mut response = self
.client
.sign_and_dispatch(request)
.await
.map_err(RusotoError::from)?;
if response.status.is_success() {
let mut response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
let result = proto::json::ResponsePayload::new(&response)
.deserialize::<ExportJournalToS3Response, _>()?;
Ok(result)
} else {
let response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
Err(ExportJournalToS3Error::from_response(response))
}
}
#[allow(unused_mut)]
async fn get_block(
&self,
input: GetBlockRequest,
) -> Result<GetBlockResponse, RusotoError<GetBlockError>> {
let request_uri = format!("/ledgers/{name}/block", name = input.name);
let mut request = SignedRequest::new("POST", "qldb", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
let mut response = self
.client
.sign_and_dispatch(request)
.await
.map_err(RusotoError::from)?;
if response.status.is_success() {
let mut response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
let result = proto::json::ResponsePayload::new(&response)
.deserialize::<GetBlockResponse, _>()?;
Ok(result)
} else {
let response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
Err(GetBlockError::from_response(response))
}
}
#[allow(unused_mut)]
async fn get_digest(
&self,
input: GetDigestRequest,
) -> Result<GetDigestResponse, RusotoError<GetDigestError>> {
let request_uri = format!("/ledgers/{name}/digest", name = input.name);
let mut request = SignedRequest::new("POST", "qldb", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
let mut response = self
.client
.sign_and_dispatch(request)
.await
.map_err(RusotoError::from)?;
if response.status.is_success() {
let mut response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
let result = proto::json::ResponsePayload::new(&response)
.deserialize::<GetDigestResponse, _>()?;
Ok(result)
} else {
let response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
Err(GetDigestError::from_response(response))
}
}
#[allow(unused_mut)]
async fn get_revision(
&self,
input: GetRevisionRequest,
) -> Result<GetRevisionResponse, RusotoError<GetRevisionError>> {
let request_uri = format!("/ledgers/{name}/revision", name = input.name);
let mut request = SignedRequest::new("POST", "qldb", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
let mut response = self
.client
.sign_and_dispatch(request)
.await
.map_err(RusotoError::from)?;
if response.status.is_success() {
let mut response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
let result = proto::json::ResponsePayload::new(&response)
.deserialize::<GetRevisionResponse, _>()?;
Ok(result)
} else {
let response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
Err(GetRevisionError::from_response(response))
}
}
#[allow(unused_mut)]
async fn list_journal_kinesis_streams_for_ledger(
&self,
input: ListJournalKinesisStreamsForLedgerRequest,
) -> Result<
ListJournalKinesisStreamsForLedgerResponse,
RusotoError<ListJournalKinesisStreamsForLedgerError>,
> {
let request_uri = format!(
"/ledgers/{name}/journal-kinesis-streams",
name = input.ledger_name
);
let mut request = SignedRequest::new("GET", "qldb", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
let mut params = Params::new();
if let Some(ref x) = input.max_results {
params.put("max_results", x);
}
if let Some(ref x) = input.next_token {
params.put("next_token", x);
}
request.set_params(params);
let mut response = self
.client
.sign_and_dispatch(request)
.await
.map_err(RusotoError::from)?;
if response.status.is_success() {
let mut response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
let result = proto::json::ResponsePayload::new(&response)
.deserialize::<ListJournalKinesisStreamsForLedgerResponse, _>()?;
Ok(result)
} else {
let response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
Err(ListJournalKinesisStreamsForLedgerError::from_response(
response,
))
}
}
#[allow(unused_mut)]
async fn list_journal_s3_exports(
&self,
input: ListJournalS3ExportsRequest,
) -> Result<ListJournalS3ExportsResponse, RusotoError<ListJournalS3ExportsError>> {
let request_uri = "/journal-s3-exports";
let mut request = SignedRequest::new("GET", "qldb", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
let mut params = Params::new();
if let Some(ref x) = input.max_results {
params.put("max_results", x);
}
if let Some(ref x) = input.next_token {
params.put("next_token", x);
}
request.set_params(params);
let mut response = self
.client
.sign_and_dispatch(request)
.await
.map_err(RusotoError::from)?;
if response.status.is_success() {
let mut response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
let result = proto::json::ResponsePayload::new(&response)
.deserialize::<ListJournalS3ExportsResponse, _>()?;
Ok(result)
} else {
let response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
Err(ListJournalS3ExportsError::from_response(response))
}
}
#[allow(unused_mut)]
async fn list_journal_s3_exports_for_ledger(
&self,
input: ListJournalS3ExportsForLedgerRequest,
) -> Result<
ListJournalS3ExportsForLedgerResponse,
RusotoError<ListJournalS3ExportsForLedgerError>,
> {
let request_uri = format!("/ledgers/{name}/journal-s3-exports", name = input.name);
let mut request = SignedRequest::new("GET", "qldb", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
let mut params = Params::new();
if let Some(ref x) = input.max_results {
params.put("max_results", x);
}
if let Some(ref x) = input.next_token {
params.put("next_token", x);
}
request.set_params(params);
let mut response = self
.client
.sign_and_dispatch(request)
.await
.map_err(RusotoError::from)?;
if response.status.is_success() {
let mut response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
let result = proto::json::ResponsePayload::new(&response)
.deserialize::<ListJournalS3ExportsForLedgerResponse, _>()?;
Ok(result)
} else {
let response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
Err(ListJournalS3ExportsForLedgerError::from_response(response))
}
}
#[allow(unused_mut)]
async fn list_ledgers(
&self,
input: ListLedgersRequest,
) -> Result<ListLedgersResponse, RusotoError<ListLedgersError>> {
let request_uri = "/ledgers";
let mut request = SignedRequest::new("GET", "qldb", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
let mut params = Params::new();
if let Some(ref x) = input.max_results {
params.put("max_results", x);
}
if let Some(ref x) = input.next_token {
params.put("next_token", x);
}
request.set_params(params);
let mut response = self
.client
.sign_and_dispatch(request)
.await
.map_err(RusotoError::from)?;
if response.status.is_success() {
let mut response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
let result = proto::json::ResponsePayload::new(&response)
.deserialize::<ListLedgersResponse, _>()?;
Ok(result)
} else {
let response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
Err(ListLedgersError::from_response(response))
}
}
#[allow(unused_mut)]
async fn list_tags_for_resource(
&self,
input: ListTagsForResourceRequest,
) -> Result<ListTagsForResourceResponse, RusotoError<ListTagsForResourceError>> {
let request_uri = format!("/tags/{resource_arn}", resource_arn = input.resource_arn);
let mut request = SignedRequest::new("GET", "qldb", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
let mut response = self
.client
.sign_and_dispatch(request)
.await
.map_err(RusotoError::from)?;
if response.status.is_success() {
let mut response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
let result = proto::json::ResponsePayload::new(&response)
.deserialize::<ListTagsForResourceResponse, _>()?;
Ok(result)
} else {
let response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
Err(ListTagsForResourceError::from_response(response))
}
}
#[allow(unused_mut)]
async fn stream_journal_to_kinesis(
&self,
input: StreamJournalToKinesisRequest,
) -> Result<StreamJournalToKinesisResponse, RusotoError<StreamJournalToKinesisError>> {
let request_uri = format!(
"/ledgers/{name}/journal-kinesis-streams",
name = input.ledger_name
);
let mut request = SignedRequest::new("POST", "qldb", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
let mut response = self
.client
.sign_and_dispatch(request)
.await
.map_err(RusotoError::from)?;
if response.status.is_success() {
let mut response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
let result = proto::json::ResponsePayload::new(&response)
.deserialize::<StreamJournalToKinesisResponse, _>()?;
Ok(result)
} else {
let response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
Err(StreamJournalToKinesisError::from_response(response))
}
}
#[allow(unused_mut)]
async fn tag_resource(
&self,
input: TagResourceRequest,
) -> Result<TagResourceResponse, RusotoError<TagResourceError>> {
let request_uri = format!("/tags/{resource_arn}", resource_arn = input.resource_arn);
let mut request = SignedRequest::new("POST", "qldb", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
let mut response = self
.client
.sign_and_dispatch(request)
.await
.map_err(RusotoError::from)?;
if response.status.is_success() {
let mut response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
let result = proto::json::ResponsePayload::new(&response)
.deserialize::<TagResourceResponse, _>()?;
Ok(result)
} else {
let response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
Err(TagResourceError::from_response(response))
}
}
#[allow(unused_mut)]
async fn untag_resource(
&self,
input: UntagResourceRequest,
) -> Result<UntagResourceResponse, RusotoError<UntagResourceError>> {
let request_uri = format!("/tags/{resource_arn}", resource_arn = input.resource_arn);
let mut request = SignedRequest::new("DELETE", "qldb", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
let mut params = Params::new();
for item in input.tag_keys.iter() {
params.put("tagKeys", item);
}
request.set_params(params);
let mut response = self
.client
.sign_and_dispatch(request)
.await
.map_err(RusotoError::from)?;
if response.status.is_success() {
let mut response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
let result = proto::json::ResponsePayload::new(&response)
.deserialize::<UntagResourceResponse, _>()?;
Ok(result)
} else {
let response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
Err(UntagResourceError::from_response(response))
}
}
#[allow(unused_mut)]
async fn update_ledger(
&self,
input: UpdateLedgerRequest,
) -> Result<UpdateLedgerResponse, RusotoError<UpdateLedgerError>> {
let request_uri = format!("/ledgers/{name}", name = input.name);
let mut request = SignedRequest::new("PATCH", "qldb", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
let mut response = self
.client
.sign_and_dispatch(request)
.await
.map_err(RusotoError::from)?;
if response.status.is_success() {
let mut response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
let result = proto::json::ResponsePayload::new(&response)
.deserialize::<UpdateLedgerResponse, _>()?;
Ok(result)
} else {
let response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
Err(UpdateLedgerError::from_response(response))
}
}
}