mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
[AWS|ASG] filtering for ASG Scaling Policies
This commit is contained in:
parent
ce3b3936f5
commit
41b1a48cb5
1 changed files with 7 additions and 3 deletions
|
@ -6,16 +6,20 @@ module Fog
|
|||
class Policies < Fog::Collection
|
||||
model Fog::AWS::AutoScaling::Policy
|
||||
|
||||
attribute :filters
|
||||
|
||||
# Creates a new scaling policy.
|
||||
def initialize(attributes={})
|
||||
super
|
||||
self.filters = attributes
|
||||
super(attributes)
|
||||
end
|
||||
|
||||
def all
|
||||
def all(filters = filters)
|
||||
data = []
|
||||
next_token = nil
|
||||
self.filters = filters
|
||||
loop do
|
||||
result = service.describe_policies('NextToken' => next_token).body['DescribePoliciesResult']
|
||||
result = service.describe_policies(filters.merge('NextToken' => next_token)).body['DescribePoliciesResult']
|
||||
data += result['ScalingPolicies']
|
||||
next_token = result['NextToken']
|
||||
break if next_token.nil?
|
||||
|
|
Loading…
Add table
Reference in a new issue