use std::error::Error;
use std::fmt;
#[allow(warnings)]
use futures::future;
use futures::Future;
use rusoto_core::credential::ProvideAwsCredentials;
use rusoto_core::region;
use rusoto_core::request::{BufferedHttpResponse, DispatchSignedRequest};
use rusoto_core::{Client, RusotoError, RusotoFuture};
use rusoto_core::proto;
use rusoto_core::signature::SignedRequest;
use serde_json;
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct Budget {
#[serde(rename = "BudgetLimit")]
#[serde(skip_serializing_if = "Option::is_none")]
pub budget_limit: Option<Spend>,
#[serde(rename = "BudgetName")]
pub budget_name: String,
#[serde(rename = "BudgetType")]
pub budget_type: String,
#[serde(rename = "CalculatedSpend")]
#[serde(skip_serializing_if = "Option::is_none")]
pub calculated_spend: Option<CalculatedSpend>,
#[serde(rename = "CostFilters")]
#[serde(skip_serializing_if = "Option::is_none")]
pub cost_filters: Option<::std::collections::HashMap<String, Vec<String>>>,
#[serde(rename = "CostTypes")]
#[serde(skip_serializing_if = "Option::is_none")]
pub cost_types: Option<CostTypes>,
#[serde(rename = "LastUpdatedTime")]
#[serde(skip_serializing_if = "Option::is_none")]
pub last_updated_time: Option<f64>,
#[serde(rename = "PlannedBudgetLimits")]
#[serde(skip_serializing_if = "Option::is_none")]
pub planned_budget_limits: Option<::std::collections::HashMap<String, Spend>>,
#[serde(rename = "TimePeriod")]
#[serde(skip_serializing_if = "Option::is_none")]
pub time_period: Option<TimePeriod>,
#[serde(rename = "TimeUnit")]
pub time_unit: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct BudgetPerformanceHistory {
#[serde(rename = "BudgetName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub budget_name: Option<String>,
#[serde(rename = "BudgetType")]
#[serde(skip_serializing_if = "Option::is_none")]
pub budget_type: Option<String>,
#[serde(rename = "BudgetedAndActualAmountsList")]
#[serde(skip_serializing_if = "Option::is_none")]
pub budgeted_and_actual_amounts_list: Option<Vec<BudgetedAndActualAmounts>>,
#[serde(rename = "CostFilters")]
#[serde(skip_serializing_if = "Option::is_none")]
pub cost_filters: Option<::std::collections::HashMap<String, Vec<String>>>,
#[serde(rename = "CostTypes")]
#[serde(skip_serializing_if = "Option::is_none")]
pub cost_types: Option<CostTypes>,
#[serde(rename = "TimeUnit")]
#[serde(skip_serializing_if = "Option::is_none")]
pub time_unit: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct BudgetedAndActualAmounts {
#[serde(rename = "ActualAmount")]
#[serde(skip_serializing_if = "Option::is_none")]
pub actual_amount: Option<Spend>,
#[serde(rename = "BudgetedAmount")]
#[serde(skip_serializing_if = "Option::is_none")]
pub budgeted_amount: Option<Spend>,
#[serde(rename = "TimePeriod")]
#[serde(skip_serializing_if = "Option::is_none")]
pub time_period: Option<TimePeriod>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct CalculatedSpend {
#[serde(rename = "ActualSpend")]
pub actual_spend: Spend,
#[serde(rename = "ForecastedSpend")]
#[serde(skip_serializing_if = "Option::is_none")]
pub forecasted_spend: Option<Spend>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct CostTypes {
#[serde(rename = "IncludeCredit")]
#[serde(skip_serializing_if = "Option::is_none")]
pub include_credit: Option<bool>,
#[serde(rename = "IncludeDiscount")]
#[serde(skip_serializing_if = "Option::is_none")]
pub include_discount: Option<bool>,
#[serde(rename = "IncludeOtherSubscription")]
#[serde(skip_serializing_if = "Option::is_none")]
pub include_other_subscription: Option<bool>,
#[serde(rename = "IncludeRecurring")]
#[serde(skip_serializing_if = "Option::is_none")]
pub include_recurring: Option<bool>,
#[serde(rename = "IncludeRefund")]
#[serde(skip_serializing_if = "Option::is_none")]
pub include_refund: Option<bool>,
#[serde(rename = "IncludeSubscription")]
#[serde(skip_serializing_if = "Option::is_none")]
pub include_subscription: Option<bool>,
#[serde(rename = "IncludeSupport")]
#[serde(skip_serializing_if = "Option::is_none")]
pub include_support: Option<bool>,
#[serde(rename = "IncludeTax")]
#[serde(skip_serializing_if = "Option::is_none")]
pub include_tax: Option<bool>,
#[serde(rename = "IncludeUpfront")]
#[serde(skip_serializing_if = "Option::is_none")]
pub include_upfront: Option<bool>,
#[serde(rename = "UseAmortized")]
#[serde(skip_serializing_if = "Option::is_none")]
pub use_amortized: Option<bool>,
#[serde(rename = "UseBlended")]
#[serde(skip_serializing_if = "Option::is_none")]
pub use_blended: Option<bool>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct CreateBudgetRequest {
#[serde(rename = "AccountId")]
pub account_id: String,
#[serde(rename = "Budget")]
pub budget: Budget,
#[serde(rename = "NotificationsWithSubscribers")]
#[serde(skip_serializing_if = "Option::is_none")]
pub notifications_with_subscribers: Option<Vec<NotificationWithSubscribers>>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct CreateBudgetResponse {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct CreateNotificationRequest {
#[serde(rename = "AccountId")]
pub account_id: String,
#[serde(rename = "BudgetName")]
pub budget_name: String,
#[serde(rename = "Notification")]
pub notification: Notification,
#[serde(rename = "Subscribers")]
pub subscribers: Vec<Subscriber>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct CreateNotificationResponse {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct CreateSubscriberRequest {
#[serde(rename = "AccountId")]
pub account_id: String,
#[serde(rename = "BudgetName")]
pub budget_name: String,
#[serde(rename = "Notification")]
pub notification: Notification,
#[serde(rename = "Subscriber")]
pub subscriber: Subscriber,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct CreateSubscriberResponse {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DeleteBudgetRequest {
#[serde(rename = "AccountId")]
pub account_id: String,
#[serde(rename = "BudgetName")]
pub budget_name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DeleteBudgetResponse {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DeleteNotificationRequest {
#[serde(rename = "AccountId")]
pub account_id: String,
#[serde(rename = "BudgetName")]
pub budget_name: String,
#[serde(rename = "Notification")]
pub notification: Notification,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DeleteNotificationResponse {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DeleteSubscriberRequest {
#[serde(rename = "AccountId")]
pub account_id: String,
#[serde(rename = "BudgetName")]
pub budget_name: String,
#[serde(rename = "Notification")]
pub notification: Notification,
#[serde(rename = "Subscriber")]
pub subscriber: Subscriber,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DeleteSubscriberResponse {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DescribeBudgetPerformanceHistoryRequest {
#[serde(rename = "AccountId")]
pub account_id: String,
#[serde(rename = "BudgetName")]
pub budget_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>,
#[serde(rename = "TimePeriod")]
#[serde(skip_serializing_if = "Option::is_none")]
pub time_period: Option<TimePeriod>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DescribeBudgetPerformanceHistoryResponse {
#[serde(rename = "BudgetPerformanceHistory")]
#[serde(skip_serializing_if = "Option::is_none")]
pub budget_performance_history: Option<BudgetPerformanceHistory>,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DescribeBudgetRequest {
#[serde(rename = "AccountId")]
pub account_id: String,
#[serde(rename = "BudgetName")]
pub budget_name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DescribeBudgetResponse {
#[serde(rename = "Budget")]
#[serde(skip_serializing_if = "Option::is_none")]
pub budget: Option<Budget>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DescribeBudgetsRequest {
#[serde(rename = "AccountId")]
pub account_id: String,
#[serde(rename = "MaxResults")]
#[serde(skip_serializing_if = "Option::is_none")]
pub max_results: Option<i64>,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DescribeBudgetsResponse {
#[serde(rename = "Budgets")]
#[serde(skip_serializing_if = "Option::is_none")]
pub budgets: Option<Vec<Budget>>,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DescribeNotificationsForBudgetRequest {
#[serde(rename = "AccountId")]
pub account_id: String,
#[serde(rename = "BudgetName")]
pub budget_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(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DescribeNotificationsForBudgetResponse {
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "Notifications")]
#[serde(skip_serializing_if = "Option::is_none")]
pub notifications: Option<Vec<Notification>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DescribeSubscribersForNotificationRequest {
#[serde(rename = "AccountId")]
pub account_id: String,
#[serde(rename = "BudgetName")]
pub budget_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>,
#[serde(rename = "Notification")]
pub notification: Notification,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DescribeSubscribersForNotificationResponse {
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "Subscribers")]
#[serde(skip_serializing_if = "Option::is_none")]
pub subscribers: Option<Vec<Subscriber>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct Notification {
#[serde(rename = "ComparisonOperator")]
pub comparison_operator: String,
#[serde(rename = "NotificationState")]
#[serde(skip_serializing_if = "Option::is_none")]
pub notification_state: Option<String>,
#[serde(rename = "NotificationType")]
pub notification_type: String,
#[serde(rename = "Threshold")]
pub threshold: f64,
#[serde(rename = "ThresholdType")]
#[serde(skip_serializing_if = "Option::is_none")]
pub threshold_type: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct NotificationWithSubscribers {
#[serde(rename = "Notification")]
pub notification: Notification,
#[serde(rename = "Subscribers")]
pub subscribers: Vec<Subscriber>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct Spend {
#[serde(rename = "Amount")]
pub amount: String,
#[serde(rename = "Unit")]
pub unit: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct Subscriber {
#[serde(rename = "Address")]
pub address: String,
#[serde(rename = "SubscriptionType")]
pub subscription_type: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct TimePeriod {
#[serde(rename = "End")]
#[serde(skip_serializing_if = "Option::is_none")]
pub end: Option<f64>,
#[serde(rename = "Start")]
#[serde(skip_serializing_if = "Option::is_none")]
pub start: Option<f64>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct UpdateBudgetRequest {
#[serde(rename = "AccountId")]
pub account_id: String,
#[serde(rename = "NewBudget")]
pub new_budget: Budget,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct UpdateBudgetResponse {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct UpdateNotificationRequest {
#[serde(rename = "AccountId")]
pub account_id: String,
#[serde(rename = "BudgetName")]
pub budget_name: String,
#[serde(rename = "NewNotification")]
pub new_notification: Notification,
#[serde(rename = "OldNotification")]
pub old_notification: Notification,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct UpdateNotificationResponse {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct UpdateSubscriberRequest {
#[serde(rename = "AccountId")]
pub account_id: String,
#[serde(rename = "BudgetName")]
pub budget_name: String,
#[serde(rename = "NewSubscriber")]
pub new_subscriber: Subscriber,
#[serde(rename = "Notification")]
pub notification: Notification,
#[serde(rename = "OldSubscriber")]
pub old_subscriber: Subscriber,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct UpdateSubscriberResponse {}
#[derive(Debug, PartialEq)]
pub enum CreateBudgetError {
CreationLimitExceeded(String),
DuplicateRecord(String),
InternalError(String),
InvalidParameter(String),
}
impl CreateBudgetError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<CreateBudgetError> {
if let Some(err) = proto::json::Error::parse(&res) {
match err.typ.as_str() {
"CreationLimitExceededException" => {
return RusotoError::Service(CreateBudgetError::CreationLimitExceeded(err.msg))
}
"DuplicateRecordException" => {
return RusotoError::Service(CreateBudgetError::DuplicateRecord(err.msg))
}
"InternalErrorException" => {
return RusotoError::Service(CreateBudgetError::InternalError(err.msg))
}
"InvalidParameterException" => {
return RusotoError::Service(CreateBudgetError::InvalidParameter(err.msg))
}
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
return RusotoError::Unknown(res);
}
}
impl fmt::Display for CreateBudgetError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for CreateBudgetError {
fn description(&self) -> &str {
match *self {
CreateBudgetError::CreationLimitExceeded(ref cause) => cause,
CreateBudgetError::DuplicateRecord(ref cause) => cause,
CreateBudgetError::InternalError(ref cause) => cause,
CreateBudgetError::InvalidParameter(ref cause) => cause,
}
}
}
#[derive(Debug, PartialEq)]
pub enum CreateNotificationError {
CreationLimitExceeded(String),
DuplicateRecord(String),
InternalError(String),
InvalidParameter(String),
NotFound(String),
}
impl CreateNotificationError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<CreateNotificationError> {
if let Some(err) = proto::json::Error::parse(&res) {
match err.typ.as_str() {
"CreationLimitExceededException" => {
return RusotoError::Service(CreateNotificationError::CreationLimitExceeded(
err.msg,
))
}
"DuplicateRecordException" => {
return RusotoError::Service(CreateNotificationError::DuplicateRecord(err.msg))
}
"InternalErrorException" => {
return RusotoError::Service(CreateNotificationError::InternalError(err.msg))
}
"InvalidParameterException" => {
return RusotoError::Service(CreateNotificationError::InvalidParameter(err.msg))
}
"NotFoundException" => {
return RusotoError::Service(CreateNotificationError::NotFound(err.msg))
}
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
return RusotoError::Unknown(res);
}
}
impl fmt::Display for CreateNotificationError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for CreateNotificationError {
fn description(&self) -> &str {
match *self {
CreateNotificationError::CreationLimitExceeded(ref cause) => cause,
CreateNotificationError::DuplicateRecord(ref cause) => cause,
CreateNotificationError::InternalError(ref cause) => cause,
CreateNotificationError::InvalidParameter(ref cause) => cause,
CreateNotificationError::NotFound(ref cause) => cause,
}
}
}
#[derive(Debug, PartialEq)]
pub enum CreateSubscriberError {
CreationLimitExceeded(String),
DuplicateRecord(String),
InternalError(String),
InvalidParameter(String),
NotFound(String),
}
impl CreateSubscriberError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<CreateSubscriberError> {
if let Some(err) = proto::json::Error::parse(&res) {
match err.typ.as_str() {
"CreationLimitExceededException" => {
return RusotoError::Service(CreateSubscriberError::CreationLimitExceeded(
err.msg,
))
}
"DuplicateRecordException" => {
return RusotoError::Service(CreateSubscriberError::DuplicateRecord(err.msg))
}
"InternalErrorException" => {
return RusotoError::Service(CreateSubscriberError::InternalError(err.msg))
}
"InvalidParameterException" => {
return RusotoError::Service(CreateSubscriberError::InvalidParameter(err.msg))
}
"NotFoundException" => {
return RusotoError::Service(CreateSubscriberError::NotFound(err.msg))
}
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
return RusotoError::Unknown(res);
}
}
impl fmt::Display for CreateSubscriberError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for CreateSubscriberError {
fn description(&self) -> &str {
match *self {
CreateSubscriberError::CreationLimitExceeded(ref cause) => cause,
CreateSubscriberError::DuplicateRecord(ref cause) => cause,
CreateSubscriberError::InternalError(ref cause) => cause,
CreateSubscriberError::InvalidParameter(ref cause) => cause,
CreateSubscriberError::NotFound(ref cause) => cause,
}
}
}
#[derive(Debug, PartialEq)]
pub enum DeleteBudgetError {
InternalError(String),
InvalidParameter(String),
NotFound(String),
}
impl DeleteBudgetError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<DeleteBudgetError> {
if let Some(err) = proto::json::Error::parse(&res) {
match err.typ.as_str() {
"InternalErrorException" => {
return RusotoError::Service(DeleteBudgetError::InternalError(err.msg))
}
"InvalidParameterException" => {
return RusotoError::Service(DeleteBudgetError::InvalidParameter(err.msg))
}
"NotFoundException" => {
return RusotoError::Service(DeleteBudgetError::NotFound(err.msg))
}
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
return RusotoError::Unknown(res);
}
}
impl fmt::Display for DeleteBudgetError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DeleteBudgetError {
fn description(&self) -> &str {
match *self {
DeleteBudgetError::InternalError(ref cause) => cause,
DeleteBudgetError::InvalidParameter(ref cause) => cause,
DeleteBudgetError::NotFound(ref cause) => cause,
}
}
}
#[derive(Debug, PartialEq)]
pub enum DeleteNotificationError {
InternalError(String),
InvalidParameter(String),
NotFound(String),
}
impl DeleteNotificationError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<DeleteNotificationError> {
if let Some(err) = proto::json::Error::parse(&res) {
match err.typ.as_str() {
"InternalErrorException" => {
return RusotoError::Service(DeleteNotificationError::InternalError(err.msg))
}
"InvalidParameterException" => {
return RusotoError::Service(DeleteNotificationError::InvalidParameter(err.msg))
}
"NotFoundException" => {
return RusotoError::Service(DeleteNotificationError::NotFound(err.msg))
}
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
return RusotoError::Unknown(res);
}
}
impl fmt::Display for DeleteNotificationError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DeleteNotificationError {
fn description(&self) -> &str {
match *self {
DeleteNotificationError::InternalError(ref cause) => cause,
DeleteNotificationError::InvalidParameter(ref cause) => cause,
DeleteNotificationError::NotFound(ref cause) => cause,
}
}
}
#[derive(Debug, PartialEq)]
pub enum DeleteSubscriberError {
InternalError(String),
InvalidParameter(String),
NotFound(String),
}
impl DeleteSubscriberError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<DeleteSubscriberError> {
if let Some(err) = proto::json::Error::parse(&res) {
match err.typ.as_str() {
"InternalErrorException" => {
return RusotoError::Service(DeleteSubscriberError::InternalError(err.msg))
}
"InvalidParameterException" => {
return RusotoError::Service(DeleteSubscriberError::InvalidParameter(err.msg))
}
"NotFoundException" => {
return RusotoError::Service(DeleteSubscriberError::NotFound(err.msg))
}
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
return RusotoError::Unknown(res);
}
}
impl fmt::Display for DeleteSubscriberError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DeleteSubscriberError {
fn description(&self) -> &str {
match *self {
DeleteSubscriberError::InternalError(ref cause) => cause,
DeleteSubscriberError::InvalidParameter(ref cause) => cause,
DeleteSubscriberError::NotFound(ref cause) => cause,
}
}
}
#[derive(Debug, PartialEq)]
pub enum DescribeBudgetError {
InternalError(String),
InvalidParameter(String),
NotFound(String),
}
impl DescribeBudgetError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<DescribeBudgetError> {
if let Some(err) = proto::json::Error::parse(&res) {
match err.typ.as_str() {
"InternalErrorException" => {
return RusotoError::Service(DescribeBudgetError::InternalError(err.msg))
}
"InvalidParameterException" => {
return RusotoError::Service(DescribeBudgetError::InvalidParameter(err.msg))
}
"NotFoundException" => {
return RusotoError::Service(DescribeBudgetError::NotFound(err.msg))
}
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
return RusotoError::Unknown(res);
}
}
impl fmt::Display for DescribeBudgetError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DescribeBudgetError {
fn description(&self) -> &str {
match *self {
DescribeBudgetError::InternalError(ref cause) => cause,
DescribeBudgetError::InvalidParameter(ref cause) => cause,
DescribeBudgetError::NotFound(ref cause) => cause,
}
}
}
#[derive(Debug, PartialEq)]
pub enum DescribeBudgetPerformanceHistoryError {
ExpiredNextToken(String),
InternalError(String),
InvalidNextToken(String),
InvalidParameter(String),
NotFound(String),
}
impl DescribeBudgetPerformanceHistoryError {
pub fn from_response(
res: BufferedHttpResponse,
) -> RusotoError<DescribeBudgetPerformanceHistoryError> {
if let Some(err) = proto::json::Error::parse(&res) {
match err.typ.as_str() {
"ExpiredNextTokenException" => {
return RusotoError::Service(
DescribeBudgetPerformanceHistoryError::ExpiredNextToken(err.msg),
)
}
"InternalErrorException" => {
return RusotoError::Service(
DescribeBudgetPerformanceHistoryError::InternalError(err.msg),
)
}
"InvalidNextTokenException" => {
return RusotoError::Service(
DescribeBudgetPerformanceHistoryError::InvalidNextToken(err.msg),
)
}
"InvalidParameterException" => {
return RusotoError::Service(
DescribeBudgetPerformanceHistoryError::InvalidParameter(err.msg),
)
}
"NotFoundException" => {
return RusotoError::Service(DescribeBudgetPerformanceHistoryError::NotFound(
err.msg,
))
}
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
return RusotoError::Unknown(res);
}
}
impl fmt::Display for DescribeBudgetPerformanceHistoryError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DescribeBudgetPerformanceHistoryError {
fn description(&self) -> &str {
match *self {
DescribeBudgetPerformanceHistoryError::ExpiredNextToken(ref cause) => cause,
DescribeBudgetPerformanceHistoryError::InternalError(ref cause) => cause,
DescribeBudgetPerformanceHistoryError::InvalidNextToken(ref cause) => cause,
DescribeBudgetPerformanceHistoryError::InvalidParameter(ref cause) => cause,
DescribeBudgetPerformanceHistoryError::NotFound(ref cause) => cause,
}
}
}
#[derive(Debug, PartialEq)]
pub enum DescribeBudgetsError {
ExpiredNextToken(String),
InternalError(String),
InvalidNextToken(String),
InvalidParameter(String),
NotFound(String),
}
impl DescribeBudgetsError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<DescribeBudgetsError> {
if let Some(err) = proto::json::Error::parse(&res) {
match err.typ.as_str() {
"ExpiredNextTokenException" => {
return RusotoError::Service(DescribeBudgetsError::ExpiredNextToken(err.msg))
}
"InternalErrorException" => {
return RusotoError::Service(DescribeBudgetsError::InternalError(err.msg))
}
"InvalidNextTokenException" => {
return RusotoError::Service(DescribeBudgetsError::InvalidNextToken(err.msg))
}
"InvalidParameterException" => {
return RusotoError::Service(DescribeBudgetsError::InvalidParameter(err.msg))
}
"NotFoundException" => {
return RusotoError::Service(DescribeBudgetsError::NotFound(err.msg))
}
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
return RusotoError::Unknown(res);
}
}
impl fmt::Display for DescribeBudgetsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DescribeBudgetsError {
fn description(&self) -> &str {
match *self {
DescribeBudgetsError::ExpiredNextToken(ref cause) => cause,
DescribeBudgetsError::InternalError(ref cause) => cause,
DescribeBudgetsError::InvalidNextToken(ref cause) => cause,
DescribeBudgetsError::InvalidParameter(ref cause) => cause,
DescribeBudgetsError::NotFound(ref cause) => cause,
}
}
}
#[derive(Debug, PartialEq)]
pub enum DescribeNotificationsForBudgetError {
ExpiredNextToken(String),
InternalError(String),
InvalidNextToken(String),
InvalidParameter(String),
NotFound(String),
}
impl DescribeNotificationsForBudgetError {
pub fn from_response(
res: BufferedHttpResponse,
) -> RusotoError<DescribeNotificationsForBudgetError> {
if let Some(err) = proto::json::Error::parse(&res) {
match err.typ.as_str() {
"ExpiredNextTokenException" => {
return RusotoError::Service(
DescribeNotificationsForBudgetError::ExpiredNextToken(err.msg),
)
}
"InternalErrorException" => {
return RusotoError::Service(
DescribeNotificationsForBudgetError::InternalError(err.msg),
)
}
"InvalidNextTokenException" => {
return RusotoError::Service(
DescribeNotificationsForBudgetError::InvalidNextToken(err.msg),
)
}
"InvalidParameterException" => {
return RusotoError::Service(
DescribeNotificationsForBudgetError::InvalidParameter(err.msg),
)
}
"NotFoundException" => {
return RusotoError::Service(DescribeNotificationsForBudgetError::NotFound(
err.msg,
))
}
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
return RusotoError::Unknown(res);
}
}
impl fmt::Display for DescribeNotificationsForBudgetError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DescribeNotificationsForBudgetError {
fn description(&self) -> &str {
match *self {
DescribeNotificationsForBudgetError::ExpiredNextToken(ref cause) => cause,
DescribeNotificationsForBudgetError::InternalError(ref cause) => cause,
DescribeNotificationsForBudgetError::InvalidNextToken(ref cause) => cause,
DescribeNotificationsForBudgetError::InvalidParameter(ref cause) => cause,
DescribeNotificationsForBudgetError::NotFound(ref cause) => cause,
}
}
}
#[derive(Debug, PartialEq)]
pub enum DescribeSubscribersForNotificationError {
ExpiredNextToken(String),
InternalError(String),
InvalidNextToken(String),
InvalidParameter(String),
NotFound(String),
}
impl DescribeSubscribersForNotificationError {
pub fn from_response(
res: BufferedHttpResponse,
) -> RusotoError<DescribeSubscribersForNotificationError> {
if let Some(err) = proto::json::Error::parse(&res) {
match err.typ.as_str() {
"ExpiredNextTokenException" => {
return RusotoError::Service(
DescribeSubscribersForNotificationError::ExpiredNextToken(err.msg),
)
}
"InternalErrorException" => {
return RusotoError::Service(
DescribeSubscribersForNotificationError::InternalError(err.msg),
)
}
"InvalidNextTokenException" => {
return RusotoError::Service(
DescribeSubscribersForNotificationError::InvalidNextToken(err.msg),
)
}
"InvalidParameterException" => {
return RusotoError::Service(
DescribeSubscribersForNotificationError::InvalidParameter(err.msg),
)
}
"NotFoundException" => {
return RusotoError::Service(DescribeSubscribersForNotificationError::NotFound(
err.msg,
))
}
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
return RusotoError::Unknown(res);
}
}
impl fmt::Display for DescribeSubscribersForNotificationError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DescribeSubscribersForNotificationError {
fn description(&self) -> &str {
match *self {
DescribeSubscribersForNotificationError::ExpiredNextToken(ref cause) => cause,
DescribeSubscribersForNotificationError::InternalError(ref cause) => cause,
DescribeSubscribersForNotificationError::InvalidNextToken(ref cause) => cause,
DescribeSubscribersForNotificationError::InvalidParameter(ref cause) => cause,
DescribeSubscribersForNotificationError::NotFound(ref cause) => cause,
}
}
}
#[derive(Debug, PartialEq)]
pub enum UpdateBudgetError {
InternalError(String),
InvalidParameter(String),
NotFound(String),
}
impl UpdateBudgetError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<UpdateBudgetError> {
if let Some(err) = proto::json::Error::parse(&res) {
match err.typ.as_str() {
"InternalErrorException" => {
return RusotoError::Service(UpdateBudgetError::InternalError(err.msg))
}
"InvalidParameterException" => {
return RusotoError::Service(UpdateBudgetError::InvalidParameter(err.msg))
}
"NotFoundException" => {
return RusotoError::Service(UpdateBudgetError::NotFound(err.msg))
}
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
return RusotoError::Unknown(res);
}
}
impl fmt::Display for UpdateBudgetError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for UpdateBudgetError {
fn description(&self) -> &str {
match *self {
UpdateBudgetError::InternalError(ref cause) => cause,
UpdateBudgetError::InvalidParameter(ref cause) => cause,
UpdateBudgetError::NotFound(ref cause) => cause,
}
}
}
#[derive(Debug, PartialEq)]
pub enum UpdateNotificationError {
DuplicateRecord(String),
InternalError(String),
InvalidParameter(String),
NotFound(String),
}
impl UpdateNotificationError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<UpdateNotificationError> {
if let Some(err) = proto::json::Error::parse(&res) {
match err.typ.as_str() {
"DuplicateRecordException" => {
return RusotoError::Service(UpdateNotificationError::DuplicateRecord(err.msg))
}
"InternalErrorException" => {
return RusotoError::Service(UpdateNotificationError::InternalError(err.msg))
}
"InvalidParameterException" => {
return RusotoError::Service(UpdateNotificationError::InvalidParameter(err.msg))
}
"NotFoundException" => {
return RusotoError::Service(UpdateNotificationError::NotFound(err.msg))
}
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
return RusotoError::Unknown(res);
}
}
impl fmt::Display for UpdateNotificationError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for UpdateNotificationError {
fn description(&self) -> &str {
match *self {
UpdateNotificationError::DuplicateRecord(ref cause) => cause,
UpdateNotificationError::InternalError(ref cause) => cause,
UpdateNotificationError::InvalidParameter(ref cause) => cause,
UpdateNotificationError::NotFound(ref cause) => cause,
}
}
}
#[derive(Debug, PartialEq)]
pub enum UpdateSubscriberError {
DuplicateRecord(String),
InternalError(String),
InvalidParameter(String),
NotFound(String),
}
impl UpdateSubscriberError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<UpdateSubscriberError> {
if let Some(err) = proto::json::Error::parse(&res) {
match err.typ.as_str() {
"DuplicateRecordException" => {
return RusotoError::Service(UpdateSubscriberError::DuplicateRecord(err.msg))
}
"InternalErrorException" => {
return RusotoError::Service(UpdateSubscriberError::InternalError(err.msg))
}
"InvalidParameterException" => {
return RusotoError::Service(UpdateSubscriberError::InvalidParameter(err.msg))
}
"NotFoundException" => {
return RusotoError::Service(UpdateSubscriberError::NotFound(err.msg))
}
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
return RusotoError::Unknown(res);
}
}
impl fmt::Display for UpdateSubscriberError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for UpdateSubscriberError {
fn description(&self) -> &str {
match *self {
UpdateSubscriberError::DuplicateRecord(ref cause) => cause,
UpdateSubscriberError::InternalError(ref cause) => cause,
UpdateSubscriberError::InvalidParameter(ref cause) => cause,
UpdateSubscriberError::NotFound(ref cause) => cause,
}
}
}
pub trait Budgets {
fn create_budget(
&self,
input: CreateBudgetRequest,
) -> RusotoFuture<CreateBudgetResponse, CreateBudgetError>;
fn create_notification(
&self,
input: CreateNotificationRequest,
) -> RusotoFuture<CreateNotificationResponse, CreateNotificationError>;
fn create_subscriber(
&self,
input: CreateSubscriberRequest,
) -> RusotoFuture<CreateSubscriberResponse, CreateSubscriberError>;
fn delete_budget(
&self,
input: DeleteBudgetRequest,
) -> RusotoFuture<DeleteBudgetResponse, DeleteBudgetError>;
fn delete_notification(
&self,
input: DeleteNotificationRequest,
) -> RusotoFuture<DeleteNotificationResponse, DeleteNotificationError>;
fn delete_subscriber(
&self,
input: DeleteSubscriberRequest,
) -> RusotoFuture<DeleteSubscriberResponse, DeleteSubscriberError>;
fn describe_budget(
&self,
input: DescribeBudgetRequest,
) -> RusotoFuture<DescribeBudgetResponse, DescribeBudgetError>;
fn describe_budget_performance_history(
&self,
input: DescribeBudgetPerformanceHistoryRequest,
) -> RusotoFuture<DescribeBudgetPerformanceHistoryResponse, DescribeBudgetPerformanceHistoryError>;
fn describe_budgets(
&self,
input: DescribeBudgetsRequest,
) -> RusotoFuture<DescribeBudgetsResponse, DescribeBudgetsError>;
fn describe_notifications_for_budget(
&self,
input: DescribeNotificationsForBudgetRequest,
) -> RusotoFuture<DescribeNotificationsForBudgetResponse, DescribeNotificationsForBudgetError>;
fn describe_subscribers_for_notification(
&self,
input: DescribeSubscribersForNotificationRequest,
) -> RusotoFuture<
DescribeSubscribersForNotificationResponse,
DescribeSubscribersForNotificationError,
>;
fn update_budget(
&self,
input: UpdateBudgetRequest,
) -> RusotoFuture<UpdateBudgetResponse, UpdateBudgetError>;
fn update_notification(
&self,
input: UpdateNotificationRequest,
) -> RusotoFuture<UpdateNotificationResponse, UpdateNotificationError>;
fn update_subscriber(
&self,
input: UpdateSubscriberRequest,
) -> RusotoFuture<UpdateSubscriberResponse, UpdateSubscriberError>;
}
#[derive(Clone)]
pub struct BudgetsClient {
client: Client,
region: region::Region,
}
impl BudgetsClient {
pub fn new(region: region::Region) -> BudgetsClient {
BudgetsClient {
client: Client::shared(),
region,
}
}
pub fn new_with<P, D>(
request_dispatcher: D,
credentials_provider: P,
region: region::Region,
) -> BudgetsClient
where
P: ProvideAwsCredentials + Send + Sync + 'static,
P::Future: Send,
D: DispatchSignedRequest + Send + Sync + 'static,
D::Future: Send,
{
BudgetsClient {
client: Client::new_with(credentials_provider, request_dispatcher),
region,
}
}
}
impl Budgets for BudgetsClient {
fn create_budget(
&self,
input: CreateBudgetRequest,
) -> RusotoFuture<CreateBudgetResponse, CreateBudgetError> {
let mut request = SignedRequest::new("POST", "budgets", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "AWSBudgetServiceGateway.CreateBudget");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().and_then(|response| {
proto::json::ResponsePayload::new(&response)
.deserialize::<CreateBudgetResponse, _>()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(CreateBudgetError::from_response(response))),
)
}
})
}
fn create_notification(
&self,
input: CreateNotificationRequest,
) -> RusotoFuture<CreateNotificationResponse, CreateNotificationError> {
let mut request = SignedRequest::new("POST", "budgets", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "AWSBudgetServiceGateway.CreateNotification");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().and_then(|response| {
proto::json::ResponsePayload::new(&response)
.deserialize::<CreateNotificationResponse, _>()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(CreateNotificationError::from_response(response))),
)
}
})
}
fn create_subscriber(
&self,
input: CreateSubscriberRequest,
) -> RusotoFuture<CreateSubscriberResponse, CreateSubscriberError> {
let mut request = SignedRequest::new("POST", "budgets", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "AWSBudgetServiceGateway.CreateSubscriber");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().and_then(|response| {
proto::json::ResponsePayload::new(&response)
.deserialize::<CreateSubscriberResponse, _>()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(CreateSubscriberError::from_response(response))),
)
}
})
}
fn delete_budget(
&self,
input: DeleteBudgetRequest,
) -> RusotoFuture<DeleteBudgetResponse, DeleteBudgetError> {
let mut request = SignedRequest::new("POST", "budgets", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "AWSBudgetServiceGateway.DeleteBudget");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().and_then(|response| {
proto::json::ResponsePayload::new(&response)
.deserialize::<DeleteBudgetResponse, _>()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(DeleteBudgetError::from_response(response))),
)
}
})
}
fn delete_notification(
&self,
input: DeleteNotificationRequest,
) -> RusotoFuture<DeleteNotificationResponse, DeleteNotificationError> {
let mut request = SignedRequest::new("POST", "budgets", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "AWSBudgetServiceGateway.DeleteNotification");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().and_then(|response| {
proto::json::ResponsePayload::new(&response)
.deserialize::<DeleteNotificationResponse, _>()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(DeleteNotificationError::from_response(response))),
)
}
})
}
fn delete_subscriber(
&self,
input: DeleteSubscriberRequest,
) -> RusotoFuture<DeleteSubscriberResponse, DeleteSubscriberError> {
let mut request = SignedRequest::new("POST", "budgets", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "AWSBudgetServiceGateway.DeleteSubscriber");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().and_then(|response| {
proto::json::ResponsePayload::new(&response)
.deserialize::<DeleteSubscriberResponse, _>()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(DeleteSubscriberError::from_response(response))),
)
}
})
}
fn describe_budget(
&self,
input: DescribeBudgetRequest,
) -> RusotoFuture<DescribeBudgetResponse, DescribeBudgetError> {
let mut request = SignedRequest::new("POST", "budgets", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "AWSBudgetServiceGateway.DescribeBudget");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().and_then(|response| {
proto::json::ResponsePayload::new(&response)
.deserialize::<DescribeBudgetResponse, _>()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(DescribeBudgetError::from_response(response))),
)
}
})
}
fn describe_budget_performance_history(
&self,
input: DescribeBudgetPerformanceHistoryRequest,
) -> RusotoFuture<DescribeBudgetPerformanceHistoryResponse, DescribeBudgetPerformanceHistoryError>
{
let mut request = SignedRequest::new("POST", "budgets", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"AWSBudgetServiceGateway.DescribeBudgetPerformanceHistory",
);
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().and_then(|response| {
proto::json::ResponsePayload::new(&response)
.deserialize::<DescribeBudgetPerformanceHistoryResponse, _>()
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(DescribeBudgetPerformanceHistoryError::from_response(
response,
))
}))
}
})
}
fn describe_budgets(
&self,
input: DescribeBudgetsRequest,
) -> RusotoFuture<DescribeBudgetsResponse, DescribeBudgetsError> {
let mut request = SignedRequest::new("POST", "budgets", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "AWSBudgetServiceGateway.DescribeBudgets");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().and_then(|response| {
proto::json::ResponsePayload::new(&response)
.deserialize::<DescribeBudgetsResponse, _>()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(DescribeBudgetsError::from_response(response))),
)
}
})
}
fn describe_notifications_for_budget(
&self,
input: DescribeNotificationsForBudgetRequest,
) -> RusotoFuture<DescribeNotificationsForBudgetResponse, DescribeNotificationsForBudgetError>
{
let mut request = SignedRequest::new("POST", "budgets", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"AWSBudgetServiceGateway.DescribeNotificationsForBudget",
);
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().and_then(|response| {
proto::json::ResponsePayload::new(&response)
.deserialize::<DescribeNotificationsForBudgetResponse, _>()
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(DescribeNotificationsForBudgetError::from_response(response))
}))
}
})
}
fn describe_subscribers_for_notification(
&self,
input: DescribeSubscribersForNotificationRequest,
) -> RusotoFuture<
DescribeSubscribersForNotificationResponse,
DescribeSubscribersForNotificationError,
> {
let mut request = SignedRequest::new("POST", "budgets", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"AWSBudgetServiceGateway.DescribeSubscribersForNotification",
);
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().and_then(|response| {
proto::json::ResponsePayload::new(&response)
.deserialize::<DescribeSubscribersForNotificationResponse, _>()
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(DescribeSubscribersForNotificationError::from_response(
response,
))
}))
}
})
}
fn update_budget(
&self,
input: UpdateBudgetRequest,
) -> RusotoFuture<UpdateBudgetResponse, UpdateBudgetError> {
let mut request = SignedRequest::new("POST", "budgets", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "AWSBudgetServiceGateway.UpdateBudget");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().and_then(|response| {
proto::json::ResponsePayload::new(&response)
.deserialize::<UpdateBudgetResponse, _>()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(UpdateBudgetError::from_response(response))),
)
}
})
}
fn update_notification(
&self,
input: UpdateNotificationRequest,
) -> RusotoFuture<UpdateNotificationResponse, UpdateNotificationError> {
let mut request = SignedRequest::new("POST", "budgets", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "AWSBudgetServiceGateway.UpdateNotification");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().and_then(|response| {
proto::json::ResponsePayload::new(&response)
.deserialize::<UpdateNotificationResponse, _>()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(UpdateNotificationError::from_response(response))),
)
}
})
}
fn update_subscriber(
&self,
input: UpdateSubscriberRequest,
) -> RusotoFuture<UpdateSubscriberResponse, UpdateSubscriberError> {
let mut request = SignedRequest::new("POST", "budgets", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "AWSBudgetServiceGateway.UpdateSubscriber");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().and_then(|response| {
proto::json::ResponsePayload::new(&response)
.deserialize::<UpdateSubscriberResponse, _>()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(UpdateSubscriberError::from_response(response))),
)
}
})
}
}