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 AddTagsToResourceRequest {
#[serde(rename = "ResourceArn")]
pub resource_arn: String,
#[serde(rename = "TagList")]
pub tag_list: Vec<Tag>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct AddTagsToResourceResponse {
#[serde(rename = "Status")]
pub status: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct CreateHapgRequest {
#[serde(rename = "Label")]
pub label: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct CreateHapgResponse {
#[serde(rename = "HapgArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub hapg_arn: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct CreateHsmRequest {
#[serde(rename = "ClientToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub client_token: Option<String>,
#[serde(rename = "EniIp")]
#[serde(skip_serializing_if = "Option::is_none")]
pub eni_ip: Option<String>,
#[serde(rename = "ExternalId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub external_id: Option<String>,
#[serde(rename = "IamRoleArn")]
pub iam_role_arn: String,
#[serde(rename = "SshKey")]
pub ssh_key: String,
#[serde(rename = "SubnetId")]
pub subnet_id: String,
#[serde(rename = "SubscriptionType")]
pub subscription_type: String,
#[serde(rename = "SyslogIp")]
#[serde(skip_serializing_if = "Option::is_none")]
pub syslog_ip: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct CreateHsmResponse {
#[serde(rename = "HsmArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub hsm_arn: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct CreateLunaClientRequest {
#[serde(rename = "Certificate")]
pub certificate: String,
#[serde(rename = "Label")]
#[serde(skip_serializing_if = "Option::is_none")]
pub label: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct CreateLunaClientResponse {
#[serde(rename = "ClientArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub client_arn: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DeleteHapgRequest {
#[serde(rename = "HapgArn")]
pub hapg_arn: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DeleteHapgResponse {
#[serde(rename = "Status")]
pub status: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DeleteHsmRequest {
#[serde(rename = "HsmArn")]
pub hsm_arn: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DeleteHsmResponse {
#[serde(rename = "Status")]
pub status: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DeleteLunaClientRequest {
#[serde(rename = "ClientArn")]
pub client_arn: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DeleteLunaClientResponse {
#[serde(rename = "Status")]
pub status: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DescribeHapgRequest {
#[serde(rename = "HapgArn")]
pub hapg_arn: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DescribeHapgResponse {
#[serde(rename = "HapgArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub hapg_arn: Option<String>,
#[serde(rename = "HapgSerial")]
#[serde(skip_serializing_if = "Option::is_none")]
pub hapg_serial: Option<String>,
#[serde(rename = "HsmsLastActionFailed")]
#[serde(skip_serializing_if = "Option::is_none")]
pub hsms_last_action_failed: Option<Vec<String>>,
#[serde(rename = "HsmsPendingDeletion")]
#[serde(skip_serializing_if = "Option::is_none")]
pub hsms_pending_deletion: Option<Vec<String>>,
#[serde(rename = "HsmsPendingRegistration")]
#[serde(skip_serializing_if = "Option::is_none")]
pub hsms_pending_registration: Option<Vec<String>>,
#[serde(rename = "Label")]
#[serde(skip_serializing_if = "Option::is_none")]
pub label: Option<String>,
#[serde(rename = "LastModifiedTimestamp")]
#[serde(skip_serializing_if = "Option::is_none")]
pub last_modified_timestamp: Option<String>,
#[serde(rename = "PartitionSerialList")]
#[serde(skip_serializing_if = "Option::is_none")]
pub partition_serial_list: Option<Vec<String>>,
#[serde(rename = "State")]
#[serde(skip_serializing_if = "Option::is_none")]
pub state: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DescribeHsmRequest {
#[serde(rename = "HsmArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub hsm_arn: Option<String>,
#[serde(rename = "HsmSerialNumber")]
#[serde(skip_serializing_if = "Option::is_none")]
pub hsm_serial_number: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DescribeHsmResponse {
#[serde(rename = "AvailabilityZone")]
#[serde(skip_serializing_if = "Option::is_none")]
pub availability_zone: Option<String>,
#[serde(rename = "EniId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub eni_id: Option<String>,
#[serde(rename = "EniIp")]
#[serde(skip_serializing_if = "Option::is_none")]
pub eni_ip: Option<String>,
#[serde(rename = "HsmArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub hsm_arn: Option<String>,
#[serde(rename = "HsmType")]
#[serde(skip_serializing_if = "Option::is_none")]
pub hsm_type: Option<String>,
#[serde(rename = "IamRoleArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub iam_role_arn: Option<String>,
#[serde(rename = "Partitions")]
#[serde(skip_serializing_if = "Option::is_none")]
pub partitions: Option<Vec<String>>,
#[serde(rename = "SerialNumber")]
#[serde(skip_serializing_if = "Option::is_none")]
pub serial_number: Option<String>,
#[serde(rename = "ServerCertLastUpdated")]
#[serde(skip_serializing_if = "Option::is_none")]
pub server_cert_last_updated: Option<String>,
#[serde(rename = "ServerCertUri")]
#[serde(skip_serializing_if = "Option::is_none")]
pub server_cert_uri: Option<String>,
#[serde(rename = "SoftwareVersion")]
#[serde(skip_serializing_if = "Option::is_none")]
pub software_version: Option<String>,
#[serde(rename = "SshKeyLastUpdated")]
#[serde(skip_serializing_if = "Option::is_none")]
pub ssh_key_last_updated: Option<String>,
#[serde(rename = "SshPublicKey")]
#[serde(skip_serializing_if = "Option::is_none")]
pub ssh_public_key: Option<String>,
#[serde(rename = "Status")]
#[serde(skip_serializing_if = "Option::is_none")]
pub status: Option<String>,
#[serde(rename = "StatusDetails")]
#[serde(skip_serializing_if = "Option::is_none")]
pub status_details: Option<String>,
#[serde(rename = "SubnetId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub subnet_id: Option<String>,
#[serde(rename = "SubscriptionEndDate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub subscription_end_date: Option<String>,
#[serde(rename = "SubscriptionStartDate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub subscription_start_date: Option<String>,
#[serde(rename = "SubscriptionType")]
#[serde(skip_serializing_if = "Option::is_none")]
pub subscription_type: Option<String>,
#[serde(rename = "VendorName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub vendor_name: Option<String>,
#[serde(rename = "VpcId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub vpc_id: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DescribeLunaClientRequest {
#[serde(rename = "CertificateFingerprint")]
#[serde(skip_serializing_if = "Option::is_none")]
pub certificate_fingerprint: Option<String>,
#[serde(rename = "ClientArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub client_arn: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DescribeLunaClientResponse {
#[serde(rename = "Certificate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub certificate: Option<String>,
#[serde(rename = "CertificateFingerprint")]
#[serde(skip_serializing_if = "Option::is_none")]
pub certificate_fingerprint: Option<String>,
#[serde(rename = "ClientArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub client_arn: Option<String>,
#[serde(rename = "Label")]
#[serde(skip_serializing_if = "Option::is_none")]
pub label: Option<String>,
#[serde(rename = "LastModifiedTimestamp")]
#[serde(skip_serializing_if = "Option::is_none")]
pub last_modified_timestamp: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetConfigRequest {
#[serde(rename = "ClientArn")]
pub client_arn: String,
#[serde(rename = "ClientVersion")]
pub client_version: String,
#[serde(rename = "HapgList")]
pub hapg_list: Vec<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct GetConfigResponse {
#[serde(rename = "ConfigCred")]
#[serde(skip_serializing_if = "Option::is_none")]
pub config_cred: Option<String>,
#[serde(rename = "ConfigFile")]
#[serde(skip_serializing_if = "Option::is_none")]
pub config_file: Option<String>,
#[serde(rename = "ConfigType")]
#[serde(skip_serializing_if = "Option::is_none")]
pub config_type: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ListAvailableZonesRequest {}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ListAvailableZonesResponse {
#[serde(rename = "AZList")]
#[serde(skip_serializing_if = "Option::is_none")]
pub az_list: Option<Vec<String>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ListHapgsRequest {
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ListHapgsResponse {
#[serde(rename = "HapgList")]
pub hapg_list: 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 ListHsmsRequest {
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ListHsmsResponse {
#[serde(rename = "HsmList")]
#[serde(skip_serializing_if = "Option::is_none")]
pub hsm_list: 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 ListLunaClientsRequest {
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ListLunaClientsResponse {
#[serde(rename = "ClientList")]
pub client_list: 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 ListTagsForResourceRequest {
#[serde(rename = "ResourceArn")]
pub resource_arn: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ListTagsForResourceResponse {
#[serde(rename = "TagList")]
pub tag_list: Vec<Tag>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ModifyHapgRequest {
#[serde(rename = "HapgArn")]
pub hapg_arn: String,
#[serde(rename = "Label")]
#[serde(skip_serializing_if = "Option::is_none")]
pub label: Option<String>,
#[serde(rename = "PartitionSerialList")]
#[serde(skip_serializing_if = "Option::is_none")]
pub partition_serial_list: Option<Vec<String>>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ModifyHapgResponse {
#[serde(rename = "HapgArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub hapg_arn: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ModifyHsmRequest {
#[serde(rename = "EniIp")]
#[serde(skip_serializing_if = "Option::is_none")]
pub eni_ip: Option<String>,
#[serde(rename = "ExternalId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub external_id: Option<String>,
#[serde(rename = "HsmArn")]
pub hsm_arn: String,
#[serde(rename = "IamRoleArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub iam_role_arn: Option<String>,
#[serde(rename = "SubnetId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub subnet_id: Option<String>,
#[serde(rename = "SyslogIp")]
#[serde(skip_serializing_if = "Option::is_none")]
pub syslog_ip: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ModifyHsmResponse {
#[serde(rename = "HsmArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub hsm_arn: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ModifyLunaClientRequest {
#[serde(rename = "Certificate")]
pub certificate: String,
#[serde(rename = "ClientArn")]
pub client_arn: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ModifyLunaClientResponse {
#[serde(rename = "ClientArn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub client_arn: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct RemoveTagsFromResourceRequest {
#[serde(rename = "ResourceArn")]
pub resource_arn: String,
#[serde(rename = "TagKeyList")]
pub tag_key_list: Vec<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct RemoveTagsFromResourceResponse {
#[serde(rename = "Status")]
pub status: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct Tag {
#[serde(rename = "Key")]
pub key: String,
#[serde(rename = "Value")]
pub value: String,
}
#[derive(Debug, PartialEq)]
pub enum AddTagsToResourceError {
CloudHsmInternal(String),
CloudHsmService(String),
InvalidRequest(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl AddTagsToResourceError {
pub fn from_response(res: BufferedHttpResponse) -> AddTagsToResourceError {
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 {
"CloudHsmInternalException" => {
return AddTagsToResourceError::CloudHsmInternal(String::from(error_message));
}
"CloudHsmServiceException" => {
return AddTagsToResourceError::CloudHsmService(String::from(error_message));
}
"InvalidRequestException" => {
return AddTagsToResourceError::InvalidRequest(String::from(error_message));
}
"ValidationException" => {
return AddTagsToResourceError::Validation(error_message.to_string());
}
_ => {}
}
}
return AddTagsToResourceError::Unknown(res);
}
}
impl From<serde_json::error::Error> for AddTagsToResourceError {
fn from(err: serde_json::error::Error) -> AddTagsToResourceError {
AddTagsToResourceError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for AddTagsToResourceError {
fn from(err: CredentialsError) -> AddTagsToResourceError {
AddTagsToResourceError::Credentials(err)
}
}
impl From<HttpDispatchError> for AddTagsToResourceError {
fn from(err: HttpDispatchError) -> AddTagsToResourceError {
AddTagsToResourceError::HttpDispatch(err)
}
}
impl From<io::Error> for AddTagsToResourceError {
fn from(err: io::Error) -> AddTagsToResourceError {
AddTagsToResourceError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for AddTagsToResourceError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for AddTagsToResourceError {
fn description(&self) -> &str {
match *self {
AddTagsToResourceError::CloudHsmInternal(ref cause) => cause,
AddTagsToResourceError::CloudHsmService(ref cause) => cause,
AddTagsToResourceError::InvalidRequest(ref cause) => cause,
AddTagsToResourceError::Validation(ref cause) => cause,
AddTagsToResourceError::Credentials(ref err) => err.description(),
AddTagsToResourceError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
AddTagsToResourceError::ParseError(ref cause) => cause,
AddTagsToResourceError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum CreateHapgError {
CloudHsmInternal(String),
CloudHsmService(String),
InvalidRequest(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl CreateHapgError {
pub fn from_response(res: BufferedHttpResponse) -> CreateHapgError {
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 {
"CloudHsmInternalException" => {
return CreateHapgError::CloudHsmInternal(String::from(error_message));
}
"CloudHsmServiceException" => {
return CreateHapgError::CloudHsmService(String::from(error_message));
}
"InvalidRequestException" => {
return CreateHapgError::InvalidRequest(String::from(error_message));
}
"ValidationException" => {
return CreateHapgError::Validation(error_message.to_string());
}
_ => {}
}
}
return CreateHapgError::Unknown(res);
}
}
impl From<serde_json::error::Error> for CreateHapgError {
fn from(err: serde_json::error::Error) -> CreateHapgError {
CreateHapgError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for CreateHapgError {
fn from(err: CredentialsError) -> CreateHapgError {
CreateHapgError::Credentials(err)
}
}
impl From<HttpDispatchError> for CreateHapgError {
fn from(err: HttpDispatchError) -> CreateHapgError {
CreateHapgError::HttpDispatch(err)
}
}
impl From<io::Error> for CreateHapgError {
fn from(err: io::Error) -> CreateHapgError {
CreateHapgError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for CreateHapgError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for CreateHapgError {
fn description(&self) -> &str {
match *self {
CreateHapgError::CloudHsmInternal(ref cause) => cause,
CreateHapgError::CloudHsmService(ref cause) => cause,
CreateHapgError::InvalidRequest(ref cause) => cause,
CreateHapgError::Validation(ref cause) => cause,
CreateHapgError::Credentials(ref err) => err.description(),
CreateHapgError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
CreateHapgError::ParseError(ref cause) => cause,
CreateHapgError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum CreateHsmError {
CloudHsmInternal(String),
CloudHsmService(String),
InvalidRequest(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl CreateHsmError {
pub fn from_response(res: BufferedHttpResponse) -> CreateHsmError {
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 {
"CloudHsmInternalException" => {
return CreateHsmError::CloudHsmInternal(String::from(error_message));
}
"CloudHsmServiceException" => {
return CreateHsmError::CloudHsmService(String::from(error_message));
}
"InvalidRequestException" => {
return CreateHsmError::InvalidRequest(String::from(error_message));
}
"ValidationException" => {
return CreateHsmError::Validation(error_message.to_string());
}
_ => {}
}
}
return CreateHsmError::Unknown(res);
}
}
impl From<serde_json::error::Error> for CreateHsmError {
fn from(err: serde_json::error::Error) -> CreateHsmError {
CreateHsmError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for CreateHsmError {
fn from(err: CredentialsError) -> CreateHsmError {
CreateHsmError::Credentials(err)
}
}
impl From<HttpDispatchError> for CreateHsmError {
fn from(err: HttpDispatchError) -> CreateHsmError {
CreateHsmError::HttpDispatch(err)
}
}
impl From<io::Error> for CreateHsmError {
fn from(err: io::Error) -> CreateHsmError {
CreateHsmError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for CreateHsmError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for CreateHsmError {
fn description(&self) -> &str {
match *self {
CreateHsmError::CloudHsmInternal(ref cause) => cause,
CreateHsmError::CloudHsmService(ref cause) => cause,
CreateHsmError::InvalidRequest(ref cause) => cause,
CreateHsmError::Validation(ref cause) => cause,
CreateHsmError::Credentials(ref err) => err.description(),
CreateHsmError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
CreateHsmError::ParseError(ref cause) => cause,
CreateHsmError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum CreateLunaClientError {
CloudHsmInternal(String),
CloudHsmService(String),
InvalidRequest(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl CreateLunaClientError {
pub fn from_response(res: BufferedHttpResponse) -> CreateLunaClientError {
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 {
"CloudHsmInternalException" => {
return CreateLunaClientError::CloudHsmInternal(String::from(error_message));
}
"CloudHsmServiceException" => {
return CreateLunaClientError::CloudHsmService(String::from(error_message));
}
"InvalidRequestException" => {
return CreateLunaClientError::InvalidRequest(String::from(error_message));
}
"ValidationException" => {
return CreateLunaClientError::Validation(error_message.to_string());
}
_ => {}
}
}
return CreateLunaClientError::Unknown(res);
}
}
impl From<serde_json::error::Error> for CreateLunaClientError {
fn from(err: serde_json::error::Error) -> CreateLunaClientError {
CreateLunaClientError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for CreateLunaClientError {
fn from(err: CredentialsError) -> CreateLunaClientError {
CreateLunaClientError::Credentials(err)
}
}
impl From<HttpDispatchError> for CreateLunaClientError {
fn from(err: HttpDispatchError) -> CreateLunaClientError {
CreateLunaClientError::HttpDispatch(err)
}
}
impl From<io::Error> for CreateLunaClientError {
fn from(err: io::Error) -> CreateLunaClientError {
CreateLunaClientError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for CreateLunaClientError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for CreateLunaClientError {
fn description(&self) -> &str {
match *self {
CreateLunaClientError::CloudHsmInternal(ref cause) => cause,
CreateLunaClientError::CloudHsmService(ref cause) => cause,
CreateLunaClientError::InvalidRequest(ref cause) => cause,
CreateLunaClientError::Validation(ref cause) => cause,
CreateLunaClientError::Credentials(ref err) => err.description(),
CreateLunaClientError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
CreateLunaClientError::ParseError(ref cause) => cause,
CreateLunaClientError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DeleteHapgError {
CloudHsmInternal(String),
CloudHsmService(String),
InvalidRequest(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DeleteHapgError {
pub fn from_response(res: BufferedHttpResponse) -> DeleteHapgError {
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 {
"CloudHsmInternalException" => {
return DeleteHapgError::CloudHsmInternal(String::from(error_message));
}
"CloudHsmServiceException" => {
return DeleteHapgError::CloudHsmService(String::from(error_message));
}
"InvalidRequestException" => {
return DeleteHapgError::InvalidRequest(String::from(error_message));
}
"ValidationException" => {
return DeleteHapgError::Validation(error_message.to_string());
}
_ => {}
}
}
return DeleteHapgError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DeleteHapgError {
fn from(err: serde_json::error::Error) -> DeleteHapgError {
DeleteHapgError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DeleteHapgError {
fn from(err: CredentialsError) -> DeleteHapgError {
DeleteHapgError::Credentials(err)
}
}
impl From<HttpDispatchError> for DeleteHapgError {
fn from(err: HttpDispatchError) -> DeleteHapgError {
DeleteHapgError::HttpDispatch(err)
}
}
impl From<io::Error> for DeleteHapgError {
fn from(err: io::Error) -> DeleteHapgError {
DeleteHapgError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DeleteHapgError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DeleteHapgError {
fn description(&self) -> &str {
match *self {
DeleteHapgError::CloudHsmInternal(ref cause) => cause,
DeleteHapgError::CloudHsmService(ref cause) => cause,
DeleteHapgError::InvalidRequest(ref cause) => cause,
DeleteHapgError::Validation(ref cause) => cause,
DeleteHapgError::Credentials(ref err) => err.description(),
DeleteHapgError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
DeleteHapgError::ParseError(ref cause) => cause,
DeleteHapgError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DeleteHsmError {
CloudHsmInternal(String),
CloudHsmService(String),
InvalidRequest(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DeleteHsmError {
pub fn from_response(res: BufferedHttpResponse) -> DeleteHsmError {
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 {
"CloudHsmInternalException" => {
return DeleteHsmError::CloudHsmInternal(String::from(error_message));
}
"CloudHsmServiceException" => {
return DeleteHsmError::CloudHsmService(String::from(error_message));
}
"InvalidRequestException" => {
return DeleteHsmError::InvalidRequest(String::from(error_message));
}
"ValidationException" => {
return DeleteHsmError::Validation(error_message.to_string());
}
_ => {}
}
}
return DeleteHsmError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DeleteHsmError {
fn from(err: serde_json::error::Error) -> DeleteHsmError {
DeleteHsmError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DeleteHsmError {
fn from(err: CredentialsError) -> DeleteHsmError {
DeleteHsmError::Credentials(err)
}
}
impl From<HttpDispatchError> for DeleteHsmError {
fn from(err: HttpDispatchError) -> DeleteHsmError {
DeleteHsmError::HttpDispatch(err)
}
}
impl From<io::Error> for DeleteHsmError {
fn from(err: io::Error) -> DeleteHsmError {
DeleteHsmError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DeleteHsmError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DeleteHsmError {
fn description(&self) -> &str {
match *self {
DeleteHsmError::CloudHsmInternal(ref cause) => cause,
DeleteHsmError::CloudHsmService(ref cause) => cause,
DeleteHsmError::InvalidRequest(ref cause) => cause,
DeleteHsmError::Validation(ref cause) => cause,
DeleteHsmError::Credentials(ref err) => err.description(),
DeleteHsmError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
DeleteHsmError::ParseError(ref cause) => cause,
DeleteHsmError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DeleteLunaClientError {
CloudHsmInternal(String),
CloudHsmService(String),
InvalidRequest(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DeleteLunaClientError {
pub fn from_response(res: BufferedHttpResponse) -> DeleteLunaClientError {
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 {
"CloudHsmInternalException" => {
return DeleteLunaClientError::CloudHsmInternal(String::from(error_message));
}
"CloudHsmServiceException" => {
return DeleteLunaClientError::CloudHsmService(String::from(error_message));
}
"InvalidRequestException" => {
return DeleteLunaClientError::InvalidRequest(String::from(error_message));
}
"ValidationException" => {
return DeleteLunaClientError::Validation(error_message.to_string());
}
_ => {}
}
}
return DeleteLunaClientError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DeleteLunaClientError {
fn from(err: serde_json::error::Error) -> DeleteLunaClientError {
DeleteLunaClientError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DeleteLunaClientError {
fn from(err: CredentialsError) -> DeleteLunaClientError {
DeleteLunaClientError::Credentials(err)
}
}
impl From<HttpDispatchError> for DeleteLunaClientError {
fn from(err: HttpDispatchError) -> DeleteLunaClientError {
DeleteLunaClientError::HttpDispatch(err)
}
}
impl From<io::Error> for DeleteLunaClientError {
fn from(err: io::Error) -> DeleteLunaClientError {
DeleteLunaClientError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DeleteLunaClientError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DeleteLunaClientError {
fn description(&self) -> &str {
match *self {
DeleteLunaClientError::CloudHsmInternal(ref cause) => cause,
DeleteLunaClientError::CloudHsmService(ref cause) => cause,
DeleteLunaClientError::InvalidRequest(ref cause) => cause,
DeleteLunaClientError::Validation(ref cause) => cause,
DeleteLunaClientError::Credentials(ref err) => err.description(),
DeleteLunaClientError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
DeleteLunaClientError::ParseError(ref cause) => cause,
DeleteLunaClientError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DescribeHapgError {
CloudHsmInternal(String),
CloudHsmService(String),
InvalidRequest(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DescribeHapgError {
pub fn from_response(res: BufferedHttpResponse) -> DescribeHapgError {
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 {
"CloudHsmInternalException" => {
return DescribeHapgError::CloudHsmInternal(String::from(error_message));
}
"CloudHsmServiceException" => {
return DescribeHapgError::CloudHsmService(String::from(error_message));
}
"InvalidRequestException" => {
return DescribeHapgError::InvalidRequest(String::from(error_message));
}
"ValidationException" => {
return DescribeHapgError::Validation(error_message.to_string());
}
_ => {}
}
}
return DescribeHapgError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DescribeHapgError {
fn from(err: serde_json::error::Error) -> DescribeHapgError {
DescribeHapgError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DescribeHapgError {
fn from(err: CredentialsError) -> DescribeHapgError {
DescribeHapgError::Credentials(err)
}
}
impl From<HttpDispatchError> for DescribeHapgError {
fn from(err: HttpDispatchError) -> DescribeHapgError {
DescribeHapgError::HttpDispatch(err)
}
}
impl From<io::Error> for DescribeHapgError {
fn from(err: io::Error) -> DescribeHapgError {
DescribeHapgError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DescribeHapgError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DescribeHapgError {
fn description(&self) -> &str {
match *self {
DescribeHapgError::CloudHsmInternal(ref cause) => cause,
DescribeHapgError::CloudHsmService(ref cause) => cause,
DescribeHapgError::InvalidRequest(ref cause) => cause,
DescribeHapgError::Validation(ref cause) => cause,
DescribeHapgError::Credentials(ref err) => err.description(),
DescribeHapgError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
DescribeHapgError::ParseError(ref cause) => cause,
DescribeHapgError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DescribeHsmError {
CloudHsmInternal(String),
CloudHsmService(String),
InvalidRequest(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DescribeHsmError {
pub fn from_response(res: BufferedHttpResponse) -> DescribeHsmError {
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 {
"CloudHsmInternalException" => {
return DescribeHsmError::CloudHsmInternal(String::from(error_message));
}
"CloudHsmServiceException" => {
return DescribeHsmError::CloudHsmService(String::from(error_message));
}
"InvalidRequestException" => {
return DescribeHsmError::InvalidRequest(String::from(error_message));
}
"ValidationException" => {
return DescribeHsmError::Validation(error_message.to_string());
}
_ => {}
}
}
return DescribeHsmError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DescribeHsmError {
fn from(err: serde_json::error::Error) -> DescribeHsmError {
DescribeHsmError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DescribeHsmError {
fn from(err: CredentialsError) -> DescribeHsmError {
DescribeHsmError::Credentials(err)
}
}
impl From<HttpDispatchError> for DescribeHsmError {
fn from(err: HttpDispatchError) -> DescribeHsmError {
DescribeHsmError::HttpDispatch(err)
}
}
impl From<io::Error> for DescribeHsmError {
fn from(err: io::Error) -> DescribeHsmError {
DescribeHsmError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DescribeHsmError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DescribeHsmError {
fn description(&self) -> &str {
match *self {
DescribeHsmError::CloudHsmInternal(ref cause) => cause,
DescribeHsmError::CloudHsmService(ref cause) => cause,
DescribeHsmError::InvalidRequest(ref cause) => cause,
DescribeHsmError::Validation(ref cause) => cause,
DescribeHsmError::Credentials(ref err) => err.description(),
DescribeHsmError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
DescribeHsmError::ParseError(ref cause) => cause,
DescribeHsmError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DescribeLunaClientError {
CloudHsmInternal(String),
CloudHsmService(String),
InvalidRequest(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DescribeLunaClientError {
pub fn from_response(res: BufferedHttpResponse) -> DescribeLunaClientError {
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 {
"CloudHsmInternalException" => {
return DescribeLunaClientError::CloudHsmInternal(String::from(error_message));
}
"CloudHsmServiceException" => {
return DescribeLunaClientError::CloudHsmService(String::from(error_message));
}
"InvalidRequestException" => {
return DescribeLunaClientError::InvalidRequest(String::from(error_message));
}
"ValidationException" => {
return DescribeLunaClientError::Validation(error_message.to_string());
}
_ => {}
}
}
return DescribeLunaClientError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DescribeLunaClientError {
fn from(err: serde_json::error::Error) -> DescribeLunaClientError {
DescribeLunaClientError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DescribeLunaClientError {
fn from(err: CredentialsError) -> DescribeLunaClientError {
DescribeLunaClientError::Credentials(err)
}
}
impl From<HttpDispatchError> for DescribeLunaClientError {
fn from(err: HttpDispatchError) -> DescribeLunaClientError {
DescribeLunaClientError::HttpDispatch(err)
}
}
impl From<io::Error> for DescribeLunaClientError {
fn from(err: io::Error) -> DescribeLunaClientError {
DescribeLunaClientError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DescribeLunaClientError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DescribeLunaClientError {
fn description(&self) -> &str {
match *self {
DescribeLunaClientError::CloudHsmInternal(ref cause) => cause,
DescribeLunaClientError::CloudHsmService(ref cause) => cause,
DescribeLunaClientError::InvalidRequest(ref cause) => cause,
DescribeLunaClientError::Validation(ref cause) => cause,
DescribeLunaClientError::Credentials(ref err) => err.description(),
DescribeLunaClientError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
DescribeLunaClientError::ParseError(ref cause) => cause,
DescribeLunaClientError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetConfigError {
CloudHsmInternal(String),
CloudHsmService(String),
InvalidRequest(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetConfigError {
pub fn from_response(res: BufferedHttpResponse) -> GetConfigError {
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 {
"CloudHsmInternalException" => {
return GetConfigError::CloudHsmInternal(String::from(error_message));
}
"CloudHsmServiceException" => {
return GetConfigError::CloudHsmService(String::from(error_message));
}
"InvalidRequestException" => {
return GetConfigError::InvalidRequest(String::from(error_message));
}
"ValidationException" => {
return GetConfigError::Validation(error_message.to_string());
}
_ => {}
}
}
return GetConfigError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetConfigError {
fn from(err: serde_json::error::Error) -> GetConfigError {
GetConfigError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetConfigError {
fn from(err: CredentialsError) -> GetConfigError {
GetConfigError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetConfigError {
fn from(err: HttpDispatchError) -> GetConfigError {
GetConfigError::HttpDispatch(err)
}
}
impl From<io::Error> for GetConfigError {
fn from(err: io::Error) -> GetConfigError {
GetConfigError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetConfigError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetConfigError {
fn description(&self) -> &str {
match *self {
GetConfigError::CloudHsmInternal(ref cause) => cause,
GetConfigError::CloudHsmService(ref cause) => cause,
GetConfigError::InvalidRequest(ref cause) => cause,
GetConfigError::Validation(ref cause) => cause,
GetConfigError::Credentials(ref err) => err.description(),
GetConfigError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
GetConfigError::ParseError(ref cause) => cause,
GetConfigError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListAvailableZonesError {
CloudHsmInternal(String),
CloudHsmService(String),
InvalidRequest(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ListAvailableZonesError {
pub fn from_response(res: BufferedHttpResponse) -> ListAvailableZonesError {
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 {
"CloudHsmInternalException" => {
return ListAvailableZonesError::CloudHsmInternal(String::from(error_message));
}
"CloudHsmServiceException" => {
return ListAvailableZonesError::CloudHsmService(String::from(error_message));
}
"InvalidRequestException" => {
return ListAvailableZonesError::InvalidRequest(String::from(error_message));
}
"ValidationException" => {
return ListAvailableZonesError::Validation(error_message.to_string());
}
_ => {}
}
}
return ListAvailableZonesError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ListAvailableZonesError {
fn from(err: serde_json::error::Error) -> ListAvailableZonesError {
ListAvailableZonesError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ListAvailableZonesError {
fn from(err: CredentialsError) -> ListAvailableZonesError {
ListAvailableZonesError::Credentials(err)
}
}
impl From<HttpDispatchError> for ListAvailableZonesError {
fn from(err: HttpDispatchError) -> ListAvailableZonesError {
ListAvailableZonesError::HttpDispatch(err)
}
}
impl From<io::Error> for ListAvailableZonesError {
fn from(err: io::Error) -> ListAvailableZonesError {
ListAvailableZonesError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ListAvailableZonesError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListAvailableZonesError {
fn description(&self) -> &str {
match *self {
ListAvailableZonesError::CloudHsmInternal(ref cause) => cause,
ListAvailableZonesError::CloudHsmService(ref cause) => cause,
ListAvailableZonesError::InvalidRequest(ref cause) => cause,
ListAvailableZonesError::Validation(ref cause) => cause,
ListAvailableZonesError::Credentials(ref err) => err.description(),
ListAvailableZonesError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
ListAvailableZonesError::ParseError(ref cause) => cause,
ListAvailableZonesError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListHapgsError {
CloudHsmInternal(String),
CloudHsmService(String),
InvalidRequest(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ListHapgsError {
pub fn from_response(res: BufferedHttpResponse) -> ListHapgsError {
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 {
"CloudHsmInternalException" => {
return ListHapgsError::CloudHsmInternal(String::from(error_message));
}
"CloudHsmServiceException" => {
return ListHapgsError::CloudHsmService(String::from(error_message));
}
"InvalidRequestException" => {
return ListHapgsError::InvalidRequest(String::from(error_message));
}
"ValidationException" => {
return ListHapgsError::Validation(error_message.to_string());
}
_ => {}
}
}
return ListHapgsError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ListHapgsError {
fn from(err: serde_json::error::Error) -> ListHapgsError {
ListHapgsError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ListHapgsError {
fn from(err: CredentialsError) -> ListHapgsError {
ListHapgsError::Credentials(err)
}
}
impl From<HttpDispatchError> for ListHapgsError {
fn from(err: HttpDispatchError) -> ListHapgsError {
ListHapgsError::HttpDispatch(err)
}
}
impl From<io::Error> for ListHapgsError {
fn from(err: io::Error) -> ListHapgsError {
ListHapgsError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ListHapgsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListHapgsError {
fn description(&self) -> &str {
match *self {
ListHapgsError::CloudHsmInternal(ref cause) => cause,
ListHapgsError::CloudHsmService(ref cause) => cause,
ListHapgsError::InvalidRequest(ref cause) => cause,
ListHapgsError::Validation(ref cause) => cause,
ListHapgsError::Credentials(ref err) => err.description(),
ListHapgsError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
ListHapgsError::ParseError(ref cause) => cause,
ListHapgsError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListHsmsError {
CloudHsmInternal(String),
CloudHsmService(String),
InvalidRequest(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ListHsmsError {
pub fn from_response(res: BufferedHttpResponse) -> ListHsmsError {
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 {
"CloudHsmInternalException" => {
return ListHsmsError::CloudHsmInternal(String::from(error_message));
}
"CloudHsmServiceException" => {
return ListHsmsError::CloudHsmService(String::from(error_message));
}
"InvalidRequestException" => {
return ListHsmsError::InvalidRequest(String::from(error_message));
}
"ValidationException" => {
return ListHsmsError::Validation(error_message.to_string());
}
_ => {}
}
}
return ListHsmsError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ListHsmsError {
fn from(err: serde_json::error::Error) -> ListHsmsError {
ListHsmsError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ListHsmsError {
fn from(err: CredentialsError) -> ListHsmsError {
ListHsmsError::Credentials(err)
}
}
impl From<HttpDispatchError> for ListHsmsError {
fn from(err: HttpDispatchError) -> ListHsmsError {
ListHsmsError::HttpDispatch(err)
}
}
impl From<io::Error> for ListHsmsError {
fn from(err: io::Error) -> ListHsmsError {
ListHsmsError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ListHsmsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListHsmsError {
fn description(&self) -> &str {
match *self {
ListHsmsError::CloudHsmInternal(ref cause) => cause,
ListHsmsError::CloudHsmService(ref cause) => cause,
ListHsmsError::InvalidRequest(ref cause) => cause,
ListHsmsError::Validation(ref cause) => cause,
ListHsmsError::Credentials(ref err) => err.description(),
ListHsmsError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
ListHsmsError::ParseError(ref cause) => cause,
ListHsmsError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListLunaClientsError {
CloudHsmInternal(String),
CloudHsmService(String),
InvalidRequest(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ListLunaClientsError {
pub fn from_response(res: BufferedHttpResponse) -> ListLunaClientsError {
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 {
"CloudHsmInternalException" => {
return ListLunaClientsError::CloudHsmInternal(String::from(error_message));
}
"CloudHsmServiceException" => {
return ListLunaClientsError::CloudHsmService(String::from(error_message));
}
"InvalidRequestException" => {
return ListLunaClientsError::InvalidRequest(String::from(error_message));
}
"ValidationException" => {
return ListLunaClientsError::Validation(error_message.to_string());
}
_ => {}
}
}
return ListLunaClientsError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ListLunaClientsError {
fn from(err: serde_json::error::Error) -> ListLunaClientsError {
ListLunaClientsError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ListLunaClientsError {
fn from(err: CredentialsError) -> ListLunaClientsError {
ListLunaClientsError::Credentials(err)
}
}
impl From<HttpDispatchError> for ListLunaClientsError {
fn from(err: HttpDispatchError) -> ListLunaClientsError {
ListLunaClientsError::HttpDispatch(err)
}
}
impl From<io::Error> for ListLunaClientsError {
fn from(err: io::Error) -> ListLunaClientsError {
ListLunaClientsError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ListLunaClientsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListLunaClientsError {
fn description(&self) -> &str {
match *self {
ListLunaClientsError::CloudHsmInternal(ref cause) => cause,
ListLunaClientsError::CloudHsmService(ref cause) => cause,
ListLunaClientsError::InvalidRequest(ref cause) => cause,
ListLunaClientsError::Validation(ref cause) => cause,
ListLunaClientsError::Credentials(ref err) => err.description(),
ListLunaClientsError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
ListLunaClientsError::ParseError(ref cause) => cause,
ListLunaClientsError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListTagsForResourceError {
CloudHsmInternal(String),
CloudHsmService(String),
InvalidRequest(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ListTagsForResourceError {
pub fn from_response(res: BufferedHttpResponse) -> ListTagsForResourceError {
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 {
"CloudHsmInternalException" => {
return ListTagsForResourceError::CloudHsmInternal(String::from(error_message));
}
"CloudHsmServiceException" => {
return ListTagsForResourceError::CloudHsmService(String::from(error_message));
}
"InvalidRequestException" => {
return ListTagsForResourceError::InvalidRequest(String::from(error_message));
}
"ValidationException" => {
return ListTagsForResourceError::Validation(error_message.to_string());
}
_ => {}
}
}
return ListTagsForResourceError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ListTagsForResourceError {
fn from(err: serde_json::error::Error) -> ListTagsForResourceError {
ListTagsForResourceError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ListTagsForResourceError {
fn from(err: CredentialsError) -> ListTagsForResourceError {
ListTagsForResourceError::Credentials(err)
}
}
impl From<HttpDispatchError> for ListTagsForResourceError {
fn from(err: HttpDispatchError) -> ListTagsForResourceError {
ListTagsForResourceError::HttpDispatch(err)
}
}
impl From<io::Error> for ListTagsForResourceError {
fn from(err: io::Error) -> ListTagsForResourceError {
ListTagsForResourceError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ListTagsForResourceError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListTagsForResourceError {
fn description(&self) -> &str {
match *self {
ListTagsForResourceError::CloudHsmInternal(ref cause) => cause,
ListTagsForResourceError::CloudHsmService(ref cause) => cause,
ListTagsForResourceError::InvalidRequest(ref cause) => cause,
ListTagsForResourceError::Validation(ref cause) => cause,
ListTagsForResourceError::Credentials(ref err) => err.description(),
ListTagsForResourceError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
ListTagsForResourceError::ParseError(ref cause) => cause,
ListTagsForResourceError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ModifyHapgError {
CloudHsmInternal(String),
CloudHsmService(String),
InvalidRequest(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ModifyHapgError {
pub fn from_response(res: BufferedHttpResponse) -> ModifyHapgError {
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 {
"CloudHsmInternalException" => {
return ModifyHapgError::CloudHsmInternal(String::from(error_message));
}
"CloudHsmServiceException" => {
return ModifyHapgError::CloudHsmService(String::from(error_message));
}
"InvalidRequestException" => {
return ModifyHapgError::InvalidRequest(String::from(error_message));
}
"ValidationException" => {
return ModifyHapgError::Validation(error_message.to_string());
}
_ => {}
}
}
return ModifyHapgError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ModifyHapgError {
fn from(err: serde_json::error::Error) -> ModifyHapgError {
ModifyHapgError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ModifyHapgError {
fn from(err: CredentialsError) -> ModifyHapgError {
ModifyHapgError::Credentials(err)
}
}
impl From<HttpDispatchError> for ModifyHapgError {
fn from(err: HttpDispatchError) -> ModifyHapgError {
ModifyHapgError::HttpDispatch(err)
}
}
impl From<io::Error> for ModifyHapgError {
fn from(err: io::Error) -> ModifyHapgError {
ModifyHapgError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ModifyHapgError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ModifyHapgError {
fn description(&self) -> &str {
match *self {
ModifyHapgError::CloudHsmInternal(ref cause) => cause,
ModifyHapgError::CloudHsmService(ref cause) => cause,
ModifyHapgError::InvalidRequest(ref cause) => cause,
ModifyHapgError::Validation(ref cause) => cause,
ModifyHapgError::Credentials(ref err) => err.description(),
ModifyHapgError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
ModifyHapgError::ParseError(ref cause) => cause,
ModifyHapgError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ModifyHsmError {
CloudHsmInternal(String),
CloudHsmService(String),
InvalidRequest(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ModifyHsmError {
pub fn from_response(res: BufferedHttpResponse) -> ModifyHsmError {
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 {
"CloudHsmInternalException" => {
return ModifyHsmError::CloudHsmInternal(String::from(error_message));
}
"CloudHsmServiceException" => {
return ModifyHsmError::CloudHsmService(String::from(error_message));
}
"InvalidRequestException" => {
return ModifyHsmError::InvalidRequest(String::from(error_message));
}
"ValidationException" => {
return ModifyHsmError::Validation(error_message.to_string());
}
_ => {}
}
}
return ModifyHsmError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ModifyHsmError {
fn from(err: serde_json::error::Error) -> ModifyHsmError {
ModifyHsmError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ModifyHsmError {
fn from(err: CredentialsError) -> ModifyHsmError {
ModifyHsmError::Credentials(err)
}
}
impl From<HttpDispatchError> for ModifyHsmError {
fn from(err: HttpDispatchError) -> ModifyHsmError {
ModifyHsmError::HttpDispatch(err)
}
}
impl From<io::Error> for ModifyHsmError {
fn from(err: io::Error) -> ModifyHsmError {
ModifyHsmError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ModifyHsmError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ModifyHsmError {
fn description(&self) -> &str {
match *self {
ModifyHsmError::CloudHsmInternal(ref cause) => cause,
ModifyHsmError::CloudHsmService(ref cause) => cause,
ModifyHsmError::InvalidRequest(ref cause) => cause,
ModifyHsmError::Validation(ref cause) => cause,
ModifyHsmError::Credentials(ref err) => err.description(),
ModifyHsmError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
ModifyHsmError::ParseError(ref cause) => cause,
ModifyHsmError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ModifyLunaClientError {
CloudHsmService(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ModifyLunaClientError {
pub fn from_response(res: BufferedHttpResponse) -> ModifyLunaClientError {
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 {
"CloudHsmServiceException" => {
return ModifyLunaClientError::CloudHsmService(String::from(error_message));
}
"ValidationException" => {
return ModifyLunaClientError::Validation(error_message.to_string());
}
_ => {}
}
}
return ModifyLunaClientError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ModifyLunaClientError {
fn from(err: serde_json::error::Error) -> ModifyLunaClientError {
ModifyLunaClientError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ModifyLunaClientError {
fn from(err: CredentialsError) -> ModifyLunaClientError {
ModifyLunaClientError::Credentials(err)
}
}
impl From<HttpDispatchError> for ModifyLunaClientError {
fn from(err: HttpDispatchError) -> ModifyLunaClientError {
ModifyLunaClientError::HttpDispatch(err)
}
}
impl From<io::Error> for ModifyLunaClientError {
fn from(err: io::Error) -> ModifyLunaClientError {
ModifyLunaClientError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ModifyLunaClientError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ModifyLunaClientError {
fn description(&self) -> &str {
match *self {
ModifyLunaClientError::CloudHsmService(ref cause) => cause,
ModifyLunaClientError::Validation(ref cause) => cause,
ModifyLunaClientError::Credentials(ref err) => err.description(),
ModifyLunaClientError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
ModifyLunaClientError::ParseError(ref cause) => cause,
ModifyLunaClientError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum RemoveTagsFromResourceError {
CloudHsmInternal(String),
CloudHsmService(String),
InvalidRequest(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl RemoveTagsFromResourceError {
pub fn from_response(res: BufferedHttpResponse) -> RemoveTagsFromResourceError {
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 {
"CloudHsmInternalException" => {
return RemoveTagsFromResourceError::CloudHsmInternal(String::from(
error_message,
));
}
"CloudHsmServiceException" => {
return RemoveTagsFromResourceError::CloudHsmService(String::from(error_message));
}
"InvalidRequestException" => {
return RemoveTagsFromResourceError::InvalidRequest(String::from(error_message));
}
"ValidationException" => {
return RemoveTagsFromResourceError::Validation(error_message.to_string());
}
_ => {}
}
}
return RemoveTagsFromResourceError::Unknown(res);
}
}
impl From<serde_json::error::Error> for RemoveTagsFromResourceError {
fn from(err: serde_json::error::Error) -> RemoveTagsFromResourceError {
RemoveTagsFromResourceError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for RemoveTagsFromResourceError {
fn from(err: CredentialsError) -> RemoveTagsFromResourceError {
RemoveTagsFromResourceError::Credentials(err)
}
}
impl From<HttpDispatchError> for RemoveTagsFromResourceError {
fn from(err: HttpDispatchError) -> RemoveTagsFromResourceError {
RemoveTagsFromResourceError::HttpDispatch(err)
}
}
impl From<io::Error> for RemoveTagsFromResourceError {
fn from(err: io::Error) -> RemoveTagsFromResourceError {
RemoveTagsFromResourceError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for RemoveTagsFromResourceError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for RemoveTagsFromResourceError {
fn description(&self) -> &str {
match *self {
RemoveTagsFromResourceError::CloudHsmInternal(ref cause) => cause,
RemoveTagsFromResourceError::CloudHsmService(ref cause) => cause,
RemoveTagsFromResourceError::InvalidRequest(ref cause) => cause,
RemoveTagsFromResourceError::Validation(ref cause) => cause,
RemoveTagsFromResourceError::Credentials(ref err) => err.description(),
RemoveTagsFromResourceError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
RemoveTagsFromResourceError::ParseError(ref cause) => cause,
RemoveTagsFromResourceError::Unknown(_) => "unknown error",
}
}
}
pub trait CloudHsm {
fn add_tags_to_resource(
&self,
input: AddTagsToResourceRequest,
) -> RusotoFuture<AddTagsToResourceResponse, AddTagsToResourceError>;
fn create_hapg(
&self,
input: CreateHapgRequest,
) -> RusotoFuture<CreateHapgResponse, CreateHapgError>;
fn create_hsm(
&self,
input: CreateHsmRequest,
) -> RusotoFuture<CreateHsmResponse, CreateHsmError>;
fn create_luna_client(
&self,
input: CreateLunaClientRequest,
) -> RusotoFuture<CreateLunaClientResponse, CreateLunaClientError>;
fn delete_hapg(
&self,
input: DeleteHapgRequest,
) -> RusotoFuture<DeleteHapgResponse, DeleteHapgError>;
fn delete_hsm(
&self,
input: DeleteHsmRequest,
) -> RusotoFuture<DeleteHsmResponse, DeleteHsmError>;
fn delete_luna_client(
&self,
input: DeleteLunaClientRequest,
) -> RusotoFuture<DeleteLunaClientResponse, DeleteLunaClientError>;
fn describe_hapg(
&self,
input: DescribeHapgRequest,
) -> RusotoFuture<DescribeHapgResponse, DescribeHapgError>;
fn describe_hsm(
&self,
input: DescribeHsmRequest,
) -> RusotoFuture<DescribeHsmResponse, DescribeHsmError>;
fn describe_luna_client(
&self,
input: DescribeLunaClientRequest,
) -> RusotoFuture<DescribeLunaClientResponse, DescribeLunaClientError>;
fn get_config(
&self,
input: GetConfigRequest,
) -> RusotoFuture<GetConfigResponse, GetConfigError>;
fn list_available_zones(
&self,
) -> RusotoFuture<ListAvailableZonesResponse, ListAvailableZonesError>;
fn list_hapgs(
&self,
input: ListHapgsRequest,
) -> RusotoFuture<ListHapgsResponse, ListHapgsError>;
fn list_hsms(&self, input: ListHsmsRequest) -> RusotoFuture<ListHsmsResponse, ListHsmsError>;
fn list_luna_clients(
&self,
input: ListLunaClientsRequest,
) -> RusotoFuture<ListLunaClientsResponse, ListLunaClientsError>;
fn list_tags_for_resource(
&self,
input: ListTagsForResourceRequest,
) -> RusotoFuture<ListTagsForResourceResponse, ListTagsForResourceError>;
fn modify_hapg(
&self,
input: ModifyHapgRequest,
) -> RusotoFuture<ModifyHapgResponse, ModifyHapgError>;
fn modify_hsm(
&self,
input: ModifyHsmRequest,
) -> RusotoFuture<ModifyHsmResponse, ModifyHsmError>;
fn modify_luna_client(
&self,
input: ModifyLunaClientRequest,
) -> RusotoFuture<ModifyLunaClientResponse, ModifyLunaClientError>;
fn remove_tags_from_resource(
&self,
input: RemoveTagsFromResourceRequest,
) -> RusotoFuture<RemoveTagsFromResourceResponse, RemoveTagsFromResourceError>;
}
#[derive(Clone)]
pub struct CloudHsmClient {
client: Client,
region: region::Region,
}
impl CloudHsmClient {
pub fn new(region: region::Region) -> CloudHsmClient {
CloudHsmClient {
client: Client::shared(),
region: region,
}
}
pub fn new_with<P, D>(
request_dispatcher: D,
credentials_provider: P,
region: region::Region,
) -> CloudHsmClient
where
P: ProvideAwsCredentials + Send + Sync + 'static,
P::Future: Send,
D: DispatchSignedRequest + Send + Sync + 'static,
D::Future: Send,
{
CloudHsmClient {
client: Client::new_with(credentials_provider, request_dispatcher),
region: region,
}
}
}
impl CloudHsm for CloudHsmClient {
fn add_tags_to_resource(
&self,
input: AddTagsToResourceRequest,
) -> RusotoFuture<AddTagsToResourceResponse, AddTagsToResourceError> {
let mut request = SignedRequest::new("POST", "cloudhsm", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "CloudHsmFrontendService.AddTagsToResource");
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::<AddTagsToResourceResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(AddTagsToResourceError::from_response(response))),
)
}
})
}
fn create_hapg(
&self,
input: CreateHapgRequest,
) -> RusotoFuture<CreateHapgResponse, CreateHapgError> {
let mut request = SignedRequest::new("POST", "cloudhsm", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "CloudHsmFrontendService.CreateHapg");
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::<CreateHapgResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(CreateHapgError::from_response(response))),
)
}
})
}
fn create_hsm(
&self,
input: CreateHsmRequest,
) -> RusotoFuture<CreateHsmResponse, CreateHsmError> {
let mut request = SignedRequest::new("POST", "cloudhsm", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "CloudHsmFrontendService.CreateHsm");
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::<CreateHsmResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(CreateHsmError::from_response(response))),
)
}
})
}
fn create_luna_client(
&self,
input: CreateLunaClientRequest,
) -> RusotoFuture<CreateLunaClientResponse, CreateLunaClientError> {
let mut request = SignedRequest::new("POST", "cloudhsm", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "CloudHsmFrontendService.CreateLunaClient");
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::<CreateLunaClientResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(CreateLunaClientError::from_response(response))),
)
}
})
}
fn delete_hapg(
&self,
input: DeleteHapgRequest,
) -> RusotoFuture<DeleteHapgResponse, DeleteHapgError> {
let mut request = SignedRequest::new("POST", "cloudhsm", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "CloudHsmFrontendService.DeleteHapg");
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::<DeleteHapgResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(DeleteHapgError::from_response(response))),
)
}
})
}
fn delete_hsm(
&self,
input: DeleteHsmRequest,
) -> RusotoFuture<DeleteHsmResponse, DeleteHsmError> {
let mut request = SignedRequest::new("POST", "cloudhsm", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "CloudHsmFrontendService.DeleteHsm");
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::<DeleteHsmResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(DeleteHsmError::from_response(response))),
)
}
})
}
fn delete_luna_client(
&self,
input: DeleteLunaClientRequest,
) -> RusotoFuture<DeleteLunaClientResponse, DeleteLunaClientError> {
let mut request = SignedRequest::new("POST", "cloudhsm", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "CloudHsmFrontendService.DeleteLunaClient");
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::<DeleteLunaClientResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(DeleteLunaClientError::from_response(response))),
)
}
})
}
fn describe_hapg(
&self,
input: DescribeHapgRequest,
) -> RusotoFuture<DescribeHapgResponse, DescribeHapgError> {
let mut request = SignedRequest::new("POST", "cloudhsm", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "CloudHsmFrontendService.DescribeHapg");
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::<DescribeHapgResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(DescribeHapgError::from_response(response))),
)
}
})
}
fn describe_hsm(
&self,
input: DescribeHsmRequest,
) -> RusotoFuture<DescribeHsmResponse, DescribeHsmError> {
let mut request = SignedRequest::new("POST", "cloudhsm", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "CloudHsmFrontendService.DescribeHsm");
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::<DescribeHsmResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(DescribeHsmError::from_response(response))),
)
}
})
}
fn describe_luna_client(
&self,
input: DescribeLunaClientRequest,
) -> RusotoFuture<DescribeLunaClientResponse, DescribeLunaClientError> {
let mut request = SignedRequest::new("POST", "cloudhsm", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "CloudHsmFrontendService.DescribeLunaClient");
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::<DescribeLunaClientResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(DescribeLunaClientError::from_response(response))),
)
}
})
}
fn get_config(
&self,
input: GetConfigRequest,
) -> RusotoFuture<GetConfigResponse, GetConfigError> {
let mut request = SignedRequest::new("POST", "cloudhsm", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "CloudHsmFrontendService.GetConfig");
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::<GetConfigResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(GetConfigError::from_response(response))),
)
}
})
}
fn list_available_zones(
&self,
) -> RusotoFuture<ListAvailableZonesResponse, ListAvailableZonesError> {
let mut request = SignedRequest::new("POST", "cloudhsm", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "CloudHsmFrontendService.ListAvailableZones");
request.set_payload(Some(b"{}".to_vec()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<ListAvailableZonesResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(ListAvailableZonesError::from_response(response))),
)
}
})
}
fn list_hapgs(
&self,
input: ListHapgsRequest,
) -> RusotoFuture<ListHapgsResponse, ListHapgsError> {
let mut request = SignedRequest::new("POST", "cloudhsm", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "CloudHsmFrontendService.ListHapgs");
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::<ListHapgsResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(ListHapgsError::from_response(response))),
)
}
})
}
fn list_hsms(&self, input: ListHsmsRequest) -> RusotoFuture<ListHsmsResponse, ListHsmsError> {
let mut request = SignedRequest::new("POST", "cloudhsm", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "CloudHsmFrontendService.ListHsms");
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::<ListHsmsResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(ListHsmsError::from_response(response))),
)
}
})
}
fn list_luna_clients(
&self,
input: ListLunaClientsRequest,
) -> RusotoFuture<ListLunaClientsResponse, ListLunaClientsError> {
let mut request = SignedRequest::new("POST", "cloudhsm", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "CloudHsmFrontendService.ListLunaClients");
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::<ListLunaClientsResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(ListLunaClientsError::from_response(response))),
)
}
})
}
fn list_tags_for_resource(
&self,
input: ListTagsForResourceRequest,
) -> RusotoFuture<ListTagsForResourceResponse, ListTagsForResourceError> {
let mut request = SignedRequest::new("POST", "cloudhsm", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"CloudHsmFrontendService.ListTagsForResource",
);
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::<ListTagsForResourceResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(ListTagsForResourceError::from_response(response))
}),
)
}
})
}
fn modify_hapg(
&self,
input: ModifyHapgRequest,
) -> RusotoFuture<ModifyHapgResponse, ModifyHapgError> {
let mut request = SignedRequest::new("POST", "cloudhsm", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "CloudHsmFrontendService.ModifyHapg");
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::<ModifyHapgResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(ModifyHapgError::from_response(response))),
)
}
})
}
fn modify_hsm(
&self,
input: ModifyHsmRequest,
) -> RusotoFuture<ModifyHsmResponse, ModifyHsmError> {
let mut request = SignedRequest::new("POST", "cloudhsm", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "CloudHsmFrontendService.ModifyHsm");
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::<ModifyHsmResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(ModifyHsmError::from_response(response))),
)
}
})
}
fn modify_luna_client(
&self,
input: ModifyLunaClientRequest,
) -> RusotoFuture<ModifyLunaClientResponse, ModifyLunaClientError> {
let mut request = SignedRequest::new("POST", "cloudhsm", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "CloudHsmFrontendService.ModifyLunaClient");
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::<ModifyLunaClientResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(ModifyLunaClientError::from_response(response))),
)
}
})
}
fn remove_tags_from_resource(
&self,
input: RemoveTagsFromResourceRequest,
) -> RusotoFuture<RemoveTagsFromResourceResponse, RemoveTagsFromResourceError> {
let mut request = SignedRequest::new("POST", "cloudhsm", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"CloudHsmFrontendService.RemoveTagsFromResource",
);
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::<RemoveTagsFromResourceResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(RemoveTagsFromResourceError::from_response(response))
}),
)
}
})
}
}
#[cfg(test)]
mod protocol_tests {}