You are viewing documentation for version 3 of the AWS SDK for Ruby. Version 2 documentation can be found here.

Class: Aws::Budgets::Client

Inherits:
Seahorse::Client::Base show all
Includes:
ClientStubs
Defined in:
gems/aws-sdk-budgets/lib/aws-sdk-budgets/client.rb

Instance Attribute Summary

Attributes inherited from Seahorse::Client::Base

#config, #handlers

API Operations collapse

Instance Method Summary collapse

Methods included from ClientStubs

#stub_data, #stub_responses

Methods inherited from Seahorse::Client::Base

add_plugin, api, clear_plugins, define, new, #operation_names, plugins, remove_plugin, set_api, set_plugins

Methods included from Seahorse::Client::HandlerBuilder

#handle, #handle_request, #handle_response

Constructor Details

#initialize(*args) ⇒ Client

Returns a new instance of Client

Parameters:

  • options (Hash)

    a customizable set of options



152
153
154
# File 'gems/aws-sdk-budgets/lib/aws-sdk-budgets/client.rb', line 152

def initialize(*args)
  super
end

Instance Method Details

#create_budget(params = {}) ⇒ Struct

Creates a budget and, if included, notifications and subscribers.

Examples:

Request syntax with placeholder values


resp = client.create_budget({
  account_id: "AccountId", # required
  budget: { # required
    budget_name: "BudgetName", # required
    budget_limit: {
      amount: "NumericValue", # required
      unit: "UnitValue", # required
    },
    cost_filters: {
      "GenericString" => ["GenericString"],
    },
    cost_types: {
      include_tax: false,
      include_subscription: false,
      use_blended: false,
      include_refund: false,
      include_credit: false,
      include_upfront: false,
      include_recurring: false,
      include_other_subscription: false,
      include_support: false,
      include_discount: false,
      use_amortized: false,
    },
    time_unit: "DAILY", # required, accepts DAILY, MONTHLY, QUARTERLY, ANNUALLY
    time_period: {
      start: Time.now,
      end: Time.now,
    },
    calculated_spend: {
      actual_spend: { # required
        amount: "NumericValue", # required
        unit: "UnitValue", # required
      },
      forecasted_spend: {
        amount: "NumericValue", # required
        unit: "UnitValue", # required
      },
    },
    budget_type: "USAGE", # required, accepts USAGE, COST, RI_UTILIZATION
  },
  notifications_with_subscribers: [
    {
      notification: { # required
        notification_type: "ACTUAL", # required, accepts ACTUAL, FORECASTED
        comparison_operator: "GREATER_THAN", # required, accepts GREATER_THAN, LESS_THAN, EQUAL_TO
        threshold: 1.0, # required
        threshold_type: "PERCENTAGE", # accepts PERCENTAGE, ABSOLUTE_VALUE
      },
      subscribers: [ # required
        {
          subscription_type: "SNS", # required, accepts SNS, EMAIL
          address: "SubscriberAddress", # required
        },
      ],
    },
  ],
})

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :account_id (required, String)

    The accountId that is associated with the budget.

  • :budget (required, Types::Budget)

    The budget object that you want to create.

  • :notifications_with_subscribers (Array<Types::NotificationWithSubscribers>)

    A notification that you want to associate with a budget. A budget can have up to five notifications, and each notification can have one SNS subscriber and up to ten email subscribers. If you include notifications and subscribers in your CreateBudget call, AWS creates the notifications and subscribers for you.

Returns:

  • (Struct)

    Returns an empty response.



238
239
240
241
# File 'gems/aws-sdk-budgets/lib/aws-sdk-budgets/client.rb', line 238

def create_budget(params = {}, options = {})
  req = build_request(:create_budget, params)
  req.send_request(options)
end

#create_notification(params = {}) ⇒ Struct

Creates a notification. You must create the budget before you create the associated notification.

Examples:

Request syntax with placeholder values


resp = client.create_notification({
  account_id: "AccountId", # required
  budget_name: "BudgetName", # required
  notification: { # required
    notification_type: "ACTUAL", # required, accepts ACTUAL, FORECASTED
    comparison_operator: "GREATER_THAN", # required, accepts GREATER_THAN, LESS_THAN, EQUAL_TO
    threshold: 1.0, # required
    threshold_type: "PERCENTAGE", # accepts PERCENTAGE, ABSOLUTE_VALUE
  },
  subscribers: [ # required
    {
      subscription_type: "SNS", # required, accepts SNS, EMAIL
      address: "SubscriberAddress", # required
    },
  ],
})

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :account_id (required, String)

    The accountId that is associated with the budget that you want to create a notification for.

  • :budget_name (required, String)

    The name of the budget that you want AWS to notified you about. Budget names must be unique within an account.

  • :notification (required, Types::Notification)

    The notification that you want to create.

  • :subscribers (required, Array<Types::Subscriber>)

    A list of subscribers that you want to associate with the notification. Each notification can have one SNS subscriber and up to ten email subscribers.

Returns:

  • (Struct)

    Returns an empty response.



285
286
287
288
# File 'gems/aws-sdk-budgets/lib/aws-sdk-budgets/client.rb', line 285

def create_notification(params = {}, options = {})
  req = build_request(:create_notification, params)
  req.send_request(options)
end

#create_subscriber(params = {}) ⇒ Struct

Creates a subscriber. You must create the associated budget and notification before you create the subscriber.

Examples:

Request syntax with placeholder values


resp = client.create_subscriber({
  account_id: "AccountId", # required
  budget_name: "BudgetName", # required
  notification: { # required
    notification_type: "ACTUAL", # required, accepts ACTUAL, FORECASTED
    comparison_operator: "GREATER_THAN", # required, accepts GREATER_THAN, LESS_THAN, EQUAL_TO
    threshold: 1.0, # required
    threshold_type: "PERCENTAGE", # accepts PERCENTAGE, ABSOLUTE_VALUE
  },
  subscriber: { # required
    subscription_type: "SNS", # required, accepts SNS, EMAIL
    address: "SubscriberAddress", # required
  },
})

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :account_id (required, String)

    The accountId associated with the budget that you want to create a subscriber for.

  • :budget_name (required, String)

    The name of the budget that you want to subscribe to. Budget names must be unique within an account.

  • :notification (required, Types::Notification)

    The notification that you want to create a subscriber for.

  • :subscriber (required, Types::Subscriber)

    The subscriber that you want to associate with a budget notification.

Returns:

  • (Struct)

    Returns an empty response.



328
329
330
331
# File 'gems/aws-sdk-budgets/lib/aws-sdk-budgets/client.rb', line 328

def create_subscriber(params = {}, options = {})
  req = build_request(:create_subscriber, params)
  req.send_request(options)
end

#delete_budget(params = {}) ⇒ Struct

Deletes a budget. You can delete your budget at any time.

Deleting a budget also deletes the notifications and subscribers associated with that budget.

Examples:

Request syntax with placeholder values


resp = client.delete_budget({
  account_id: "AccountId", # required
  budget_name: "BudgetName", # required
})

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :account_id (required, String)

    The accountId that is associated with the budget that you want to delete.

  • :budget_name (required, String)

    The name of the budget that you want to delete.

Returns:

  • (Struct)

    Returns an empty response.



356
357
358
359
# File 'gems/aws-sdk-budgets/lib/aws-sdk-budgets/client.rb', line 356

def delete_budget(params = {}, options = {})
  req = build_request(:delete_budget, params)
  req.send_request(options)
end

#delete_notification(params = {}) ⇒ Struct

Deletes a notification.

Deleting a notification also deletes the subscribers associated with the notification.

Examples:

Request syntax with placeholder values


resp = client.delete_notification({
  account_id: "AccountId", # required
  budget_name: "BudgetName", # required
  notification: { # required
    notification_type: "ACTUAL", # required, accepts ACTUAL, FORECASTED
    comparison_operator: "GREATER_THAN", # required, accepts GREATER_THAN, LESS_THAN, EQUAL_TO
    threshold: 1.0, # required
    threshold_type: "PERCENTAGE", # accepts PERCENTAGE, ABSOLUTE_VALUE
  },
})

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :account_id (required, String)

    The accountId that is associated with the budget whose notification you want to delete.

  • :budget_name (required, String)

    The name of the budget whose notification you want to delete.

  • :notification (required, Types::Notification)

    The notification that you want to delete.

Returns:

  • (Struct)

    Returns an empty response.



393
394
395
396
# File 'gems/aws-sdk-budgets/lib/aws-sdk-budgets/client.rb', line 393

def delete_notification(params = {}, options = {})
  req = build_request(:delete_notification, params)
  req.send_request(options)
end

#delete_subscriber(params = {}) ⇒ Struct

Deletes a subscriber.

Deleting the last subscriber to a notification also deletes the notification.

Examples:

Request syntax with placeholder values


resp = client.delete_subscriber({
  account_id: "AccountId", # required
  budget_name: "BudgetName", # required
  notification: { # required
    notification_type: "ACTUAL", # required, accepts ACTUAL, FORECASTED
    comparison_operator: "GREATER_THAN", # required, accepts GREATER_THAN, LESS_THAN, EQUAL_TO
    threshold: 1.0, # required
    threshold_type: "PERCENTAGE", # accepts PERCENTAGE, ABSOLUTE_VALUE
  },
  subscriber: { # required
    subscription_type: "SNS", # required, accepts SNS, EMAIL
    address: "SubscriberAddress", # required
  },
})

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :account_id (required, String)

    The accountId that is associated with the budget whose subscriber you want to delete.

  • :budget_name (required, String)

    The name of the budget whose subscriber you want to delete.

  • :notification (required, Types::Notification)

    The notification whose subscriber you want to delete.

  • :subscriber (required, Types::Subscriber)

    The subscriber that you want to delete.

Returns:

  • (Struct)

    Returns an empty response.



437
438
439
440
# File 'gems/aws-sdk-budgets/lib/aws-sdk-budgets/client.rb', line 437

def delete_subscriber(params = {}, options = {})
  req = build_request(:delete_subscriber, params)
  req.send_request(options)
end

#describe_budget(params = {}) ⇒ Types::DescribeBudgetResponse

Describes a budget.

Examples:

Request syntax with placeholder values


resp = client.describe_budget({
  account_id: "AccountId", # required
  budget_name: "BudgetName", # required
})

Response structure


resp.budget.budget_name #=> String
resp.budget.budget_limit.amount #=> String
resp.budget.budget_limit.unit #=> String
resp.budget.cost_filters #=> Hash
resp.budget.cost_filters["GenericString"] #=> Array
resp.budget.cost_filters["GenericString"][0] #=> String
resp.budget.cost_types.include_tax #=> Boolean
resp.budget.cost_types.include_subscription #=> Boolean
resp.budget.cost_types.use_blended #=> Boolean
resp.budget.cost_types.include_refund #=> Boolean
resp.budget.cost_types.include_credit #=> Boolean
resp.budget.cost_types.include_upfront #=> Boolean
resp.budget.cost_types.include_recurring #=> Boolean
resp.budget.cost_types.include_other_subscription #=> Boolean
resp.budget.cost_types.include_support #=> Boolean
resp.budget.cost_types.include_discount #=> Boolean
resp.budget.cost_types.use_amortized #=> Boolean
resp.budget.time_unit #=> String, one of "DAILY", "MONTHLY", "QUARTERLY", "ANNUALLY"
resp.budget.time_period.start #=> Time
resp.budget.time_period.end #=> Time
resp.budget.calculated_spend.actual_spend.amount #=> String
resp.budget.calculated_spend.actual_spend.unit #=> String
resp.budget.calculated_spend.forecasted_spend.amount #=> String
resp.budget.calculated_spend.forecasted_spend.unit #=> String
resp.budget.budget_type #=> String, one of "USAGE", "COST", "RI_UTILIZATION"

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :account_id (required, String)

    The accountId that is associated with the budget that you want a description of.

  • :budget_name (required, String)

    The name of the budget that you want a description of.

Returns:



492
493
494
495
# File 'gems/aws-sdk-budgets/lib/aws-sdk-budgets/client.rb', line 492

def describe_budget(params = {}, options = {})
  req = build_request(:describe_budget, params)
  req.send_request(options)
end

#describe_budgets(params = {}) ⇒ Types::DescribeBudgetsResponse

Lists the budgets associated with an account.

Examples:

Request syntax with placeholder values


resp = client.describe_budgets({
  account_id: "AccountId", # required
  max_results: 1,
  next_token: "GenericString",
})

Response structure


resp.budgets #=> Array
resp.budgets[0].budget_name #=> String
resp.budgets[0].budget_limit.amount #=> String
resp.budgets[0].budget_limit.unit #=> String
resp.budgets[0].cost_filters #=> Hash
resp.budgets[0].cost_filters["GenericString"] #=> Array
resp.budgets[0].cost_filters["GenericString"][0] #=> String
resp.budgets[0].cost_types.include_tax #=> Boolean
resp.budgets[0].cost_types.include_subscription #=> Boolean
resp.budgets[0].cost_types.use_blended #=> Boolean
resp.budgets[0].cost_types.include_refund #=> Boolean
resp.budgets[0].cost_types.include_credit #=> Boolean
resp.budgets[0].cost_types.include_upfront #=> Boolean
resp.budgets[0].cost_types.include_recurring #=> Boolean
resp.budgets[0].cost_types.include_other_subscription #=> Boolean
resp.budgets[0].cost_types.include_support #=> Boolean
resp.budgets[0].cost_types.include_discount #=> Boolean
resp.budgets[0].cost_types.use_amortized #=> Boolean
resp.budgets[0].time_unit #=> String, one of "DAILY", "MONTHLY", "QUARTERLY", "ANNUALLY"
resp.budgets[0].time_period.start #=> Time
resp.budgets[0].time_period.end #=> Time
resp.budgets[0].calculated_spend.actual_spend.amount #=> String
resp.budgets[0].calculated_spend.actual_spend.unit #=> String
resp.budgets[0].calculated_spend.forecasted_spend.amount #=> String
resp.budgets[0].calculated_spend.forecasted_spend.unit #=> String
resp.budgets[0].budget_type #=> String, one of "USAGE", "COST", "RI_UTILIZATION"
resp.next_token #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :account_id (required, String)

    The accountId that is associated with the budgets that you want descriptions of.

  • :max_results (Integer)

    Optional integer. Specifies the maximum number of results to return in response.

  • :next_token (String)

    The pagination token that indicates the next set of results to retrieve.

Returns:



556
557
558
559
# File 'gems/aws-sdk-budgets/lib/aws-sdk-budgets/client.rb', line 556

def describe_budgets(params = {}, options = {})
  req = build_request(:describe_budgets, params)
  req.send_request(options)
end

#describe_notifications_for_budget(params = {}) ⇒ Types::DescribeNotificationsForBudgetResponse

Lists the notifications associated with a budget.

Examples:

Request syntax with placeholder values


resp = client.describe_notifications_for_budget({
  account_id: "AccountId", # required
  budget_name: "BudgetName", # required
  max_results: 1,
  next_token: "GenericString",
})

Response structure


resp.notifications #=> Array
resp.notifications[0].notification_type #=> String, one of "ACTUAL", "FORECASTED"
resp.notifications[0].comparison_operator #=> String, one of "GREATER_THAN", "LESS_THAN", "EQUAL_TO"
resp.notifications[0].threshold #=> Float
resp.notifications[0].threshold_type #=> String, one of "PERCENTAGE", "ABSOLUTE_VALUE"
resp.next_token #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :account_id (required, String)

    The accountId that is associated with the budget whose notifications you want descriptions of.

  • :budget_name (required, String)

    The name of the budget whose notifications you want descriptions of.

  • :max_results (Integer)

    Optional integer. Specifies the maximum number of results to return in response.

  • :next_token (String)

    The pagination token that indicates the next set of results to retrieve.

Returns:



603
604
605
606
# File 'gems/aws-sdk-budgets/lib/aws-sdk-budgets/client.rb', line 603

def describe_notifications_for_budget(params = {}, options = {})
  req = build_request(:describe_notifications_for_budget, params)
  req.send_request(options)
end

#describe_subscribers_for_notification(params = {}) ⇒ Types::DescribeSubscribersForNotificationResponse

Lists the subscribers associated with a notification.

Examples:

Request syntax with placeholder values


resp = client.describe_subscribers_for_notification({
  account_id: "AccountId", # required
  budget_name: "BudgetName", # required
  notification: { # required
    notification_type: "ACTUAL", # required, accepts ACTUAL, FORECASTED
    comparison_operator: "GREATER_THAN", # required, accepts GREATER_THAN, LESS_THAN, EQUAL_TO
    threshold: 1.0, # required
    threshold_type: "PERCENTAGE", # accepts PERCENTAGE, ABSOLUTE_VALUE
  },
  max_results: 1,
  next_token: "GenericString",
})

Response structure


resp.subscribers #=> Array
resp.subscribers[0].subscription_type #=> String, one of "SNS", "EMAIL"
resp.subscribers[0].address #=> String
resp.next_token #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :account_id (required, String)

    The accountId that is associated with the budget whose subscribers you want descriptions of.

  • :budget_name (required, String)

    The name of the budget whose subscribers you want descriptions of.

  • :notification (required, Types::Notification)

    The notification whose subscribers you want to list.

  • :max_results (Integer)

    Optional integer. Specifies the maximum number of results to return in response.

  • :next_token (String)

    The pagination token that indicates the next set of results to retrieve.

Returns:



657
658
659
660
# File 'gems/aws-sdk-budgets/lib/aws-sdk-budgets/client.rb', line 657

def describe_subscribers_for_notification(params = {}, options = {})
  req = build_request(:describe_subscribers_for_notification, params)
  req.send_request(options)
end

#update_budget(params = {}) ⇒ Struct

Updates a budget. You can change every part of a budget except for the budgetName and the calculatedSpend. When a budget is modified, the calculatedSpend drops to zero until AWS has new usage data to use for forecasting.

Examples:

Request syntax with placeholder values


resp = client.update_budget({
  account_id: "AccountId", # required
  new_budget: { # required
    budget_name: "BudgetName", # required
    budget_limit: {
      amount: "NumericValue", # required
      unit: "UnitValue", # required
    },
    cost_filters: {
      "GenericString" => ["GenericString"],
    },
    cost_types: {
      include_tax: false,
      include_subscription: false,
      use_blended: false,
      include_refund: false,
      include_credit: false,
      include_upfront: false,
      include_recurring: false,
      include_other_subscription: false,
      include_support: false,
      include_discount: false,
      use_amortized: false,
    },
    time_unit: "DAILY", # required, accepts DAILY, MONTHLY, QUARTERLY, ANNUALLY
    time_period: {
      start: Time.now,
      end: Time.now,
    },
    calculated_spend: {
      actual_spend: { # required
        amount: "NumericValue", # required
        unit: "UnitValue", # required
      },
      forecasted_spend: {
        amount: "NumericValue", # required
        unit: "UnitValue", # required
      },
    },
    budget_type: "USAGE", # required, accepts USAGE, COST, RI_UTILIZATION
  },
})

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :account_id (required, String)

    The accountId that is associated with the budget that you want to update.

  • :new_budget (required, Types::Budget)

    The budget that you want to update your budget to.

Returns:

  • (Struct)

    Returns an empty response.



723
724
725
726
# File 'gems/aws-sdk-budgets/lib/aws-sdk-budgets/client.rb', line 723

def update_budget(params = {}, options = {})
  req = build_request(:update_budget, params)
  req.send_request(options)
end

#update_notification(params = {}) ⇒ Struct

Updates a notification.

Examples:

Request syntax with placeholder values


resp = client.update_notification({
  account_id: "AccountId", # required
  budget_name: "BudgetName", # required
  old_notification: { # required
    notification_type: "ACTUAL", # required, accepts ACTUAL, FORECASTED
    comparison_operator: "GREATER_THAN", # required, accepts GREATER_THAN, LESS_THAN, EQUAL_TO
    threshold: 1.0, # required
    threshold_type: "PERCENTAGE", # accepts PERCENTAGE, ABSOLUTE_VALUE
  },
  new_notification: { # required
    notification_type: "ACTUAL", # required, accepts ACTUAL, FORECASTED
    comparison_operator: "GREATER_THAN", # required, accepts GREATER_THAN, LESS_THAN, EQUAL_TO
    threshold: 1.0, # required
    threshold_type: "PERCENTAGE", # accepts PERCENTAGE, ABSOLUTE_VALUE
  },
})

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :account_id (required, String)

    The accountId that is associated with the budget whose notification you want to update.

  • :budget_name (required, String)

    The name of the budget whose notification you want to update.

  • :old_notification (required, Types::Notification)

    The previous notification associated with a budget.

  • :new_notification (required, Types::Notification)

    The updated notification to be associated with a budget.

Returns:

  • (Struct)

    Returns an empty response.



766
767
768
769
# File 'gems/aws-sdk-budgets/lib/aws-sdk-budgets/client.rb', line 766

def update_notification(params = {}, options = {})
  req = build_request(:update_notification, params)
  req.send_request(options)
end

#update_subscriber(params = {}) ⇒ Struct

Updates a subscriber.

Examples:

Request syntax with placeholder values


resp = client.update_subscriber({
  account_id: "AccountId", # required
  budget_name: "BudgetName", # required
  notification: { # required
    notification_type: "ACTUAL", # required, accepts ACTUAL, FORECASTED
    comparison_operator: "GREATER_THAN", # required, accepts GREATER_THAN, LESS_THAN, EQUAL_TO
    threshold: 1.0, # required
    threshold_type: "PERCENTAGE", # accepts PERCENTAGE, ABSOLUTE_VALUE
  },
  old_subscriber: { # required
    subscription_type: "SNS", # required, accepts SNS, EMAIL
    address: "SubscriberAddress", # required
  },
  new_subscriber: { # required
    subscription_type: "SNS", # required, accepts SNS, EMAIL
    address: "SubscriberAddress", # required
  },
})

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :account_id (required, String)

    The accountId that is associated with the budget whose subscriber you want to update.

  • :budget_name (required, String)

    The name of the budget whose subscriber you want to update.

  • :notification (required, Types::Notification)

    The notification whose subscriber you want to update.

  • :old_subscriber (required, Types::Subscriber)

    The previous subscriber associated with a budget notification.

  • :new_subscriber (required, Types::Subscriber)

    The updated subscriber associated with a budget notification.

Returns:

  • (Struct)

    Returns an empty response.



814
815
816
817
# File 'gems/aws-sdk-budgets/lib/aws-sdk-budgets/client.rb', line 814

def update_subscriber(params = {}, options = {})
  req = build_request(:update_subscriber, params)
  req.send_request(options)
end