lib/aws-sdk-cloudwatch/alarm.rb in aws-sdk-cloudwatch-1.73.0 vs lib/aws-sdk-cloudwatch/alarm.rb in aws-sdk-cloudwatch-1.74.0

- old
+ new

@@ -256,11 +256,13 @@ # # alarm.reload.data # # @return [self] def load - resp = @client.describe_alarms(alarm_names: [@name]) + resp = Aws::Plugins::UserAgent.feature('resource') do + @client.describe_alarms(alarm_names: [@name]) + end @data = resp.metric_alarms[0] self end alias :reload :load @@ -301,11 +303,13 @@ # @return [Alarm] def wait_until_exists(options = {}, &block) options, params = separate_params_and_options(options) waiter = Waiters::AlarmExists.new(options) yield_waiter_and_warn(waiter, &block) if block_given? - waiter.wait(params.merge(alarm_names: [@name])) + Aws::Plugins::UserAgent.feature('resource') do + waiter.wait(params.merge(alarm_names: [@name])) + end Alarm.new({ name: @name, client: @client }) end @@ -402,11 +406,13 @@ else self_copy.reload unless attempts == options[:max_attempts] :retry end end - Aws::Waiters::Waiter.new(options).wait({}) + Aws::Plugins::UserAgent.feature('resource') do + Aws::Waiters::Waiter.new(options).wait({}) + end end # @!group Actions # @example Request syntax with placeholder values @@ -414,11 +420,13 @@ # alarm.delete() # @param [Hash] options ({}) # @return [EmptyStructure] def delete(options = {}) options = Aws::Util.deep_merge(options, alarm_names: [@name]) - resp = @client.delete_alarms(options) + resp = Aws::Plugins::UserAgent.feature('resource') do + @client.delete_alarms(options) + end resp.data end # @example Request syntax with placeholder values # @@ -453,33 +461,39 @@ # returned first, and specify `TimestampAscending` to have the oldest # history returned first. # @return [Types::DescribeAlarmHistoryOutput] def describe_history(options = {}) options = options.merge(alarm_name: @name) - resp = @client.describe_alarm_history(options) + resp = Aws::Plugins::UserAgent.feature('resource') do + @client.describe_alarm_history(options) + end resp.data end # @example Request syntax with placeholder values # # alarm.disable_actions() # @param [Hash] options ({}) # @return [EmptyStructure] def disable_actions(options = {}) options = Aws::Util.deep_merge(options, alarm_names: [@name]) - resp = @client.disable_alarm_actions(options) + resp = Aws::Plugins::UserAgent.feature('resource') do + @client.disable_alarm_actions(options) + end resp.data end # @example Request syntax with placeholder values # # alarm.enable_actions() # @param [Hash] options ({}) # @return [EmptyStructure] def enable_actions(options = {}) options = Aws::Util.deep_merge(options, alarm_names: [@name]) - resp = @client.enable_alarm_actions(options) + resp = Aws::Plugins::UserAgent.feature('resource') do + @client.enable_alarm_actions(options) + end resp.data end # @example Request syntax with placeholder values # @@ -503,11 +517,13 @@ # Scaling policy uses the information in this field to take the correct # action. # @return [EmptyStructure] def set_state(options = {}) options = options.merge(alarm_name: @name) - resp = @client.set_alarm_state(options) + resp = Aws::Plugins::UserAgent.feature('resource') do + @client.set_alarm_state(options) + end resp.data end # @!group Associations @@ -582,11 +598,13 @@ params = Aws::Util.copy_hash(options) params[:alarm_names] ||= [] batch.each do |item| params[:alarm_names] << item.name end - batch[0].client.delete_alarms(params) + Aws::Plugins::UserAgent.feature('resource') do + batch[0].client.delete_alarms(params) + end end nil end # @param options ({}) @@ -596,11 +614,13 @@ params = Aws::Util.copy_hash(options) params[:alarm_names] ||= [] batch.each do |item| params[:alarm_names] << item.name end - batch[0].client.disable_alarm_actions(params) + Aws::Plugins::UserAgent.feature('resource') do + batch[0].client.disable_alarm_actions(params) + end end nil end # @param options ({}) @@ -610,10 +630,12 @@ params = Aws::Util.copy_hash(options) params[:alarm_names] ||= [] batch.each do |item| params[:alarm_names] << item.name end - batch[0].client.enable_alarm_actions(params) + Aws::Plugins::UserAgent.feature('resource') do + batch[0].client.enable_alarm_actions(params) + end end nil end # @!endgroup