Sha256: e852a08a40d470667c1dedaff3cc24aae818fa5351fc4b5dcbe1033ec50ed7fe

Contents?: true

Size: 986 Bytes

Versions: 38

Compression:

Stored size: 986 Bytes

Contents

module Fog
  module Rackspace
    class AutoScale
      class Real
        def create_policy(group_id, options)
          
          data = [options]

          request(
            :method => 'POST',
            :body => Fog::JSON.encode(data),
            :path => "groups/#{group_id}/policies",
            :expects => 201
          )
        end
      end

      class Mock
        def create_policy(group_id, options)
          
          group = self.data[:autoscale_groups][group_id]

          if group.nil?
            raise Fog::Rackspace::AutoScale::NotFound
          end
          
          policy = {
            "id" => Fog::Rackspace::MockData.uuid,
            "name" => "set group to 5 servers",
            "desiredCapacity" => 5,
            "cooldown" => 1800,
            "type" => "webhook"
          }

          group['scalingPolicies'] << policy
          
          body = [policy]

          response(:body => body)

        end
      end
    end
  end
end

Version data entries

38 entries across 38 versions & 2 rubygems

Version Path
fog-maestrodev-1.20.0.20140305101839 lib/fog/rackspace/requests/auto_scale/create_policy.rb
fog-maestrodev-1.20.0.20140305101305 lib/fog/rackspace/requests/auto_scale/create_policy.rb
fog-maestrodev-1.19.0.20140212012611 lib/fog/rackspace/requests/auto_scale/create_policy.rb
fog-1.20.0 lib/fog/rackspace/requests/auto_scale/create_policy.rb
fog-maestrodev-1.19.0.20140110004459 lib/fog/rackspace/requests/auto_scale/create_policy.rb
fog-maestrodev-1.19.0.20140110003812 lib/fog/rackspace/requests/auto_scale/create_policy.rb
fog-maestrodev-1.19.0.20140109202555 lib/fog/rackspace/requests/auto_scale/create_policy.rb
fog-maestrodev-1.19.0.20140107192102 lib/fog/rackspace/requests/auto_scale/create_policy.rb
fog-maestrodev-1.19.0.20140107142106 lib/fog/rackspace/requests/auto_scale/create_policy.rb
fog-maestrodev-1.19.0.20131219203941 lib/fog/rackspace/requests/auto_scale/create_policy.rb
fog-maestrodev-1.18.0.20131219193542 lib/fog/rackspace/requests/auto_scale/create_policy.rb
fog-1.19.0 lib/fog/rackspace/requests/auto_scale/create_policy.rb
fog-maestrodev-1.18.0.20131219033443 lib/fog/rackspace/requests/auto_scale/create_policy.rb
fog-maestrodev-1.18.0.20131219032002 lib/fog/rackspace/requests/auto_scale/create_policy.rb
fog-maestrodev-1.18.0.20131219030716 lib/fog/rackspace/requests/auto_scale/create_policy.rb
fog-maestrodev-1.18.0.20131219022322 lib/fog/rackspace/requests/auto_scale/create_policy.rb
fog-maestrodev-1.18.0.20131218202447 lib/fog/rackspace/requests/auto_scale/create_policy.rb
fog-maestrodev-1.18.0.20131209091424 lib/fog/rackspace/requests/auto_scale/create_policy.rb
fog-maestrodev-1.18.0.20131209090811 lib/fog/rackspace/requests/auto_scale/create_policy.rb
fog-maestrodev-1.18.0.20131206115947 lib/fog/rackspace/requests/auto_scale/create_policy.rb